Skip to content

Guard prerelease publishing #232

Guard prerelease publishing

Guard prerelease publishing #232

Workflow file for this run

name: pr_validation
on:
push:
branches:
- master
- dev
- main
pull_request:
branches:
- master
- dev
- main
jobs:
test:
name: Test-${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
global-json-file: "./global.json"
- name: "Restore .NET tools"
run: dotnet tool restore
- name: "Update release notes"
shell: pwsh
run: |
./build.ps1
- name: "dotnet build"
run: dotnet build -c Release
- name: "dotnet test"
shell: bash
run: dotnet test -c Release
pack:
name: NuGet Pack
runs-on: ubuntu-latest
needs: test
steps:
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
global-json-file: "./global.json"
- name: "dotnet pack"
run: dotnet pack -c Release -o ./bin/nuget
- name: "Upload NuGet Artifacts"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: nuget-packages
path: ./bin/nuget/*.nupkg
retention-days: 7
slopwatch:
name: Slopwatch
runs-on: ubuntu-latest
needs: test
timeout-minutes: 10
steps:
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
global-json-file: "./global.json"
- name: "Restore .NET tools"
run: dotnet tool restore
- name: "slopwatch analyze"
run: dotnet slopwatch analyze
script-lint:
name: Script Lint
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: "ShellCheck (bash)"
run: shellcheck scripts/install-skillserver.sh
- name: "Syntax check (PowerShell)"
shell: pwsh
run: |
$errors = $null
[System.Management.Automation.PSParser]::Tokenize(
(Get-Content -Raw scripts/install-skillserver.ps1), [ref]$errors) | Out-Null
if ($errors.Count -gt 0) {
$errors | ForEach-Object { Write-Error $_.Message }
exit 1
}
Write-Host "PowerShell syntax OK"
cli-publish:
name: CLI Publish Dry Run
runs-on: ubuntu-latest
needs: test
steps:
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
global-json-file: "./global.json"
- name: "Publish CLI (trimmed, linux-x64)"
run: |
dotnet publish src/Netclaw.SkillServer.Cli/Netclaw.SkillServer.Cli.csproj \
-c Release \
-r linux-x64 \
--self-contained \
-p:PublishSingleFile=true \
-p:TrimmerSingleWarn=false \
-o ./publish/linux-x64
- name: "Check trim warnings"
run: |
dotnet publish src/Netclaw.SkillServer.Cli/Netclaw.SkillServer.Cli.csproj \
-c Release \
-r linux-x64 \
--self-contained \
-p:PublishSingleFile=true \
-p:TrimmerSingleWarn=false \
-p:TreatWarningsAsErrors=true \
-warnAsError:IL2026 -warnAsError:IL2057 \
-warnAsError:IL2067 -warnAsError:IL2075 \
-warnAsError:IL2096 -warnAsError:IL3050
- name: "Smoke test"
run: |
./publish/linux-x64/skillserver --version
./publish/linux-x64/skillserver --help
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: test
steps:
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
global-json-file: "./global.json"
- name: "Set up Docker"
uses: docker/setup-docker-action@v4
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- name: "Build Container Image"
run: dotnet publish src/SkillServer/SkillServer.csproj -c Release /t:PublishContainer