From db29b1006bac360035b7880aa2575374d92de0e1 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 20 Feb 2025 14:39:13 +0100 Subject: [PATCH 1/3] Use dynamic evaluation instead of static path filter --- .github/workflows/parametric-tests.yml | 41 +++++++++++++++------- .github/workflows/system-tests.yml | 48 ++++++++++++++++++-------- 2 files changed, 61 insertions(+), 28 deletions(-) diff --git a/.github/workflows/parametric-tests.yml b/.github/workflows/parametric-tests.yml index 83092af0387..462adf2aabe 100644 --- a/.github/workflows/parametric-tests.yml +++ b/.github/workflows/parametric-tests.yml @@ -4,25 +4,38 @@ on: push: branches: - "**" - paths-ignore: - - ".circleci/**" - - ".gitlab/**" - - "appraisal/**" - - "benchmarks/**" - - "docs/**" - - "gemfiles/**" - - "integration/**" - - "sig/**" - - "spec/**" - - "suppressions/**" - - "tools/**" - - "vendor/**" workflow_dispatch: {} schedule: - cron: "00 04 * * 2-6" jobs: + changes: + name: Changes + runs-on: ubuntu-24.04 + outputs: + changes: ${{ steps.changes.outputs.src }} + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Changes + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + with: + filters: | + src: + - '.github/workflows/**' + - 'lib/**' + - 'ext/**' + - '*.gemspec' + - 'Gemfile' + - '*.gemfile' + - 'lib-injection/**' + - 'tasks/**' + build-artifacts: + needs: + - changes + if: ${{ needs.changes.outputs.changes == 'true' }} runs-on: ubuntu-22.04 permissions: packages: write @@ -40,6 +53,8 @@ jobs: parametric: needs: - build-artifacts + - changes + if: ${{ needs.changes.outputs.changes == 'true' }} uses: DataDog/system-tests/.github/workflows/run-parametric.yml@main secrets: inherit with: diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index 6dcb826010a..6f1806b1dd6 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -4,19 +4,6 @@ on: push: branches: - "**" - paths-ignore: - - ".circleci/**" - - ".gitlab/**" - - "appraisal/**" - - "benchmarks/**" - - "docs/**" - - "gemfiles/**" - - "integration/**" - - "sig/**" - - "spec/**" - - "suppressions/**" - - "tools/**" - - "vendor/**" workflow_dispatch: {} schedule: - cron: "00 04 * * 2-6" @@ -27,7 +14,33 @@ env: SYSTEM_TESTS_REF: main # This must always be set to `main` on dd-trace-rb's master branch jobs: + changes: + name: Changes + runs-on: ubuntu-24.04 + outputs: + changes: ${{ steps.changes.outputs.src }} + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Changes + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + with: + filters: | + src: + - '.github/workflows/**' + - 'lib/**' + - 'ext/**' + - '*.gemspec' + - 'Gemfile' + - '*.gemfile' + - 'lib-injection/**' + - 'tasks/**' + build-harness: + needs: + - changes + if: ${{ needs.changes.outputs.changes == 'true' }} strategy: fail-fast: false matrix: @@ -92,6 +105,9 @@ jobs: docker push ${{ env.REPO }}/system-tests/${{ matrix.image.name }}:latest build-apps: + needs: + - changes + if: ${{ needs.changes.outputs.changes == 'true' }} strategy: fail-fast: false matrix: @@ -391,7 +407,8 @@ jobs: - build-harness - build-apps - test - if: ${{ always() }} + - changes + if: ${{ needs.changes.outputs.changes == 'true' && always() }} name: Aggregate (${{ matrix.app }}) steps: - name: Setup python 3.12 @@ -445,7 +462,8 @@ jobs: runs-on: ubuntu-22.04 needs: - test - if: ${{ always() }} + - changes + if: ${{ needs.changes.outputs.changes == 'true' && always() }} name: Cleanup (${{ matrix.image }}) steps: - name: Log in to the Container registry From c799310b3e93d382591714f0fd9c34784ffa4d16 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 20 Feb 2025 17:35:26 +0100 Subject: [PATCH 2/3] Save some CI time for non-PR branches --- .github/workflows/parametric-tests.yml | 5 ++++- .github/workflows/system-tests.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/parametric-tests.yml b/.github/workflows/parametric-tests.yml index 462adf2aabe..499bf05cb5a 100644 --- a/.github/workflows/parametric-tests.yml +++ b/.github/workflows/parametric-tests.yml @@ -3,7 +3,10 @@ name: Parametric Tests on: push: branches: - - "**" + - master + pull_request: + branches: + - master workflow_dispatch: {} schedule: - cron: "00 04 * * 2-6" diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index 6f1806b1dd6..cde89db27e4 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -3,7 +3,10 @@ name: System Tests on: push: branches: - - "**" + - master + pull_request: + branches: + - master workflow_dispatch: {} schedule: - cron: "00 04 * * 2-6" From 4fbdaa8f68531e2323ff5d136e3a28d0ad50e26f Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 20 Feb 2025 17:36:01 +0100 Subject: [PATCH 3/3] Fix aggregate running when jobs are canceled --- .github/workflows/system-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index cde89db27e4..dc1bc4ee4f9 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -411,7 +411,7 @@ jobs: - build-apps - test - changes - if: ${{ needs.changes.outputs.changes == 'true' && always() }} + if: ${{ needs.changes.outputs.changes == 'true' && !cancelled() }} name: Aggregate (${{ matrix.app }}) steps: - name: Setup python 3.12