Merge pull request #2 from wuganhao/feature/nuget
Create pipeline to pack and push nuget package.
This commit is contained in:
commit
9014aafa53
41
.github/workflows/nuget.yml
vendored
Normal file
41
.github/workflows/nuget.yml
vendored
Normal file
@ -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
|
||||||
55
.github/workflows/tag.yml
vendored
Normal file
55
.github/workflows/tag.yml
vendored
Normal file
@ -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 }}
|
||||||
41
.github/workflows/windows.yml
vendored
41
.github/workflows/windows.yml
vendored
@ -9,52 +9,29 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# windows-2016 and windows-2019 have MSVC 2017 and 2019 installed
|
# windows-2016 and windows-2019 have MSVC 2017 and 2019 installed
|
||||||
# respectively: https://github.com/actions/virtual-environments.
|
# respectively: https://github.com/actions/virtual-environments.
|
||||||
os: [windows-2016, windows-2019]
|
os: [windows-2019, windows-latest]
|
||||||
platform: [Win32, x64]
|
platform: [Win32, x64]
|
||||||
build_type: [Debug, Release]
|
build_type: [Debug, Release]
|
||||||
standard: [11, 17, 20]
|
standard: [11, 17]
|
||||||
include:
|
shared: [ -DBUILD_SHARED_LIBS=ON ]
|
||||||
- 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
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: cmake -E make_directory ${{runner.workspace}}/build
|
run: cmake -E make_directory build
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
# Use a bash shell for $GITHUB_WORKSPACE.
|
working-directory: build
|
||||||
shell: bash
|
|
||||||
working-directory: ${{runner.workspace}}/build
|
|
||||||
run: |
|
run: |
|
||||||
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} \
|
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.shared}} -A ${{matrix.platform}} -DCMAKE_CXX_STANDARD=${{matrix.standard}} ..
|
||||||
-A ${{matrix.platform}} \
|
|
||||||
-DCMAKE_CXX_STANDARD=${{matrix.standard}} \
|
|
||||||
$GITHUB_WORKSPACE
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: build
|
||||||
run: |
|
run: cmake --build . --config ${{matrix.build_type}}
|
||||||
$threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
|
|
||||||
cmake --build . --config ${{matrix.build_type}} --parallel $threads
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: build
|
||||||
run: ctest -C ${{matrix.build_type}} -V
|
run: ctest -C ${{matrix.build_type}} -V
|
||||||
env:
|
env:
|
||||||
CTEST_OUTPUT_ON_FAILURE: True
|
CTEST_OUTPUT_ON_FAILURE: True
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -35,3 +35,6 @@ FMT.build
|
|||||||
Makefile
|
Makefile
|
||||||
run-msbuild.bat
|
run-msbuild.bat
|
||||||
fmt.pc
|
fmt.pc
|
||||||
|
*.nupkg
|
||||||
|
/license.md
|
||||||
|
/readme.md
|
||||||
|
|||||||
30
bundle/nuget/fmt.nuspec
Normal file
30
bundle/nuget/fmt.nuspec
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>$Id$</id>
|
||||||
|
<version>$version$</version>
|
||||||
|
<authors>Wu Ganhao<wuganhao@hotmail.com></authors>
|
||||||
|
<owners>Wu Ganhao<wuganhao@hotmail.com></owners>
|
||||||
|
<developmentDependency>true</developmentDependency>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<description>{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.</description>
|
||||||
|
<repository type="git" url="https://github.com/$repository$/" />
|
||||||
|
<license type="file">docs\license.md</license>
|
||||||
|
<readme>docs\readme.md</readme>
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="native0.0" />
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="include\fmt\**\*" target="include\fmt\" />
|
||||||
|
<file src="build\Debug\fmtd.lib" target="lib\native\x64\debug\" />
|
||||||
|
<file src="build\bin\Debug\fmtd.dll" target="lib\native\x64\debug\" />
|
||||||
|
<file src="build\bin\Debug\fmtd.pdb" target="lib\native\x64\debug\" />
|
||||||
|
<file src="build\Release\fmt.lib" target="lib\native\x64\debug\" />
|
||||||
|
<file src="build\bin\Release\fmt.dll" target="lib\native\x64\debug\" />
|
||||||
|
<file src="bundle\nuget\fmt.props" target="build\$Id$.props" />
|
||||||
|
<file src="bundle\nuget\fmt.targets" target="build\$Id$.targets" />
|
||||||
|
<file src="license.md" target="docs\" />
|
||||||
|
<file src="readme.md" target="docs\" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
12
bundle/nuget/fmt.props
Normal file
12
bundle/nuget/fmt.props
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<fmtIncludePaths>$(MSBuildThisFileDirectory)..\include\;$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)</fmtIncludePaths>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||||
|
<fmtLibs>fmt.lib;</fmtLibs>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
|
<fmtLibs>fmtd.lib;</fmtLibs>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
29
bundle/nuget/fmt.targets
Normal file
29
bundle/nuget/fmt.targets
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>$(fmtIncludePaths);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>%(fmtLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\lib\native\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<BuildDependsOn>$(BuildDependsOn);DeployfmtArtifacts</BuildDependsOn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<wxWidgetsArtifacts Include="$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)\*.dll" />
|
||||||
|
<wxWidgetsArtifacts Condition="'$(Configuration)'=='Debug'" Include="$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)\*.pdb" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Target Name="DeployfmtArtifacts">
|
||||||
|
<Error Text="Package 'wxWidgets' currently only support 64bit build" Condition="'$(Platform)'!='x64'" />
|
||||||
|
<Copy SourceFiles="@(fmtArtifacts)" DestinationFolder="$(TargetDir)\" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue
Block a user