Skip to content

CI

CI #42

Workflow file for this run

name: CI
on:
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
version:
description: 'Release version to create'
required: false
jobs:
build_multihost:
strategy:
matrix:
include:
- vm: ubuntu-22.04
runs-on: ${{ matrix.vm }}
name: Build and test ${{ matrix.vm }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup dotnet 8.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: Setup dotnet 9.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: '9.0.x'
- name: Build (CI)
run: |
dotnet build -c Release -t:Pack src/Fallenwood.PublishAotCross.nuproj
dotnet publish -r linux-musl-arm64 -c Release test/Hello.csproj -p:StripSymbols=false
dotnet publish -r linux-musl-x64 -c Release test/Hello.csproj -p:StripSymbols=false -o output-linux-musl-x64
dotnet publish -r linux-musl-arm -c Release test/Hello9.csproj -p:StripSymbols=false -o output-linux-musl-arm
build:
strategy:
matrix:
include:
- vm: windows-latest
runs-on: ${{ matrix.vm }}
name: Build and test ${{ matrix.vm }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: Setup zig
uses: goto-bus-stop/setup-zig@v2
- name: Build (CI)
run: |
dotnet build -c Release -t:Pack src/Fallenwood.PublishAotCross.nuproj
dotnet publish -r linux-x64 -c Release test/Hello.csproj -p:StripSymbols=false -p:UseExternalZig=true
- name: Upload test binary
uses: actions/upload-artifact@v4
with:
name: Hello
path: test/bin/Release/net8.0/linux-x64/publish/Hello
validate:
needs: build
runs-on: ubuntu-latest
name: Try launching
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: Hello
- name: Launch
run: |
chmod +x ./Hello
./Hello
release:
needs: validate
runs-on: ubuntu-latest
name: Release
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
with:
nuget-version: latest
- name: Setup dotnet 8.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: Setup dotnet 9.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: '9.0.x'
- name: Build (CD)
if: ${{ github.event.inputs.version != '' }}
run: dotnet build -c Release -t:Pack src/Fallenwood.PublishAotCross.nuproj -p:Version=${{ github.event.inputs.version }}
- name: Push to GitHub package registry
if: ${{ github.event.inputs.version != '' }}
run: dotnet nuget push src/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
- name: Push to NuGet.org
if: ${{ github.event.inputs.version != '' }}
run: dotnet nuget push src/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json