From 95ff0941b57e4c1ab2de2afeac06ce03bfa7b5be Mon Sep 17 00:00:00 2001 From: James Couball Date: Wed, 16 Apr 2025 17:19:43 -0700 Subject: [PATCH 1/2] fix: do not trigger build workflows after merging to main or for release PRs Since all merges to the main branch must be a fast-forward rebase, CI builds should not be run when merged to main. They are run via the pull request before merging. The continuous_integration workflow should be triggered for pull requests targeting main. The experimental_ruby_builds workflow should only be triggered manually via the GitHub UI --- .github/workflows/continuous_integration.yml | 7 ++++--- .github/workflows/enforce_conventional_commits.yml | 4 ++++ .github/workflows/experimental_ruby_builds.yml | 3 --- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 4c7e7f9..ce706d0 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -1,9 +1,6 @@ name: Continuous Integration on: - push: - branches: [main] - pull_request: branches: [main] @@ -26,6 +23,10 @@ jobs: build: name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }} + if: >- + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--')) + runs-on: ${{ matrix.operating-system }} continue-on-error: true diff --git a/.github/workflows/enforce_conventional_commits.yml b/.github/workflows/enforce_conventional_commits.yml index a3e1a5d..8e85bdb 100644 --- a/.github/workflows/enforce_conventional_commits.yml +++ b/.github/workflows/enforce_conventional_commits.yml @@ -9,6 +9,10 @@ jobs: commit-lint: name: Verify Conventional Commits + if: >- + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--')) + runs-on: ubuntu-latest steps: diff --git a/.github/workflows/experimental_ruby_builds.yml b/.github/workflows/experimental_ruby_builds.yml index 233c9ff..573664e 100644 --- a/.github/workflows/experimental_ruby_builds.yml +++ b/.github/workflows/experimental_ruby_builds.yml @@ -1,9 +1,6 @@ name: Experimental Ruby Builds on: - push: - branches: [main] - workflow_dispatch: env: From c833ae35f07573f11ec4ecbf548b968d17f1460f Mon Sep 17 00:00:00 2001 From: James Couball Date: Wed, 16 Apr 2025 17:22:32 -0700 Subject: [PATCH 2/2] fix: move unneeded builds from continuous_integration to experimental_ruby_builds There is not a good reason to have a specific builds in the continuous_integration workflow on Windows, or using JRuby or TruffleRuby. --- .github/workflows/continuous_integration.yml | 12 +----------- .github/workflows/experimental_ruby_builds.yml | 11 ++++++++++- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index ce706d0..fd6c0ee 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -36,19 +36,9 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.1", "3.2", "3.3", "3.4"] + ruby: ["3.1", "3.4"] operating-system: [ubuntu-latest] fail_on_low_coverage: [true] - include: - - ruby: "3.1" - operating-system: windows-latest - fail_on_low_coverage: false - - ruby: "jruby-9.4" - operating-system: ubuntu-latest - fail_on_low_coverage: false - - ruby: "truffleruby-24" - operating-system: ubuntu-latest - fail_on_low_coverage: false steps: - name: Checkout diff --git a/.github/workflows/experimental_ruby_builds.yml b/.github/workflows/experimental_ruby_builds.yml index 573664e..ddb9a8b 100644 --- a/.github/workflows/experimental_ruby_builds.yml +++ b/.github/workflows/experimental_ruby_builds.yml @@ -31,19 +31,28 @@ jobs: matrix: fail_on_low_coverage: [true] include: + - ruby: "3.1" + operating-system: windows-latest + fail_on_low_coverage: false - ruby: head operating-system: ubuntu-latest - ruby: head operating-system: windows-latest + - ruby: "truffleruby-24" + operating-system: ubuntu-latest + fail_on_low_coverage: false - ruby: truffleruby-head operating-system: ubuntu-latest fail_on_low_coverage: false - - ruby: jruby-head + - ruby: "jruby-9.4" operating-system: ubuntu-latest fail_on_low_coverage: false - ruby: "jruby-9.4" operating-system: windows-latest fail_on_low_coverage: false + - ruby: jruby-head + operating-system: ubuntu-latest + fail_on_low_coverage: false - ruby: jruby-head operating-system: windows-latest fail_on_low_coverage: false