Reuse preinstalled .NET 10 SDK in CI
All checks were successful
smoke / smoke (push) Successful in 10s

This commit is contained in:
Vibe Myass
2026-03-16 04:39:20 +00:00
parent 3b523b78df
commit baa5eac3c5
2 changed files with 17 additions and 7 deletions

View File

@@ -74,34 +74,43 @@ jobs:
echo "Non-root runner detected; smoke-only test lane enabled."
fi
- name: Install .NET SDK
- name: Resolve .NET SDK
run: |
set -euo pipefail
if command -v dotnet >/dev/null 2>&1 && dotnet --list-sdks | grep -Eq '^10\.'; then
echo "Using preinstalled .NET 10 SDK from PATH."
echo "DOTNET_CMD=dotnet" >> "$GITHUB_ENV"
exit 0
fi
echo "Preinstalled .NET 10 SDK not found. Installing local SDK copy."
curl -fsSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh
bash dotnet-install.sh --channel 10.0 --quality ga --install-dir "$HOME/.dotnet"
echo "DOTNET_CMD=$HOME/.dotnet/dotnet" >> "$GITHUB_ENV"
- name: Show .NET info
run: |
set -euo pipefail
"$HOME/.dotnet/dotnet" --info
"${DOTNET_CMD}" --info
- name: Restore
run: |
set -euo pipefail
"$HOME/.dotnet/dotnet" restore
"${DOTNET_CMD}" restore
- name: Build
run: |
set -euo pipefail
"$HOME/.dotnet/dotnet" build --no-restore
"${DOTNET_CMD}" build --no-restore
- name: Smoke tests
run: |
set -euo pipefail
LIBNFTABLES_RUN_PRIVILEGED_TESTS=0 "$HOME/.dotnet/dotnet" test LibNftables.slnx --no-build --filter "Category!=Privileged"
LIBNFTABLES_RUN_PRIVILEGED_TESTS=0 "${DOTNET_CMD}" test LibNftables.slnx --no-build --filter "Category!=Privileged"
- name: Privileged tests
if: env.RUN_PRIVILEGED_TESTS == '1'
run: |
set -euo pipefail
LIBNFTABLES_RUN_PRIVILEGED_TESTS=1 "$HOME/.dotnet/dotnet" test LibNftables.slnx --no-build --filter "Category=Privileged"
LIBNFTABLES_RUN_PRIVILEGED_TESTS=1 "${DOTNET_CMD}" test LibNftables.slnx --no-build --filter "Category=Privileged"

View File

@@ -71,7 +71,8 @@ The repository includes a Gitea Actions smoke workflow at `.gitea/workflows/smok
- Runner label: `debian-13`
- Job model: root-aware smoke verification
- Workflow actions:
- bootstrap the .NET 10 SDK inside the job
- use a preinstalled .NET 10 SDK when the runner already has one
- otherwise bootstrap a local .NET 10 SDK inside the job
- restore
- build
- always run the non-privileged smoke test lane