Build wren native library for Linux distributions #35
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: WrenSharp CI | |
on: push | |
# schedule: | |
# - cron: '0 0 * * SUN' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 3 | |
matrix: | |
os: [ubuntu-latest, macos-latest] # TODO: Integrate CI for windows-latest | |
include: | |
- os: ubuntu-latest | |
wren-lib: 'wren/lib/libwren.so' | |
- os: macos-latest | |
wren-lib: 'wren/lib/libwren.dylib' | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Use .NET 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' # .NET 6 | |
- name: Build Solution | |
run: dotnet build | |
- name: Test | |
if: success() | |
shell: bash | |
run: | | |
export TEST_ARGS="WrenSharp.Tests/WrenSharp.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat="lcov" /p:CoverletOutput="coverage/" /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary" | |
echo "Try to run tests twice, in case I missed some annoyingly hard to reproduce memory error..." | |
dotnet test $TEST_ARGS || dotnet test $TEST_ARGS | |
- name: Upload Code Coverage | |
if: matrix.os == 'ubuntu-latest' # Only upload coverage data once | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload Wren Shared Library Artifact | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wren-lib-${{ matrix.os }} | |
path: ${{ matrix.wren-lib }} | |
package: | |
needs: build | |
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Use .NET 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' # .NET 6 | |
- name: Build Solution | |
run: dotnet build --configuration Release | |
- name: Download Wren Shared Library Artifact (mac OS) | |
uses: actions/download-artifact@v4 | |
with: | |
name: wren-lib-macos-latest | |
path: 'wren/lib' | |
# TODO: Artifact other linuxes somehow (e.g. linux-arm, linux-arm64, etc. see libuv NuGet pkg) | |
# Prerelease packaging | |
- name: Create NuGet Package (prerelease) | |
if: github.ref != 'refs/heads/master' && github.event_name == 'pull_request' | |
run: dotnet pack --configuration Release --version-suffix prerelease-$(date +%Y%m%d%H%M%S) | |
# Release packaging for merges to master | |
- name: Create NuGet Package | |
if: github.ref == 'refs/heads/master' | |
run: dotnet pack --configuration Release | |
# TODO: Switch to nuget/setup-nuget@v1 when NuGet is fixed, https://github.com/NuGet/Home/issues/8580#issuecomment-555696372 | |
# TODO: Also publish to NuGet | |
# - name: Authenticate with NuGet GPR | |
# run: nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/chances/index.json" -UserName chances -Password ${{ secrets.GITHUB_TOKEN }} | |
# - name: Publish NuGet Package to GPR | |
# run: nuget push WrenSharp/bin/Release/*.nupkg -Source GitHub -verbosity detailed # TODO: Fix this, setup-dotnet doesn't create the NuGet.config for some reason, ugh | |
- name: Publish NuGet Package to GPR | |
shell: bash | |
run: | | |
for f in ./WrenSharp/bin/Release/*.nupkg | |
do | |
curl -vX PUT -u "chances:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/chances/ | |
done |