Skip to content

Kieron/release

Kieron/release #59

Workflow file for this run

name: CI
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
jobs:
format-check:
name: Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: ./global.json
- name: CSharpier format check
run: |
dotnet tool install --global csharpier --version 1.2.6
csharpier check src
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
env:
CONFIGURATION: Release
SOLUTION: ./src/AspireC4.slnx
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: ./global.json
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: npm
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION }}
- name: Build
run: dotnet build ${{ env.SOLUTION }} --no-restore --configuration ${{ env.CONFIGURATION }}
- name: Run unit tests
run: dotnet test --project src/tests/AspireC4.UnitTests --no-build --verbosity normal --configuration ${{ env.CONFIGURATION }}
ci-gate:
name: CI Gate
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- format-check
- build-and-test
steps:
- name: Verify upstream jobs succeeded
env:
FORMAT_CHECK_RESULT: ${{ needs['format-check'].result }}
BUILD_AND_TEST_RESULT: ${{ needs['build-and-test'].result }}
shell: bash
run: |
set -euo pipefail
declare -A results=(
["Format Check"]="${FORMAT_CHECK_RESULT}"
["Build and Test"]="${BUILD_AND_TEST_RESULT}"
)
failures=0
for job_name in "${!results[@]}"; do
result="${results[$job_name]}"
if [[ "${result}" != "success" ]]; then
echo "::error::${job_name} finished with result '${result}'."
failures=1
fi
done
if [[ "${failures}" -ne 0 ]]; then
exit 1
fi