Merge pull request #2930 from storytold/task/293-turn-iff-auto-github-runs

ci: workflows run only when started, not on every push or pull request
This commit is contained in:
BFlat
2026-12-03 03:43:15 +07:00
committed by GitHub
13 changed files with 34 additions and 75 deletions
+7 -9
View File
@@ -1,27 +1,25 @@
name: CI
# Quality gates for every push to main and every pull request (`cargo xtask ci`), through the
# suite's shared gate workflow in craft-common-actions.
# Quality gates (`cargo xtask ci`), through the suite's shared gate workflow in
# craft-common-actions. Runs only when started (`gh workflow run ci.yml --ref <branch>`): pushes and
# pull requests no longer queue runs on their own, so the shared runners are not swamped.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
# A newer push to a PR branch cancels its older run; every push to main runs to the end.
# A newer run on a branch cancels its older one; every run on main runs to the end.
concurrency:
group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
gate:
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
os: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && '["artcraft-k8s-main"]' || '["ubuntu-24.04"]' }}
os: ${{ github.ref == 'refs/heads/main' && '["artcraft-k8s-main"]' || '["ubuntu-24.04"]' }}
# Combined Latin presentation and core UI catalog. Required web builds enforce
# Inter Regular/SemiBold and Noto Sans Georgian Regular after asset-policy filtering.
craft-fonts-ref: 37827adc41fd165f9a9234ac40f94dbad353aa69
+3 -8
View File
@@ -4,17 +4,12 @@
# before it can fail a release. Nothing is uploaded and no secrets are used.
name: FreeBSD
# The VM build is slow, so it runs nightly on main and on pushes to `release`, not on every pull
# request: a drifted dependency still shows up within a day, and always before a release ships.
# PRs that change the FreeBSD workflow or packaging itself still run it.
# The VM build is slow, so it runs nightly on main and on pushes to `release`: a drifted dependency
# still shows up within a day, and always before a release ships. Start it by hand for a PR that
# changes the FreeBSD workflow or packaging.
on:
push:
branches: [release]
pull_request:
paths:
- .github/workflows/freebsd.yml
- packaging/freebsd/**
- packaging/env.sh
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
-11
View File
@@ -1,17 +1,6 @@
name: House rules
on:
push:
branches: [main]
paths:
- AGENTS.md
- CLAUDE.md
- .github/workflows/house-rules.yml
pull_request:
paths:
- AGENTS.md
- CLAUDE.md
- .github/workflows/house-rules.yml
workflow_dispatch:
permissions:
-3
View File
@@ -4,9 +4,6 @@ name: Lockfile
# no longer verifies upstream, so a moved tag cannot slip a different commit into a run.
# Docs: https://gh.io/actions-lockfile
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
+3 -12
View File
@@ -6,28 +6,19 @@ name: Nightly macOS build
# is signed and notarized by the shared release-ref signer (craft-common-actions), which calls
# packaging/macos/nightly-sign.sh.
on:
# macOS runners are shared with release builds: pull requests run this only with the `full-ci`
# label, never by changed paths. `labeled` so adding it starts a run.
pull_request:
types: [opened, synchronize, reopened, labeled]
# macOS runners are shared with release builds: runs only when started.
workflow_dispatch:
permissions:
contents: read
# A newer push to a labelled PR cancels its older run. Any event that will not build (no `full-ci`
# label, or another label added) gets a group of its own, so it never cancels a real build.
concurrency:
group: nightly-macos-${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-ci') && (github.event.action != 'labeled' || github.event.label.name == 'full-ci') && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: nightly-macos-${{ github.run_id }}
cancel-in-progress: false
jobs:
build:
name: Nightly .app (aarch64, unsigned)
if: >-
github.event_name == 'workflow_dispatch' ||
(contains(github.event.pull_request.labels.*.name, 'full-ci') &&
(github.event.action != 'labeled' || github.event.label.name == 'full-ci'))
runs-on: macos-15
timeout-minutes: 90
env:
-5
View File
@@ -3,11 +3,6 @@
name: Nix
on:
push:
branches: [main]
paths: ["flake.nix", "flake.lock", "nix/**", "Cargo.lock", ".github/workflows/nix.yml"]
pull_request:
paths: ["flake.nix", "flake.lock", "nix/**", "Cargo.lock", ".github/workflows/nix.yml"]
workflow_dispatch:
permissions:
-5
View File
@@ -3,11 +3,6 @@
name: Packaging lint
on:
push:
branches: [main, release]
paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**"]
pull_request:
paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**"]
workflow_dispatch:
permissions:
+2 -4
View File
@@ -1,10 +1,8 @@
name: SonarCloud
# Runs only when started (`gh workflow run sonarcloud.yml --ref <branch>`).
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
permissions:
contents: read
+1 -5
View File
@@ -5,16 +5,12 @@
name: Windows ARM64
# Nightly on main and on pushes to `release` (dependency and runner-image drift shows up within a
# day, and always before a release ships), and on PRs that change the Windows packaging itself.
# day, and always before a release ships). Start it by hand for a PR that changes Windows packaging.
on:
schedule:
- cron: "41 4 * * *"
push:
branches: [release]
pull_request:
paths:
- .github/workflows/windows-arm64.yml
- packaging/windows/**
workflow_dispatch:
concurrency:
+1
View File
@@ -74,6 +74,7 @@ FigCraft is an open-source, pure-Rust (egui) design app (Figma-class): interface
### Checks
For the crates you changed: `cargo fmt`, `cargo clippy -p <crate> --all-targets`, `cargo test -p <crate>`. Repository-wide steps when they apply: `cargo xtask layers`, `cargo xtask assets`, `cargo xtask wasm`, `cargo xtask parity`. `cargo xtask ci` runs them together.
- GitHub CI does not start on push or pull request. When a branch is ready, start it yourself: `gh workflow run ci.yml --ref <branch>` (and `sonarcloud.yml`, `lockfile.yml`, or a workflow that covers what you changed), then wait with `gh run watch`.
### Paths and conventions
- `unsafe`: none in the workspace; `Cargo.toml` sets `unsafe_code = "forbid"`. The plug-in SDK in `plugins/sdk` is outside the workspace and uses `unsafe` for the WebAssembly host calls. `figcraft_engine::guard` catches a panic at every engine entry point.
+5 -3
View File
@@ -59,8 +59,10 @@ team (id 19837241), leaving out `echelon-robot`; update it by PR in both places
**Admission timing.** The candidate check reads the newest CI run on the candidate commit and
main's latest finished Sonar analysis, so when to dispatch matters:
- Pick a quiet `main`, wait for its CI and SonarCloud analysis to finish green, then dispatch the
producer and, once it succeeds, the signer, before another `main` push lands a newer analysis.
- Pick a quiet `main`, start its CI and SonarCloud analysis (`gh workflow run ci.yml --ref main`,
`gh workflow run sonarcloud.yml --ref main`; neither starts on a push), wait for both to finish
green, then dispatch the producer and, once it succeeds, the signer, before a newer `main`
analysis lands.
**Platform rows.** The producer caller lists
`platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]'` on its single job: one producer
@@ -78,7 +80,7 @@ there is no separate Linux or macOS caller job and the signer caller has no plat
| `manual_actors` / `automatic_signer_actors` | the five release managers / `[]` | release-managers team (id 19837241) members; equals the producer caller's `manual-actors` |
| `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist |
| `platforms` | three rows | Storytold stable signing identities (`windows-x86_64`, `linux-x86_64`, `macos-aarch64`) |
| `candidate_policy.required_workflows` | CI (`ci.yml`, workflow `379864519`), `gate / gate (ubuntu-24.04)` | Workflow list API and latest `main` push CI run |
| `candidate_policy.required_workflows` | CI (`ci.yml`, workflow `379864519`), `gate / gate (artcraft-k8s-main)` | Workflow list API and latest `main` CI run |
| `candidate_policy.sonar` | `storytold` / `storytold_figcraft`, app `12526` | `sonar-project.properties` |
| Sonar `issue_types` / `debt` | `VULNERABILITY` / `[]` | Refresh from SonarCloud before promoting policy to `release` |
+7 -6
View File
@@ -240,9 +240,10 @@ adds the repo to the org's Default runner group so `macos-15-xlarge` can pick up
## Checks
- `.github/workflows/ci.yml` (PRs and `main`, Linux only): fmt, clippy `-D warnings`, tests,
layering, asset attribution, wasm32 check. No macOS in CI (playbook).
- `.github/workflows/packaging-lint.yml` (changes to `packaging/` or workflows): actionlint,
shellcheck, the AppRun test, a PowerShell parse, the MSI icon check, the FreeBSD dry run, a
grep for other products' names, xmllint, `desktop-file-validate`, `appstreamcli validate` and
the Flatpak manifest agreement check.
- `.github/workflows/ci.yml` (started by hand: `gh workflow run ci.yml --ref <branch>`; Linux
only): fmt, clippy `-D warnings`, tests, layering, asset attribution, wasm32 check. No macOS in
CI (playbook).
- `.github/workflows/packaging-lint.yml` (started by hand for changes to `packaging/` or
workflows): actionlint, shellcheck, the AppRun test, a PowerShell parse, the MSI icon check,
the FreeBSD dry run, a grep for other products' names, xmllint, `desktop-file-validate`,
`appstreamcli validate` and the Flatpak manifest agreement check.
+5 -4
View File
@@ -425,7 +425,7 @@ class NightlyInstalledPolicy(unittest.TestCase):
self.assertIs(type(self.policy["max_artifact_bytes"]), int)
self.assertTrue(0 < self.policy["max_artifact_bytes"] <= 16 * 1024 ** 3)
def test_candidate_workflows_run_on_every_main_push(self):
def test_candidate_workflows_can_run_on_main(self):
candidate = self.policy["candidate_policy"]
self.assertEqual(set(candidate), {"schema", "epoch", "repository", "branch", "required_workflows", "sonar"})
self.assertEqual(candidate["schema"], "craft-nightly-candidate-policy/v3")
@@ -439,10 +439,11 @@ class NightlyInstalledPolicy(unittest.TestCase):
self.assertIs(type(row["workflow_id"]), int)
self.assertNotEqual(row["workflow_path"], self.policy["producer_workflow_path"])
source = (ROOT / row["workflow_path"]).read_text()
# The signer admits a push, schedule or manual run on main, and CI starts by hand.
self.assertRegex(source, r"(?m)^ workflow_dispatch:", "a required workflow must be startable on main")
push = re.search(r"(?m)^ push:\n((?: .*\n)+)", source)
self.assertIsNotNone(push, "a required workflow must run on main pushes")
self.assertIn(" branches: [main]\n", push[1])
self.assertNotRegex(push[1], r"paths", "a path filter would leave candidates without a run")
if push:
self.assertNotRegex(push[1], r"paths", "a path filter would leave candidates without a run")
names = [job["name"] for job in row["jobs"]]
self.assertEqual(len(names), len(set(names)))
for job in row["jobs"]: