mirror of
https://github.com/Sea-Haven-Industries/.github.git
synced 2026-10-01 02:53:12 +00:00
The group key ci-${{ github.workflow }}-${{ github.ref }} resolves
identically for every job in a caller workflow (github.workflow is the
caller's name in a reusable workflow), so repos calling two reusable CI
workflows from one ci.yaml (e.g. exec-aide python + typescript) had
their jobs cancel each other on every run.
Prefix each group with the reusable workflow's own filename and append
its distinguishing input (source-dirs / working-directory) so sibling
jobs get distinct groups while superseded runs of the same job still
cancel.
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: CI — .NET
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
dotnet-version:
|
|
description: ".NET SDK version"
|
|
type: string
|
|
default: "8.0.x"
|
|
working-directory:
|
|
description: "Directory containing the solution/project"
|
|
type: string
|
|
default: "."
|
|
solution:
|
|
description: "Solution or project file to build"
|
|
type: string
|
|
default: "*.sln"
|
|
run-tests:
|
|
description: "Run dotnet test"
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
concurrency:
|
|
group: ci-dotnet-${{ github.workflow }}-${{ github.ref }}-${{ inputs.working-directory }}
|
|
cancel-in-progress: true
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ inputs.working-directory }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: ${{ inputs.dotnet-version }}
|
|
|
|
- name: Restore
|
|
run: dotnet restore ${{ inputs.solution }}
|
|
|
|
- name: Build
|
|
run: dotnet build ${{ inputs.solution }} --no-restore --configuration Release
|
|
|
|
- name: Test
|
|
if: ${{ inputs.run-tests }}
|
|
run: dotnet test ${{ inputs.solution }} --no-build --configuration Release
|