From f8415c0af77664f05f724af9a4df28ef359885e5 Mon Sep 17 00:00:00 2001 From: Eli Polonsky Date: Thu, 14 Nov 2024 10:28:51 +0200 Subject: [PATCH] chore: disable codecov from `v2-release` branch (#32125) In https://github.com/aws/aws-cdk/pull/32082, we added codecov checks to mergify merge conditions. This, as originally intended, blocked merging to both the `main` and the `v2-release` branches. However, we decided that currently we won't be applying codecov on the `v2-release` branch because it is redundant. Ideally, to achieve this, we would remove the conditions only from the mergify configuration that applies to the `v2-release` branch. But our configuration isn't set up that way right now, it doesn't distinguish between branches. Luckily, mergify will [automatically honor branch protection rules](https://github.com/Mergifyio/mergify/discussions/2184#discussioncomment-452783), so we can safely remove the branch dependant conditions from mergify all together, and keep them only in branch protection rules (which we already configured). Once this PR is merged, I will also remove the codecov branch protection from `v2-release` (but keep it on `main`). ## Additional Changes There's some additional codecov related cleanup we need to do so might as well. They are explained as review comments. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .github/workflows/codecov.yml | 8 ++++--- .mergify.yml | 24 ------------------- packages/aws-cdk/jest.config.js | 3 ++- packages/aws-cdk/lib/api/logs/logs-monitor.ts | 6 ++--- 4 files changed, 10 insertions(+), 31 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index c313f13efc77d..ec63ae9bdb394 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -11,6 +11,8 @@ jobs: name: collect if: github.repository == 'aws/aws-cdk' runs-on: ubuntu-latest + permissions: + id-token: write steps: - name: Checkout uses: actions/checkout@v4 @@ -19,10 +21,10 @@ jobs: uses: actions/setup-node@v4 - name: Install dependencies - run: cd packages/aws-cdk && yarn install + run: yarn install - name: Build CLI - run: cd packages/aws-cdk && npx lerna run build --scope=aws-cdk + run: npx lerna run build --scope=aws-cdk - name: Run tests run: cd packages/aws-cdk && yarn test @@ -33,4 +35,4 @@ jobs: directory: packages/aws-cdk/coverage fail_ci_if_error: true flags: suite.unit - token: ${{ secrets.CODECOV_TOKEN }} + use_oidc: true diff --git a/.mergify.yml b/.mergify.yml index 98299ebd0e518..b9ffeae147913 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -15,10 +15,6 @@ queue_rules: - "#changes-requested-reviews-by=0" - status-success~=AWS CodeBuild us-east-1 - status-success=validate-pr - - status-success=codecov/patch - - status-success=codecov/patch/packages/aws-cdk - - status-success=codecov/project - - status-success=codecov/project/packages/aws-cdk commit_message_template: |- {{ title }} (#{{ number }}) {{ body }} @@ -37,10 +33,6 @@ queue_rules: - "#changes-requested-reviews-by=0" - status-success~=AWS CodeBuild us-east-1 - status-success=validate-pr - - status-success=codecov/patch - - status-success=codecov/patch/packages/aws-cdk - - status-success=codecov/project - - status-success=codecov/project/packages/aws-cdk commit_message_template: |- {{ title }} (#{{ number }}) {{ body }} @@ -72,10 +64,6 @@ pull_request_rules: - "#changes-requested-reviews-by=0" - status-success~=AWS CodeBuild us-east-1 - status-success=validate-pr - - status-success=codecov/patch - - status-success=codecov/patch/packages/aws-cdk - - status-success=codecov/project - - status-success=codecov/project/packages/aws-cdk - name: automatic merge (2+ approvers) actions: comment: @@ -96,10 +84,6 @@ pull_request_rules: - "#changes-requested-reviews-by=0" - status-success~=AWS CodeBuild us-east-1 - status-success=validate-pr - - status-success=codecov/patch - - status-success=codecov/patch/packages/aws-cdk - - status-success=codecov/project - - status-success=codecov/project/packages/aws-cdk - name: automatic merge (no-squash) actions: comment: @@ -120,10 +104,6 @@ pull_request_rules: - "#changes-requested-reviews-by=0" - status-success~=AWS CodeBuild us-east-1 - status-success=validate-pr - - status-success=codecov/patch - - status-success=codecov/patch/packages/aws-cdk - - status-success=codecov/project - - status-success=codecov/project/packages/aws-cdk - name: remove stale reviews actions: dismiss_reviews: @@ -163,7 +143,3 @@ pull_request_rules: - "#changes-requested-reviews-by=0" - status-success~=AWS CodeBuild us-east-1 - status-success=validate-pr - - status-success=codecov/patch - - status-success=codecov/patch/packages/aws-cdk - - status-success=codecov/project - - status-success=codecov/project/packages/aws-cdk diff --git a/packages/aws-cdk/jest.config.js b/packages/aws-cdk/jest.config.js index 6519819936478..a6aa99d846bfa 100644 --- a/packages/aws-cdk/jest.config.js +++ b/packages/aws-cdk/jest.config.js @@ -12,7 +12,8 @@ module.exports = { lines: 81 }, }, - "coveragePathIgnorePatterns": [ + coveragePathIgnorePatterns: [ + ...baseConfig.coveragePathIgnorePatterns, // Mostly wrappers around the SDK, which get mocked in unit tests "/lib/api/aws-auth/sdk.ts", ], diff --git a/packages/aws-cdk/lib/api/logs/logs-monitor.ts b/packages/aws-cdk/lib/api/logs/logs-monitor.ts index c2757514a1463..5594d3f4cb8ff 100644 --- a/packages/aws-cdk/lib/api/logs/logs-monitor.ts +++ b/packages/aws-cdk/lib/api/logs/logs-monitor.ts @@ -124,10 +124,10 @@ export class CloudWatchLogEventMonitor { } private async tick(): Promise { + // excluding from codecoverage because this + // doesn't always run (depends on timing) + /* istanbul ignore next */ if (!this.active) { - // excluding from codecoverage because this - // doesn't always run (depends on timing) - /* istanbul ignore next */ return; } try {