From 636e57b217e579d3cef056d44e0794d815a922be Mon Sep 17 00:00:00 2001 From: Chris Tristan <1764856+CTristan@users.noreply.github.com> Date: Mon, 13 Apr 2026 20:31:38 -0700 Subject: [PATCH 1/3] Update dotnet-ci reusable workflow to use dotnet ci tool Replaced manual restore/build/test steps with `dotnet tool restore` + `dotnet ci --check`, which runs CSharpier formatting checks, tests with Coverlet coverage, and coverage threshold verification. Removed inputs that are now handled by the CI tool: solution-file, collect-coverage, coverage-files, upload-codecov, upload-codacy. Added PACKAGES_TOKEN secret for cross-org GitHub Packages authentication, falling back to github.token for same-org repos. Removed nested ci-windows job since repos can call dotnet-ci-windows.yml directly when needed. --- .github/workflows/dotnet-ci.yml | 71 +++------------------------------ 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/.github/workflows/dotnet-ci.yml b/.github/workflows/dotnet-ci.yml index 955efc8..2e25fc9 100644 --- a/.github/workflows/dotnet-ci.yml +++ b/.github/workflows/dotnet-ci.yml @@ -3,10 +3,6 @@ name: .NET CI on: workflow_call: inputs: - solution-file: - description: 'Solution file name (e.g., MyProject.slnx)' - required: true - type: string dotnet-version: description: '.NET SDK version' required: false @@ -17,26 +13,6 @@ on: required: false type: string default: '' - collect-coverage: - description: 'Run tests with coverlet coverage collection' - required: false - type: boolean - default: false - coverage-files: - description: 'Newline-separated list of coverage XML paths to upload' - required: false - type: string - default: '' - upload-codecov: - description: 'Upload coverage to Codecov' - required: false - type: boolean - default: false - upload-codacy: - description: 'Upload coverage to Codacy' - required: false - type: boolean - default: false local-pack-projects: description: 'Newline-separated .csproj paths to pack into ./nupkg before restore' required: false @@ -45,9 +21,7 @@ on: secrets: PRIVATE_REFERENCES_TOKEN: required: false - CODECOV_TOKEN: - required: false - CODACY_PROJECT_TOKEN: + PACKAGES_TOKEN: required: false jobs: @@ -85,43 +59,10 @@ jobs: done - name: Authenticate GitHub Packages - run: dotnet nuget update source github --username open-lobotomy --password ${{ github.token }} --store-password-in-clear-text || true + run: dotnet nuget update source github --username open-lobotomy --password ${{ secrets.PACKAGES_TOKEN || github.token }} --store-password-in-clear-text || true - - name: Restore dependencies - run: dotnet restore --ignore-failed-sources ${{ inputs.solution-file }} + - name: Restore tools + run: dotnet tool restore - - name: Build - run: dotnet build --no-restore ${{ inputs.solution-file }} - - - name: Test - run: >- - dotnet test - ${{ inputs.collect-coverage && '/p:CollectCoverage=true /p:CoverletOutput="./coverage.opencover.xml" /p:CoverletOutputFormat=opencover' || '' }} - --no-build --verbosity normal --blame-hang-timeout 10s - ${{ inputs.solution-file }} - - - name: Upload coverage reports to Codecov - if: ${{ inputs.upload-codecov && inputs.coverage-files != '' }} - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ${{ inputs.coverage-files }} - - - name: Upload coverage reports to Codacy - if: ${{ inputs.upload-codacy && inputs.coverage-files != '' }} - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ${{ inputs.coverage-files }} - - ci-windows: - name: CI (Windows) - needs: [ci] - uses: open-lobotomy/.github/.github/workflows/dotnet-ci-windows.yml@main - with: - solution-file: ${{ inputs.solution-file }} - dotnet-version: ${{ inputs.dotnet-version }} - private-references-repo: ${{ inputs.private-references-repo }} - local-pack-projects: ${{ inputs.local-pack-projects }} - secrets: - PRIVATE_REFERENCES_TOKEN: ${{ secrets.PRIVATE_REFERENCES_TOKEN }} + - name: Run CI + run: dotnet ci --check From 1c7d1988104e09c41445586e569320e7e679e2a0 Mon Sep 17 00:00:00 2001 From: Chris Tristan <1764856+CTristan@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:24:00 -0700 Subject: [PATCH 2/3] Guard dotnet tool restore on missing tool manifest Emit a clear migration error when consumer repos lack .config/dotnet-tools.json so the failure points at the fix instead of an opaque restore error. --- .github/workflows/dotnet-ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-ci.yml b/.github/workflows/dotnet-ci.yml index 2e25fc9..184495b 100644 --- a/.github/workflows/dotnet-ci.yml +++ b/.github/workflows/dotnet-ci.yml @@ -62,7 +62,13 @@ jobs: run: dotnet nuget update source github --username open-lobotomy --password ${{ secrets.PACKAGES_TOKEN || github.token }} --store-password-in-clear-text || true - name: Restore tools - run: dotnet tool restore + run: | + if [ ! -f .config/dotnet-tools.json ]; then + echo "::error file=.config/dotnet-tools.json::This reusable workflow requires a local .NET tool manifest in the consuming repository. Add .config/dotnet-tools.json with the dotnet-ci tool (for example: 'dotnet new tool-manifest' then 'dotnet tool install dotnet-ci') or update the repository to the current org CI bootstrap." + exit 1 + fi + + dotnet tool restore - name: Run CI run: dotnet ci --check From d358daa40a9258c6e988cfbe38697d642b04c357 Mon Sep 17 00:00:00 2001 From: Chris Tristan <1764856+CTristan@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:29:29 -0700 Subject: [PATCH 3/3] Validate dotnet-ci tool is present after restore Surfaces an actionable error when the local tool manifest exists but does not include the required dotnet-ci tool, instead of letting the downstream dotnet ci invocation fail with a less clear message. --- .github/workflows/dotnet-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/dotnet-ci.yml b/.github/workflows/dotnet-ci.yml index 184495b..9dc25c4 100644 --- a/.github/workflows/dotnet-ci.yml +++ b/.github/workflows/dotnet-ci.yml @@ -70,5 +70,10 @@ jobs: dotnet tool restore + if ! dotnet tool list --local | awk 'NR > 2 { print $1 }' | grep -Fxq 'dotnet-ci'; then + echo "::error file=.config/dotnet-tools.json::The local .NET tool manifest does not include the required 'dotnet-ci' tool. Install it with 'dotnet tool install dotnet-ci' and commit the updated .config/dotnet-tools.json." + exit 1 + fi + - name: Run CI run: dotnet ci --check