From c7f4bc538401d83bbae6ee67c514c5a7cb3babac Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 10 Aug 2024 17:09:01 -0400 Subject: [PATCH 1/3] Run CI tests for push event on more branches When a branch is named with a non-trailing (i.e. directory-like) `run-ci` component, such as `run-ci/foo` or `bar/run-ci/baz`, pushing to the branch will run the CI test workflow under the same conditions that a push to `main` would run it. This is primarily to allow CI to work in forks even when there is no pull request, while still avoiding running it when it is not wanted. Note that forks still need to enable GitHub Actions workflows for this, or any workflows, to run in them. --- .github/workflows/ci.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c719b481ae..c6916fd5696 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,12 @@ env: on: push: - branches: [ main ] - tags-ignore: [ '*' ] + branches: + - main + - 'run-ci/**' + - '**/run-ci/**' + tags-ignore: + - '*' paths: - '.github/**' - 'ci/**' @@ -19,7 +23,8 @@ on: - '*.toml' - Makefile pull_request: - branches: [ main ] + branches: + - main paths: - '.github/**' - 'ci/**' From 323308ce1be8f634be5cb1113ae356a78b60d448 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 10 Aug 2024 17:21:49 -0400 Subject: [PATCH 2/3] Add more push and workflow_dispatch triggers - Trigger `msrv.yml` on the push event, for the same branches for which `ci.yml` is triggered on it. That is, make the corresponding change to the MSRV workflow that was made to the test workflow. - Remove outdated comments on `msrv.yml`. These comments already disagreed with the code, since they named `master` when the branch was `main`, and suggested that all pull requests would trigger the workflow when really was (and continues to be) also limited by branch. - Add `workflow_dispatch` to the `ci.yml` and `msrv.tml` workflows, so they can be manually run even for branches that are not named, and in the case of `ci.yml`, so it can be manually run even when changes are not made to any of the paths that are also needed to trigger it on the push or pull_request events. - Put `workflow_dispatch` last in the `release.yml` workflow that already had it. Currently it is a secondary way to trigger all workflows that include it. It was in practice the primary way to trigger `release.yml` when the push trigger was broken, but that is no longer the case since 286e388 (#1475). Even in testing, it is now most often run by pushing a tag. This brings its style in line with the style in `cron.yml`, where `workflow_dispatch` was already a secondary way to trigger the workflow and listed second. --- .github/workflows/ci.yml | 1 + .github/workflows/msrv.yml | 14 +++++++++----- .github/workflows/release.yml | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6916fd5696..53953aa2668 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ on: - 'gix*/**' - '*.toml' - Makefile + workflow_dispatch: jobs: pure-rust-build: diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml index acffb80c320..5ed7ba30fc9 100644 --- a/.github/workflows/msrv.yml +++ b/.github/workflows/msrv.yml @@ -1,13 +1,17 @@ name: Minimum Supported Rust Version on: - # Trigger the workflow on push to master or any pull request - # Ignore all tags push: - branches: [ main ] - tags-ignore: [ '*' ] + branches: + - main + - 'run-ci/**' + - '**/run-ci/**' + tags-ignore: + - '*' pull_request: - branches: [ main ] + branches: + - main + workflow_dispatch: jobs: rustfmt: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 061cf6359a9..193bd10dbcc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,13 +4,13 @@ name: release on: - workflow_dispatch: push: # Enable when testing release infrastructure on a branch. # branches: # - fix-releases tags: - 'v*' + workflow_dispatch: defaults: run: From de555b2dfb059f771434d8ce2560c2bcc256034d Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 10 Aug 2024 17:39:56 -0400 Subject: [PATCH 3/3] Allow the CI fuzz workflow to be manually triggered too This adds workflow_dispatch as an event trigger for `cifuzz.yml`. Since that should be sufficient to cover the rare case where one wishes to run it outside of a pull request against the `main` branch, this narrows the existing pull_request trigger to occur only on `main`, as is already the case in the other workflows that are intended to run more often than this one. --- .github/workflows/cifuzz.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 350029cec1f..8d47de8f003 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -1,5 +1,8 @@ name: CIFuzz -on: [pull_request] +on: + pull_request: + branches: [ main ] + workflow_dispatch: jobs: Fuzzing: runs-on: ubuntu-latest