From 0a2195bb35b82dedccd37cde73cdb509a1116a7d Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Tue, 28 Apr 2026 20:29:53 -0500 Subject: [PATCH] status check workflow added --- .github/workflows/ci.yml | 122 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..66cb1d2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,122 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + DOTNET_CLI_TELEMETRY_OPTOUT: "1" + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1" + DOTNET_NOLOGO: "1" + +jobs: + build: + name: Build (Rust + C# UI) + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: "1" + + - name: Cache cargo registry and target + uses: Swatinem/rust-cache@v2 + + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 10.x + + - name: Restore C# UI projects + run: dotnet restore ui\Covenant.Setup.Ui\Covenant.Setup.Ui.csproj + + - name: Cargo build (release) + run: cargo build --release --locked + + rust-tests: + name: Rust unit tests + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: "1" + + - name: Cache cargo registry and target + uses: Swatinem/rust-cache@v2 + + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 10.x + + - name: Cargo test (including ignored / risky tests) + run: cargo test --locked -- --include-ignored + + ui-tests: + name: C# UI unit tests + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 10.x + + - name: Restore UI test project + run: dotnet restore ui\Covenant.Setup.Ui.Tests\Covenant.Setup.Ui.Tests.csproj + + - name: Run UI tests + run: dotnet test ui\Covenant.Setup.Ui.Tests\Covenant.Setup.Ui.Tests.csproj --configuration Release --no-restore --logger "trx;LogFileName=ui-tests.trx" + + - name: Upload UI test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: ui-test-results + path: ui\Covenant.Setup.Ui.Tests\TestResults\*.trx + if-no-files-found: ignore + + quality-gate: + name: Quality gate + runs-on: windows-latest + needs: [build, rust-tests, ui-tests] + if: always() + steps: + - name: Verify all required jobs succeeded + shell: pwsh + run: | + $results = @{ + build = '${{ needs.build.result }}' + rust_tests = '${{ needs.rust-tests.result }}' + ui_tests = '${{ needs.ui-tests.result }}' + } + $failed = $false + foreach ($entry in $results.GetEnumerator()) { + Write-Host ("{0,-12} : {1}" -f $entry.Key, $entry.Value) + if ($entry.Value -ne 'success') { $failed = $true } + } + if ($failed) { + Write-Error 'One or more required jobs did not succeed.' + exit 1 + } + Write-Host 'All required jobs succeeded.'