Skip to content

Use Ubuntu 20.04 to build NuGet package #104

Use Ubuntu 20.04 to build NuGet package

Use Ubuntu 20.04 to build NuGet package #104

Workflow file for this run

name: NuGet Package
on: [push]
jobs:
build_unix:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-10.15]
include:
- os: ubuntu-20.04
lib-ext: so
artifact: linux-x64
- os: macos-10.15
lib-ext: dylib
artifact: osx-x64
steps:
- uses: actions/checkout@v3
- uses: lukka/get-cmake@latest
- name: Install OpenMP on macOS
if: matrix.os == 'macos-10.15'
run: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew reinstall --build-from-source --formula ./libomp.rb
- name: CMake build
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_MODULE=OFF
cmake --build build
- name: Run unit tests
run: ./build/tests/thot_test
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact }}
path: build/src/shared_library/libthot.${{ matrix.lib-ext }}
build_windows:
name: Build on windows-latest (${{ matrix.arch }})
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: [x86, x64]
include:
- arch: x86
vs-arch: win32
- arch: x64
vs-arch: x64
steps:
- uses: actions/checkout@v3
- uses: lukka/get-cmake@latest
- name: CMake build for ${{ matrix.arch }}
run: |
cmake -B build/${{ matrix.arch }} -A ${{ matrix.vs-arch }} -DBUILD_PYTHON_MODULE=OFF
cmake --build build/${{ matrix.arch }} --config Release
- name: Run unit tests
run: ./build/${{ matrix.arch }}/tests/Release/thot_test
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: win-${{ matrix.arch }}
path: build/${{ matrix.arch }}/src/shared_library/Release/thot.dll
create_package:
name: Create NuGet package
needs: [build_unix, build_windows]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
nuget-version: latest
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Pack
run: nuget pack nuget\Thot.nuspec -Properties Configuration=Release -BasePath nuget -OutputDirectory artifacts
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: nuget-package
path: artifacts/*.nupkg
- name: Push
if: startsWith(github.ref, 'refs/tags/v')
run: nuget push artifacts\*.nupkg -NoSymbols -SkipDuplicate -Source https://api.nuget.org/v3/index.json