diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac1a783f8..441ff256d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,8 @@ name: Build on: + push: + branches: [main] pull_request: branches: [main] types: [opened, synchronize, reopened] @@ -15,7 +17,7 @@ permissions: contents: read concurrency: - group: build-${{ github.event_name }}-pr-${{ github.event.pull_request.number || inputs.pr }} + group: build-${{ github.event_name }}-${{ github.event.pull_request.number || inputs.pr || github.ref }} cancel-in-progress: true env: @@ -43,6 +45,16 @@ jobs: PR_NUMBER: ${{ inputs.pr }} with: script: | + if (context.eventName === 'push') { + if (context.ref !== 'refs/heads/main') { + throw new Error('Automatic full builds only run on main'); + } + core.setOutput('sha', context.sha); + core.setOutput('relinker', true); + core.setOutput('full', true); + await core.summary.addRaw(`Building main at ${context.sha}: all builds and tests enabled`).write(); + return; + } const { owner, repo } = context.repo; const manual = context.eventName === 'workflow_dispatch'; if (manual) { @@ -126,7 +138,7 @@ jobs: linux: needs: eligibility - if: ${{ github.event_name == 'workflow_dispatch' && needs.eligibility.outputs.full == 'true' }} + if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.eligibility.outputs.full == 'true' }} runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -161,7 +173,7 @@ jobs: windows: needs: eligibility - if: ${{ github.event_name == 'workflow_dispatch' && needs.eligibility.outputs.full == 'true' }} + if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.eligibility.outputs.full == 'true' }} runs-on: windows-latest timeout-minutes: 45 env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 244c43ee7..4761bada3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,9 @@ ctest --test-dir build --output-on-failure Python 3 is optional; without it some relinker tests are not registered. -Full Linux and Windows builds and tests run only when a collaborator with write access selects Actions > Build > Run workflow on `main` and enters an open pull request number targeting `main`. This manual run also builds and tests the relinker on Linux, Windows and macOS, regardless of the author's previous contributions or the changed files. The relinker matrix also runs automatically when a pull request targeting `main` is opened, updated or reopened, if its author already has a commit in `main`; full builds never run automatically. All build jobs use the selected pull request head commit. New commits require another manual run for full builds. +Every push to `main`, including a merged pull request, automatically runs full Linux and Windows builds and tests and the relinker matrix on Linux, Windows and macOS, using the pushed commit without contributor checks. + +For pull requests, full Linux and Windows builds and tests run only when a collaborator with write access selects Actions > Build > Run workflow on `main` and enters an open pull request number targeting `main`. This manual run also builds and tests the relinker on Linux, Windows and macOS, regardless of the author's previous contributions or the changed files. The relinker matrix also runs automatically when a pull request targeting `main` is opened, updated or reopened, if its author already has a commit in `main`; full builds never run automatically for pull requests. All build jobs use the selected pull request head commit. New commits require another manual run for full builds. The Conventions check runs automatically for every contributor, including first-time contributors. It uses the base branch checker and reads pull request Git objects without executing pull request code. The Conventions check runs on every pull request and fails when a rule on this page is broken. It accepts code comments only when the pull request also changes [TechnicalDebt](docs/dev/TechnicalDebt.md), and only UTF-8 text files. Run it locally before pushing: