From 227109eef1abb03523c116286f76480b2ab9fa3c Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 17:14:54 +0800 Subject: [PATCH 01/10] Create pipeline to pack and push nuget package. --- .github/workflows/nuget.yml | 44 +++++++++++++++++++++++++++++ .github/workflows/tag.yml | 55 +++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++ bundle/nuget/fmt.nuspec | 30 ++++++++++++++++++++ bundle/nuget/fmt.props | 12 ++++++++ bundle/nuget/fmt.targets | 29 +++++++++++++++++++ 6 files changed, 173 insertions(+) create mode 100644 .github/workflows/nuget.yml create mode 100644 .github/workflows/tag.yml create mode 100644 bundle/nuget/fmt.nuspec create mode 100644 bundle/nuget/fmt.props create mode 100644 bundle/nuget/fmt.targets diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 00000000..b85b97a9 --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,44 @@ +name: windows + +on: pull_request + +jobs: + build: + runs-on: windows-latest + strategy: + matrix: + + 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: ${{runner.workspace}}/build + run: | + $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors + cmake --build . --config Debug --parallel $threads + cmake --build . --config Release --parallel $threads + + - 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 readme.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..4f3113c6 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,55 @@ +name: windows + +on: pull_request + +jobs: + build: + runs-on: windows-latest + strategy: + matrix: + + 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: ${{runner.workspace}}/build + run: | + $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors + cmake --build . --config Debug --parallel $threads + cmake --build . --config Release --parallel $threads + + - 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 readme.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/.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..79d588af --- /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 + + + + + + + + + + From 17bc23c72d454003ea39d723552e25af9c696abe Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 17:34:08 +0800 Subject: [PATCH 02/10] Rename pipelines. --- .github/workflows/nuget.yml | 2 +- .github/workflows/tag.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index b85b97a9..c8412b49 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -1,4 +1,4 @@ -name: windows +name: nuget on: pull_request diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 4f3113c6..f8a87ad9 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -1,4 +1,4 @@ -name: windows +name: tagging on: pull_request From 884c0d5bdd1bdeb76015a927d2c027632d90a1ce Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 17:48:15 +0800 Subject: [PATCH 03/10] Fix yaml syntax. --- .github/workflows/nuget.yml | 2 -- .github/workflows/tag.yml | 2 -- .github/workflows/windows.yml | 20 ++------------------ 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index c8412b49..817a59b7 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -5,8 +5,6 @@ on: pull_request jobs: build: runs-on: windows-latest - strategy: - matrix: steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index f8a87ad9..ff743f57 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -5,8 +5,6 @@ on: pull_request jobs: build: runs-on: windows-latest - strategy: - matrix: steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ece0372b..0bf2a92f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -9,27 +9,11 @@ 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 + shared: [ -DBUILD_SHARED_LIBS=ON ] steps: - uses: actions/checkout@v2 From 1846821a5f74d9707c398f0be6ef05b5617f109f Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 17:58:39 +0800 Subject: [PATCH 04/10] Fix yaml syntax. --- .github/workflows/nuget.yml | 5 ++--- .github/workflows/tag.yml | 5 ++--- .github/workflows/windows.yml | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 817a59b7..3ef4f5c0 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -25,9 +25,8 @@ jobs: - name: Build working-directory: ${{runner.workspace}}/build run: | - $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors - cmake --build . --config Debug --parallel $threads - cmake --build . --config Release --parallel $threads + cmake --build . --config Debug + cmake --build . --config Release - name: Test working-directory: build diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index ff743f57..e1e17cf0 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -25,9 +25,8 @@ jobs: - name: Build working-directory: ${{runner.workspace}}/build run: | - $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors - cmake --build . --config Debug --parallel $threads - cmake --build . --config Release --parallel $threads + cmake --build . --config Debug + cmake --build . --config Release - name: Test working-directory: build diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0bf2a92f..76837c13 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -33,9 +33,7 @@ jobs: - name: Build working-directory: ${{runner.workspace}}/build - run: | - $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors - cmake --build . --config ${{matrix.build_type}} --parallel $threads + run: cmake --build . --config ${{matrix.build_type}} - name: Test working-directory: ${{runner.workspace}}/build From 22d9268546aa337c539bd4536f8c0a8133d325a6 Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 18:04:53 +0800 Subject: [PATCH 05/10] Fix yaml syntax. --- .github/workflows/nuget.yml | 2 +- .github/workflows/tag.yml | 2 +- .github/workflows/windows.yml | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 3ef4f5c0..45d4312b 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -23,7 +23,7 @@ jobs: cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 .. - name: Build - working-directory: ${{runner.workspace}}/build + working-directory: build run: | cmake --build . --config Debug cmake --build . --config Release diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index e1e17cf0..ddb5b3ce 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -23,7 +23,7 @@ jobs: cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 .. - name: Build - working-directory: ${{runner.workspace}}/build + working-directory: build run: | cmake --build . --config Debug cmake --build . --config Release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 76837c13..fc1ff2d1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,17 +19,15 @@ jobs: - 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 + .. - name: Build working-directory: ${{runner.workspace}}/build From 0f00658e3041109e4b746ee126732d2daeaf222c Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 18:09:32 +0800 Subject: [PATCH 06/10] Fix yaml syntax. --- .github/workflows/windows.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index fc1ff2d1..49810e03 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -24,10 +24,7 @@ jobs: - name: Configure working-directory: build run: | - cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} \ - -A ${{matrix.platform}} \ - -DCMAKE_CXX_STANDARD=${{matrix.standard}} \ - .. + cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} -A ${{matrix.platform}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} .. - name: Build working-directory: ${{runner.workspace}}/build From 146e00d716639611101e0020c255817532471212 Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 18:14:48 +0800 Subject: [PATCH 07/10] Fix yaml syntax. --- .github/workflows/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 49810e03..87bf736f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -27,11 +27,11 @@ jobs: cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} -A ${{matrix.platform}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} .. - name: Build - working-directory: ${{runner.workspace}}/build + 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 From 753cc919a254ce765b750e9f1ca757526a6c8a28 Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 18:18:37 +0800 Subject: [PATCH 08/10] Fix yaml syntax. --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 87bf736f..c79f7360 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -12,7 +12,7 @@ jobs: os: [windows-2019, windows-latest] platform: [Win32, x64] build_type: [Debug, Release] - standard: [11, 17, 20] + standard: [11, 17] shared: [ -DBUILD_SHARED_LIBS=ON ] steps: From 5613a2df4805e7faf66306761014545f7e1557de Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 18:33:33 +0800 Subject: [PATCH 09/10] Fix nuget packaging. --- .github/workflows/nuget.yml | 4 ++-- .github/workflows/tag.yml | 4 ++-- bundle/nuget/fmt.nuspec | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 45d4312b..cb2d24d4 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -36,6 +36,6 @@ jobs: - name: NuGet Pack run: | - cp readme.rst readme.md - cp license.rst readme.md + 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 index ddb5b3ce..7b3950e3 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -36,8 +36,8 @@ jobs: - name: NuGet Pack run: | - cp readme.rst readme.md - cp license.rst readme.md + 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 }}" diff --git a/bundle/nuget/fmt.nuspec b/bundle/nuget/fmt.nuspec index 79d588af..935b0c99 100644 --- a/bundle/nuget/fmt.nuspec +++ b/bundle/nuget/fmt.nuspec @@ -24,7 +24,7 @@ - - + + \ No newline at end of file From f78268dd14868c07860d70b4a7e896d18c1e6f82 Mon Sep 17 00:00:00 2001 From: "Wu, Ganhao" Date: Thu, 23 Dec 2021 18:55:41 +0800 Subject: [PATCH 10/10] Fix yaml syntax. --- .github/workflows/tag.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 7b3950e3..6a99d5be 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -1,6 +1,9 @@ name: tagging -on: pull_request +on: + push: + tags: + - '*' jobs: build: