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 + + + + + + + + + +