From 247e974c94c1a9b8ad77132109e56a3e4817e0e2 Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 3 Nov 2026 10:30:46 +0000 Subject: [PATCH] Workflows: build only main and pull requests - CI runs on pushes to main and on pull requests; other branch pushes are no longer built - The no-game-data check moves into ci.yml as its own job; game-data.yml is removed - Package runs on version tags and by hand, no longer on main or pull requests - Tagged releases take their notes from that version's CHANGELOG.md section - Drop the Linux gating, fork-only conditions and path filters --- .github/workflows/ci.yml | 48 +++++++++++---------------------- .github/workflows/game-data.yml | 30 --------------------- .github/workflows/package.yml | 37 +++++++++---------------- 3 files changed, 28 insertions(+), 87 deletions(-) delete mode 100644 .github/workflows/game-data.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 185923c..d1ebc1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,39 +1,20 @@ name: CI -# Builds and tests every push that changes more than documents. Tags are left -# out: a tag's commit has already been built on its branch. The game-data check -# runs for every push, in game-data.yml. +# Builds and tests every push to main and every pull request, and checks that +# no game data is committed. on: push: - branches: ['**'] - paths-ignore: - - '**.md' - - 'docs/**' - - 'LICENSE' - - '.github/ISSUE_TEMPLATE/**' - - '.github/dependabot.yml' - - '.github/workflows/game-data.yml' - - '.github/workflows/package.yml' + branches: [main] pull_request: - paths-ignore: - - '**.md' - - 'docs/**' - - 'LICENSE' - - '.github/ISSUE_TEMPLATE/**' - - '.github/dependabot.yml' - - '.github/workflows/game-data.yml' - - '.github/workflows/package.yml' workflow_dispatch: permissions: contents: read -# A newer push to the same branch or pull request cancels the older run, except -# on main, where every commit gets its run: each has a group of its own, as -# GitHub keeps only one waiting run per group and cancels the others. +# A newer push to the same pull request cancels the older run. concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} # ccache (installed by ccache-action) keeps the compiled objects from the last # run of each job, so a push recompiles only what it changed. CMake takes the @@ -43,15 +24,18 @@ env: CMAKE_C_COMPILER_LAUNCHER: ccache CMAKE_CXX_COMPILER_LAUNCHER: ccache -# Every job runs for pushes and manual runs, and for pull requests only from -# forks: a branch of this repository has already run on its push. Windows and -# macOS runner minutes cost 2x and 10x Linux's, so those jobs start only once -# the Linux builds pass: a newer push cancels the run before they start, and a -# change that breaks the build doesn't spend them. jobs: + game-data: + name: No game data + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Check the tracked files + run: python3 tools/check_game_data.py + linux: name: Linux (${{ matrix.compiler }}) - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: @@ -99,7 +83,6 @@ jobs: macos: name: macOS (Apple Clang) - needs: linux runs-on: macos-15 timeout-minutes: 20 steps: @@ -120,7 +103,6 @@ jobs: windows: name: Windows (clang-cl) - needs: linux runs-on: windows-latest timeout-minutes: 30 steps: diff --git a/.github/workflows/game-data.yml b/.github/workflows/game-data.yml deleted file mode 100644 index c7dedaa..0000000 --- a/.github/workflows/game-data.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: No game data - -# Every push and pull request, whatever it changes (documents too), unlike the -# builds in ci.yml. -on: - push: - branches: ['**'] - pull_request: - -permissions: - contents: read - -# As in ci.yml: a newer push cancels the older run, except on main, where each -# commit has a group of its own, so none is cancelled while it waits. -concurrency: - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - game-data: - name: No game data - # Pull requests only from forks: a branch of this repository has already - # been checked on its push. - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - runs-on: ubuntu-24.04 - timeout-minutes: 5 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Check the tracked files - run: python3 tools/check_game_data.py diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index e72daae..2245aa9 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -5,30 +5,12 @@ name: Package # from their own disc image, and the launcher players open, OpenGP, which # builds the games with the installer's code. No game code or data is in them. # -# It runs for every version tag and by hand (Actions > Package > Run workflow, -# or `gh workflow run package.yml --ref `), and on main and pull -# requests only when the build itself changes; CI builds and tests every other -# change. Run it by hand on the release commit before tagging. +# Pushing a version tag (v1.2.3) builds the packages and attaches them to a +# draft release, with that version's CHANGELOG.md section as its notes. A run +# by hand (Actions > Package > Run workflow) only builds and tests them. on: push: - branches: [main] tags: ['v*'] - # Not checked for tags: every tag runs. - paths: - - '**/CMakeLists.txt' - - '**/*.cmake' - - 'CMakePresets.json' - - 'tools/installer/**' - - 'tools/package_probe.py' - - '.github/workflows/package.yml' - pull_request: - paths: - - '**/CMakeLists.txt' - - '**/*.cmake' - - 'CMakePresets.json' - - 'tools/installer/**' - - 'tools/package_probe.py' - - '.github/workflows/package.yml' workflow_dispatch: inputs: launcher_ref: @@ -47,10 +29,8 @@ env: permissions: contents: read -# A newer push to the same pull request cancels the older run. concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: windows: @@ -392,8 +372,13 @@ jobs: permissions: contents: write steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + sparse-checkout: CHANGELOG.md + sparse-checkout-cone-mode: false - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: + path: packages merge-multiple: true - name: Upload the packages env: @@ -408,7 +393,11 @@ jobs: exit 1 fi else - gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --draft --title "OpenGP ${TAG#v}" --notes "See CHANGELOG.md." + # The notes: the lines under "## " (or "## (date)"). + awk -v v="${TAG#v}" '/^## / { f = ($2 == v); next } f' CHANGELOG.md > notes.md + [ -s notes.md ] || echo "See CHANGELOG.md." > notes.md + gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --draft --title "OpenGP ${TAG#v}" --notes-file notes.md fi + cd packages sha256sum OpenGP-* > SHA256SUMS gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber OpenGP-* SHA256SUMS