Skip to content

Replace Task.FromResult with NSubstitute shorthand in GitHubServiceTests #210

Replace Task.FromResult with NSubstitute shorthand in GitHubServiceTests

Replace Task.FromResult with NSubstitute shorthand in GitHubServiceTests #210

Workflow file for this run

name: CI
on:
workflow_dispatch: # Manual trigger runs all jobs
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-dotnet
- name: Check C# formatting (dotnet format)
run: dotnet format --verify-no-changes
- name: Setup actionlint
uses: raven-actions/actionlint@v2
- name: Setup shfmt
uses: mfinelli/setup-shfmt@v4
- name: Check shell script formatting (shfmt)
run: shfmt -d -i 2 -ci -bn -sr scripts/ tests/
- name: Check shell scripts (shellcheck)
run: find scripts tests -name '*.sh' -type f -exec shellcheck --severity=warning {} +
- name: Check GitHub Actions workflows (actionlint)
run: actionlint
- name: Check Markdown files (markdownlint)
uses: DavidAnson/markdownlint-cli2-action@v22
with:
globs: |
*.md
docs/**/*.md
.github/**/*.md
.claude/**/*.md
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-dotnet
- name: Test
run: dotnet test ./tests/Keystone.Cli.UnitTests/Keystone.Cli.UnitTests.csproj -c Release
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
packaging: ${{ steps.filter.outputs.packaging }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
packaging:
- 'src/**/*.csproj'
- 'Directory.Build.props'
- 'nfpm.yaml'
- 'scripts/package-deb.sh'
- 'scripts/verify-deb-install.sh'
- 'tests/deb/**'
build-deb:
name: Build .deb (${{ matrix.arch }})
needs: changes
if: needs.changes.outputs.packaging == 'true' || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
arch: amd64
rid: linux-x64
- runner: ubuntu-24.04-arm
arch: arm64
rid: linux-arm64
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-dotnet
- name: Publish
env:
RID: ${{ matrix.rid }}
run: dotnet publish ./src/Keystone.Cli/Keystone.Cli.csproj -c Release -r "${RID}"
- name: Build .deb package
uses: ./.github/actions/build-deb
with:
rid: ${{ matrix.rid }}
- name: Upload .deb artifact
uses: actions/upload-artifact@v6
with:
name: deb-${{ matrix.rid }}
path: artifacts/release/keystone-cli_*.deb
if-no-files-found: error
test-deb:
name: Test .deb (${{ matrix.distro }}-${{ matrix.arch }})
needs: [changes, build-deb]
if: needs.changes.outputs.packaging == 'true' || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.runner }}
container: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
arch: amd64
rid: linux-x64
distro: debian
image: debian:bookworm
- runner: ubuntu-latest
arch: amd64
rid: linux-x64
distro: ubuntu
image: ubuntu:24.04
- runner: ubuntu-24.04-arm
arch: arm64
rid: linux-arm64
distro: debian
image: debian:bookworm
- runner: ubuntu-24.04-arm
arch: arm64
rid: linux-arm64
distro: ubuntu
image: ubuntu:24.04
steps:
- name: Checkout (for verify script)
uses: actions/checkout@v6
with:
sparse-checkout: scripts
sparse-checkout-cone-mode: false
- name: Download .deb artifact
uses: actions/download-artifact@v7
with:
name: deb-${{ matrix.rid }}
path: deb
- name: Verify installation
# SAFE_ARCH is the validated architecture; * is left unquoted for globbing and "$SAFE_ARCH" is quoted after the glob.
env:
ARCH: ${{ matrix.arch }}
run: |
SAFE_ARCH="$(./scripts/validate-arch.sh "${ARCH}")"
bash ./scripts/verify-deb-install.sh ./deb/keystone-cli_*_"${SAFE_ARCH}".deb