diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f850451..e2089dc 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,18 +12,35 @@ permissions: jobs: build: - runs-on: windows-latest + name: build (${{ matrix.runner }}, ${{ matrix.framework }}) + strategy: + fail-fast: false + matrix: + 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: - - 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 + 10 - 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 - name: Restore dependencies @@ -33,9 +50,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 --framework ${{ matrix.framework }} -- 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/.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 }} 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