# The builds a pull request gets only when asked for. build_all.yml leaves them # out of pull requests and builds them on every push to main: the Flatpak is # the slowest Linux leg, a macOS x86_64 build holds one of the few hosted macOS # runners for an hour, and Windows arm64 doubles the Windows legs. # # A label asks for one, from the moment it is added and on every later push to # the pull request: build-flatpak, build-macos-x86_64, build-windows-arm64, # build-windows-msvc. build-all asks for the first three, the builds every pull # request once got; the MSVC build is another compiler's, never a build a pull # request got, and the first one builds the deps too, so it stays label-only. # Removing and adding a label again rebuilds the same commit. # # A pull request that changes anything but sources, tests, profiles, # translations and docs builds the Flatpak and Windows arm64 without a label: # what breaks only those legs lives in deps/, cmake/, the build scripts and the # workflows, and a list of those places would go stale, so the safe places are # listed instead. The macOS and the cl.exe builds never start on their own: # what breaks only cl comes from source changes, which no path rule can see. # # Each build-* or macos-priority label added starts a run of its own, and the # pull request's checks show the newest run only, so every run builds # everything the labels and the changed files ask for; any other label builds # nothing. Each build keeps its own concurrency group: a build entering its # group cancels the one already in it, so when two runs start together the # last to enter wins, not necessarily the newest run. A push cancels the # builds of the commit it replaces. cancel_closed_pr_builds.yml joins the # groups by name, so update that file with any change here. name: Optional builds on: pull_request: branches: - main - release/* # Build all's pull_request paths, plus the Flatpak packaging: a pull request # that Build all skips has nothing for these builds to check either, and # the filter applies to labeled too. Keep the two lists in step. paths: - 'deps/**' - 'deps_src/**' - 'cmake/**' - 'src/**' - '**/CMakeLists.txt' - 'version.inc' - ".github/workflows/build_*.yml" - ".github/workflows/unit_tests*.yml" - ".github/workflows/mcp_sweep.yml" - 'build_linux.sh' - 'build_win.bat' - 'scripts/test_build_win.ps1' - 'scripts/check_exception_throw_info.ps1' - 'scripts/test_check_exception_throw_info.ps1' - 'build_release_macos.sh' - 'scripts/build_preset_cache.*' - 'scripts/prune_cached_presets.ps1' - 'scripts/test_prune_cached_presets.ps1' - 'scripts/flatpak/**' - 'scripts/msix/**' - 'tests/**' # labeled, so adding a label starts the build it asks for. types: [opened, reopened, synchronize, labeled] jobs: select: name: Select builds # A label that asks for no build must not restart the builds in progress. # macos-priority restarts them, to move the macOS build to its own line. if: ${{ github.event.action != 'labeled' || startsWith(github.event.label.name, 'build-') || github.event.label.name == 'macos-priority' }} runs-on: ubuntu-24.04 outputs: flatpak: ${{ steps.select.outputs.flatpak }} macos-x86_64: ${{ steps.select.outputs.macos-x86_64 }} windows-arm64: ${{ steps.select.outputs.windows-arm64 }} windows-msvc: ${{ steps.select.outputs.windows-msvc }} steps: - name: Checkout uses: actions/checkout@v7 with: lfs: 'false' # The merge commit plus its first parent, the base it is diffed against. fetch-depth: 2 sparse-checkout: .github/workflows - name: Select the builds the labels and the changed files ask for id: select env: LABELS: ${{ join(github.event.pull_request.labels.*.name, ' ') }} run: | has_label() { [[ " $LABELS " == *" $1 "* ]]; } infra=false changed=$(git diff --name-only HEAD^1 HEAD \ | grep -vE '^(src|tests|resources|localization|docs)/' | grep -vE '\.md$' || true) if [ -n "$changed" ]; then echo "This pull request changes files outside the sources, tests, profiles, translations and docs:" echo "$changed" | head -20 infra=true fi # pick