mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-25 10:37:11 -06:00
A group holds one active and one pending run, so `ci-${{ github.ref }}` let a
later push to main replace a queued run and skip its `cargo xtask ci`. Pull
request pushes keep the shared group (that supersession is the point); every
other run — a push to main, a manual one — now gets `ci-<run_id>`, a group of
its own, and always runs.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
74 lines
3.0 KiB
YAML
74 lines
3.0 KiB
YAML
# The quality gate (`cargo xtask ci`: fmt, clippy, heif, tests, parity, layers, assets, wasm) on
|
|
# every pull request and every push to main, so the full run happens here rather than on the
|
|
# machine of everyone with a branch open. Locally, `cargo xtask ci --quick` checks what a branch's
|
|
# changes can break in a few minutes; this job is the merge gate.
|
|
#
|
|
# Linux only: macOS / Windows test jobs are #1148. Standard GitHub-hosted runner (free for public
|
|
# repositories), never a larger one.
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
# A pull request's pushes share one group, so a new push supersedes the run of the old one.
|
|
# Every other run (a push to main, a manual one) gets a group of its own: a group keeps only one
|
|
# active and one pending run, so sharing one would let a later push replace a queued run and skip
|
|
# its `cargo xtask ci` — and every push to main is meant to get a full run.
|
|
group: ${{ github.event_name == 'pull_request' && format('ci-{0}', github.ref) || format('ci-{0}', github.run_id) }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# a fresh build every run: incremental state is only overhead, and it bloats the cache
|
|
CARGO_INCREMENTAL: 0
|
|
RUST_BACKTRACE: 1
|
|
# one job per runner: the machine-wide CI lock (xtask/src/ci_lock.rs) has nothing to wait for
|
|
LIGHTCRAFT_CI_LOCK: "off"
|
|
|
|
jobs:
|
|
xtask-ci:
|
|
name: cargo xtask ci (Linux x86_64)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
env:
|
|
CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts
|
|
CRAFT_FONTS_REQUIRED: "1"
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
# the font build input, so the Japanese and Chinese font tests run (they skip without it)
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
repository: storytold/craft-fonts
|
|
ref: 3d9ab3a132ed0eff457e424226a435a901da30d3 # as freebsd.yml; bump deliberately
|
|
path: craft-fonts
|
|
persist-credentials: false
|
|
- name: Install system libraries
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
|
|
- uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
targets: wasm32-unknown-unknown
|
|
# dependencies only (rust-cache drops the workspace's own artifacts), saved from main and
|
|
# restored by pull requests
|
|
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
with:
|
|
key: ci
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
- name: cargo xtask ci
|
|
run: cargo xtask ci
|
|
- name: Job summary
|
|
if: ${{ !cancelled() }}
|
|
run: cat target/ci/summary.md >> "$GITHUB_STEP_SUMMARY" || true
|