diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 00000000..cb2d24d4 --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,41 @@ +name: nuget + +on: pull_request + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - uses: nuget/setup-nuget@v1 + with: + nuget-api-key: ${{ secrets.nuget_apikey }} + nuget-version: '5.x' + + - name: Create Build Environment + run: cmake -E make_directory build + + - name: Configure + working-directory: build + run: | + cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 .. + + - name: Build + working-directory: build + run: | + cmake --build . --config Debug + cmake --build . --config Release + + - name: Test + working-directory: build + run: ctest -C Debug -V + env: + CTEST_OUTPUT_ON_FAILURE: True + + - name: NuGet Pack + run: | + cp readme.rst readme.md + cp license.rst license.md + nuget pack bundle\nuget\fmt.nuspec -properties Id=wuganhao.fmt -version 1.0-dev -basepath . -OutputFileNamesWithoutVersion \ No newline at end of file diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000..6a99d5be --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,55 @@ +name: tagging + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - uses: nuget/setup-nuget@v1 + with: + nuget-api-key: ${{ secrets.nuget_apikey }} + nuget-version: '5.x' + + - name: Create Build Environment + run: cmake -E make_directory build + + - name: Configure + working-directory: build + run: | + cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 .. + + - name: Build + working-directory: build + run: | + cmake --build . --config Debug + cmake --build . --config Release + + - name: Test + working-directory: build + run: ctest -C Debug -V + env: + CTEST_OUTPUT_ON_FAILURE: True + + - name: NuGet Pack + run: | + cp readme.rst readme.md + cp license.rst license.md + $Tag = "${{ github.ref }}" -replace '(refs/tags/)(.+)', '$2' + $Version = $Tag -replace '((\d+)(\.\d+){1,3})(-.+|)', '$1' + $InformationalVersion = "$Tag SHA-${{ github.SHA }}" + $PackageVersion = $Tag + echo "Version: $Tag" + echo "Informational Version: $InformationalVersion" + echo "Package Version: $Tag" + nuget pack bundle\nuget\fmt.nuspec -properties Id=wuganhao.fmt -version $PackageVersion -basepath . -OutputFileNamesWithoutVersion -OutputDirectory dist + + - name: Nuget Push + run: | + nuget push dist\*.nupkg -source https://api.nuget.org/v3/index.json -apikey ${{ secrets.nuget_apikey }} \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ece0372b..c79f7360 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -9,52 +9,29 @@ jobs: matrix: # windows-2016 and windows-2019 have MSVC 2017 and 2019 installed # respectively: https://github.com/actions/virtual-environments. - os: [windows-2016, windows-2019] + os: [windows-2019, windows-latest] platform: [Win32, x64] build_type: [Debug, Release] - standard: [11, 17, 20] - include: - - os: windows-2016 - platform: Win32 - build_type: Debug - shared: -DBUILD_SHARED_LIBS=ON - exclude: - - os: windows-2016 - platform: Win32 - - os: windows-2016 - standard: 17 - - os: windows-2016 - standard: 20 - - os: windows-2019 - standard: 11 - - os: windows-2019 - standard: 20 - platform: Win32 + standard: [11, 17] + shared: [ -DBUILD_SHARED_LIBS=ON ] steps: - uses: actions/checkout@v2 - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build + run: cmake -E make_directory build - name: Configure - # Use a bash shell for $GITHUB_WORKSPACE. - shell: bash - working-directory: ${{runner.workspace}}/build + working-directory: build run: | - cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} \ - -A ${{matrix.platform}} \ - -DCMAKE_CXX_STANDARD=${{matrix.standard}} \ - $GITHUB_WORKSPACE + cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} -A ${{matrix.platform}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} .. - name: Build - working-directory: ${{runner.workspace}}/build - run: | - $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors - cmake --build . --config ${{matrix.build_type}} --parallel $threads + working-directory: build + run: cmake --build . --config ${{matrix.build_type}} - name: Test - working-directory: ${{runner.workspace}}/build + working-directory: build run: ctest -C ${{matrix.build_type}} -V env: CTEST_OUTPUT_ON_FAILURE: True diff --git a/.gitignore b/.gitignore index 8a37cb98..4b621bf1 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ FMT.build Makefile run-msbuild.bat fmt.pc +*.nupkg +/license.md +/readme.md diff --git a/bundle/nuget/fmt.nuspec b/bundle/nuget/fmt.nuspec new file mode 100644 index 00000000..935b0c99 --- /dev/null +++ b/bundle/nuget/fmt.nuspec @@ -0,0 +1,30 @@ + + + + $Id$ + $version$ + Wu Ganhao<wuganhao@hotmail.com> + Wu Ganhao<wuganhao@hotmail.com> + true + false + {fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams. + + docs\license.md + docs\readme.md + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundle/nuget/fmt.props b/bundle/nuget/fmt.props new file mode 100644 index 00000000..dd9cfe30 --- /dev/null +++ b/bundle/nuget/fmt.props @@ -0,0 +1,12 @@ + + + + $(MSBuildThisFileDirectory)..\include\;$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration) + + + fmt.lib; + + + fmtd.lib; + + diff --git a/bundle/nuget/fmt.targets b/bundle/nuget/fmt.targets new file mode 100644 index 00000000..233eb04f --- /dev/null +++ b/bundle/nuget/fmt.targets @@ -0,0 +1,29 @@ + + + + + $(fmtIncludePaths);%(AdditionalIncludeDirectories) + + + + + %(fmtLibs);%(AdditionalDependencies) + + + + + $(MSBuildThisFileDirectory)..\lib\native\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + + + + $(BuildDependsOn);DeployfmtArtifacts + + + + + + + + + +