From c4c7fba006728c71bad9737853216267e15a172e Mon Sep 17 00:00:00 2001 From: Simon Marty Date: Thu, 2 Apr 2026 13:12:26 -0700 Subject: [PATCH 1/3] Matrix dotnet build --- .github/workflows/dotnet.yml | 25 ++++++++++++------- ...nager.Extensions.Caching.IntegTests.csproj | 2 +- ...anager.Extensions.Caching.UnitTests.csproj | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f850451..fd56d4b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,20 +12,27 @@ permissions: jobs: build: - runs-on: windows-latest + name: build (${{ matrix.runner}}, .NET ${{ matrix.dotnet-version }}) + strategy: + fail-fast: false + matrix: + # Run on supported LTS versions + runner: [ubuntu-latest, windows-latest] + dotnet-version: [10, 8] + runs-on: ${{ matrix.runner }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: - dotnet-version: | - 8 + dotnet-version: ${{ matrix.dotnet-version }} - name: Install .NET Framework (add MSBuild to Path) - uses: microsoft/setup-msbuild@v2 + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v3 with: - msbuild-architecture: x64 + msbuild-architecture: ${{ runner.arch }} - name: Restore dependencies run: dotnet restore - name: Build @@ -33,9 +40,9 @@ jobs: - name: Test # Strong name requires disabling xUnit app domains in order to get coverage using coverlet # https://github.com/MarcoRossignoli/coverlet/blob/master/Documentation/KnownIssues.md#tests-fail-if-assembly-is-strong-named - run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" test/Amazon.SecretsManager.Extensions.Caching.UnitTests -- RunConfiguration.DisableAppDomain=true + run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" test/Amazon.SecretsManager.Extensions.Caching.UnitTests ${{ runner.os != 'Windows' && format('--framework net{0}.0', matrix.dotnet-version) || '' }} -- RunConfiguration.DisableAppDomain=true - name: Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v6 with: directory: test/Amazon.SecretsManager.Extensions.Caching.UnitTests/TestResults fail_ci_if_error: true diff --git a/test/Amazon.SecretsManager.Extensions.Caching.IntegTests/Amazon.SecretsManager.Extensions.Caching.IntegTests.csproj b/test/Amazon.SecretsManager.Extensions.Caching.IntegTests/Amazon.SecretsManager.Extensions.Caching.IntegTests.csproj index ab87dad..cab89a6 100644 --- a/test/Amazon.SecretsManager.Extensions.Caching.IntegTests/Amazon.SecretsManager.Extensions.Caching.IntegTests.csproj +++ b/test/Amazon.SecretsManager.Extensions.Caching.IntegTests/Amazon.SecretsManager.Extensions.Caching.IntegTests.csproj @@ -1,7 +1,7 @@ - net8.0;net48 + net8.0;net10.0;net48 false true true diff --git a/test/Amazon.SecretsManager.Extensions.Caching.UnitTests/Amazon.SecretsManager.Extensions.Caching.UnitTests.csproj b/test/Amazon.SecretsManager.Extensions.Caching.UnitTests/Amazon.SecretsManager.Extensions.Caching.UnitTests.csproj index 6caa13d..6bead69 100644 --- a/test/Amazon.SecretsManager.Extensions.Caching.UnitTests/Amazon.SecretsManager.Extensions.Caching.UnitTests.csproj +++ b/test/Amazon.SecretsManager.Extensions.Caching.UnitTests/Amazon.SecretsManager.Extensions.Caching.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0;net48 + net8.0;net10.0;net48 false true true From 6e445f7297d8c46f74205fdee4d8ca4bb5f12f17 Mon Sep 17 00:00:00 2001 From: Simon Marty Date: Thu, 2 Apr 2026 13:14:45 -0700 Subject: [PATCH 2/3] Add integ workflow --- .github/workflows/integ.yml | 45 +++++++++++++++++++++++++++++++++++ .github/workflows/pr-sync.yml | 31 ++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/integ.yml create mode 100644 .github/workflows/pr-sync.yml diff --git a/.github/workflows/integ.yml b/.github/workflows/integ.yml new file mode 100644 index 0000000..7fbe842 --- /dev/null +++ b/.github/workflows/integ.yml @@ -0,0 +1,45 @@ +name: Integration Tests + +on: + workflow_dispatch: + push: + branches: ["master"] + pull_request_target: + types: [labeled] + +permissions: + id-token: write + contents: read + +jobs: + integ: + if: | + github.event_name != 'pull_request_target' || + contains(github.event.pull_request.labels.*.name, 'safe-to-test') + runs-on: windows-latest + steps: + - name: Install .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ matrix.dotnet-version }} + - name: Install .NET Framework (add MSBuild to Path) + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v3 + with: + msbuild-architecture: ${{ runner.arch }} + - name: Checkout + uses: actions/checkout@v6 + with: + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: ${{ secrets.ROLE_ARN }} + role-session-name: dotnet-caching-${{ github.run_id }} + aws-region: us-west-2 + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal test/Amazon.SecretsManager.Extensions.Caching.IntegTests diff --git a/.github/workflows/pr-sync.yml b/.github/workflows/pr-sync.yml new file mode 100644 index 0000000..bca8647 --- /dev/null +++ b/.github/workflows/pr-sync.yml @@ -0,0 +1,31 @@ +name: Remove safe-to-test label when new commits are pushed + +on: + pull_request_target: + types: [synchronize] + +jobs: + remove-label: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + contents: read + if: | + contains(github.event.pull_request.labels.*.name, 'safe-to-test') + + steps: + - name: Remove label + run: | + echo "Removing label '$LABEL_NAME' from PR #$PR_NUMBER on repo $REPO" + gh_status=$(gh api "repos/$REPO/issues/$PR_NUMBER/labels/$LABEL_NAME" -X DELETE | jq 'if type == "object" then .status else empty end' --raw-output) + case $gh_status in + "") echo "Label removed" ;; + 404) echo "Label not found — ignoring" ;; + *) echo "unexpected HTTP $gh_status" && exit 1 ;; + esac + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LABEL_NAME: safe-to-test + REPO: ${{ github.event.pull_request.base.repo.full_name }} + PR_NUMBER: ${{ github.event.pull_request.number }} From 5dbd8bbd2181ae692b1518783387b5bb97973d67 Mon Sep 17 00:00:00 2001 From: Simon Marty Date: Thu, 9 Jul 2026 12:29:15 -0700 Subject: [PATCH 3/3] Address comments --- .github/workflows/dotnet.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index fd56d4b..e2089dc 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,13 +12,21 @@ permissions: jobs: build: - name: build (${{ matrix.runner}}, .NET ${{ matrix.dotnet-version }}) + name: build (${{ matrix.runner }}, ${{ matrix.framework }}) strategy: fail-fast: false matrix: - # Run on supported LTS versions - runner: [ubuntu-latest, windows-latest] - dotnet-version: [10, 8] + include: + - runner: ubuntu-latest + framework: net8.0 + - runner: ubuntu-latest + framework: net10.0 + - runner: windows-latest + framework: net8.0 + - runner: windows-latest + framework: net10.0 + - runner: windows-latest + framework: net48 runs-on: ${{ matrix.runner }} steps: @@ -27,12 +35,14 @@ jobs: - name: Install .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: | + 8 + 10 - name: Install .NET Framework (add MSBuild to Path) if: runner.os == 'Windows' uses: microsoft/setup-msbuild@v3 with: - msbuild-architecture: ${{ runner.arch }} + msbuild-architecture: x64 - name: Restore dependencies run: dotnet restore - name: Build @@ -40,7 +50,7 @@ jobs: - name: Test # Strong name requires disabling xUnit app domains in order to get coverage using coverlet # https://github.com/MarcoRossignoli/coverlet/blob/master/Documentation/KnownIssues.md#tests-fail-if-assembly-is-strong-named - run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" test/Amazon.SecretsManager.Extensions.Caching.UnitTests ${{ runner.os != 'Windows' && format('--framework net{0}.0', matrix.dotnet-version) || '' }} -- RunConfiguration.DisableAppDomain=true + run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" test/Amazon.SecretsManager.Extensions.Caching.UnitTests --framework ${{ matrix.framework }} -- RunConfiguration.DisableAppDomain=true - name: Codecov uses: codecov/codecov-action@v6 with: