mirror of
https://github.com/freemkv/freemkv-keysources.git
synced 2026-10-07 18:13:11 +00:00
dev -> qa -> main, across every public repo. dev is where work lands and is meant to be pushed to often, so ci.yml stays the fast answer: fmt, clippy, unit tests, leak-guard. qa is the release candidate, and qa.yml is the claim that a commit is production worth — release-profile tests on all three platforms, and the Linux cross-target clippy that the local precommit gate has always run but CI never did. Release profile matters as its own gate: overflow checks are off, debug_assert is compiled out, and inlining changes what the optimiser can prove. A test that only passes in debug never guarded the binary anyone ships. qa.yml checks siblings out at qa rather than dev. This is not a monorepo, and a qa run resolving its dependencies from unreleased dev tips would go green on a combination that is not the one shipping — the exact mismatch the branch model exists to prevent. ci.yml now tracks whichever branch triggered it for the same reason, since it also fires on qa. The consequence is that repos move to qa together, in dependency order. qa is backfilled from main so an unchanged crate still presents working code to the crates built on it.
176 lines
6.3 KiB
YAML
176 lines
6.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
# dev -> qa -> main. `dev` is where work lands and is meant to be pushed
|
|
# to often: these are the FAST checks, so a mistake surfaces in minutes.
|
|
# `qa` is the release candidate — it runs these too, plus the expensive
|
|
# suite in qa.yml. `main` only ever moves at release time, to a tagged
|
|
# commit that was already green on qa.
|
|
branches: [main, dev, qa]
|
|
pull_request:
|
|
|
|
# WHY THE SIBLING CHECKOUTS — this is NOT a monorepo.
|
|
#
|
|
# The committed Cargo.toml resolves libfreemkv from a git TAG (it is off
|
|
# crates.io). That means CI was building this branch against the LAST RELEASE
|
|
# of libfreemkv, never against libfreemkv's dev tip — so a coordinated change
|
|
# across the two repos could not be verified until release.sh cut the tags.
|
|
# Green here meant "compiles against last month's library".
|
|
#
|
|
# The fix mirrors the developer's local layout. Every repo is checked out into
|
|
# a subdirectory of $GITHUB_WORKSPACE, reproducing
|
|
# ~/Developer/freemkv/{freemkv-keysources,libfreemkv,freemkv-unlock}, and a
|
|
# generated .cargo/config.toml redirects the git-tag patch to those paths.
|
|
# Config-level [patch.crates-io] wins over the manifest one, which is the same
|
|
# mechanism local development already uses (see the note in Cargo.toml).
|
|
#
|
|
# Subdirectories rather than `../libfreemkv` because actions/checkout refuses
|
|
# any `path:` outside $GITHUB_WORKSPACE, and the workspace IS the repo dir.
|
|
# Repos stay separate, tags stay separate, the release cascade is untouched.
|
|
#
|
|
# libfreemkv path-deps ../freemkv-unlock, which resolves to the workspace root
|
|
# under this layout — hence the third checkout.
|
|
#
|
|
# `--locked` is deliberately absent: Cargo.lock is gitignored here (library
|
|
# convention), so there is nothing to lock against and it fails rather than
|
|
# resolves. That is what was breaking this workflow. The lock that has to hold
|
|
# is the one release.sh regenerates in each consuming binary.
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
path: freemkv-keysources
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/libfreemkv
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: libfreemkv
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/freemkv-unlock
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: freemkv-unlock
|
|
- name: Resolve siblings from their dev tips
|
|
shell: bash
|
|
working-directory: freemkv-keysources
|
|
run: |
|
|
mkdir -p .cargo
|
|
cat > .cargo/config.toml <<'EOF'
|
|
[patch.crates-io]
|
|
libfreemkv = { path = "../libfreemkv" }
|
|
EOF
|
|
- uses: dtolnay/rust-toolchain@1.97.0
|
|
with:
|
|
components: clippy, rustfmt
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: freemkv-keysources
|
|
- run: cargo fmt --check
|
|
working-directory: freemkv-keysources
|
|
# --all-targets so the test code is linted too, not just the library.
|
|
- run: cargo clippy --all-targets -- -D warnings
|
|
working-directory: freemkv-keysources
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
path: freemkv-keysources
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/libfreemkv
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: libfreemkv
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/freemkv-unlock
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: freemkv-unlock
|
|
- name: Resolve siblings from their dev tips
|
|
shell: bash
|
|
working-directory: freemkv-keysources
|
|
run: |
|
|
mkdir -p .cargo
|
|
cat > .cargo/config.toml <<'EOF'
|
|
[patch.crates-io]
|
|
libfreemkv = { path = "../libfreemkv" }
|
|
EOF
|
|
- uses: dtolnay/rust-toolchain@1.97.0
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: freemkv-keysources
|
|
- run: cargo test --tests
|
|
working-directory: freemkv-keysources
|
|
|
|
# This crate ships wherever freemkv and autorip ship, and it drags in all of
|
|
# libfreemkv's platform code (SCSI transports included). Build the tests, not
|
|
# `cargo check` — check skips codegen and never compiles test-only code.
|
|
check-macos:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
path: freemkv-keysources
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/libfreemkv
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: libfreemkv
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/freemkv-unlock
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: freemkv-unlock
|
|
- name: Resolve siblings from their dev tips
|
|
shell: bash
|
|
working-directory: freemkv-keysources
|
|
run: |
|
|
mkdir -p .cargo
|
|
cat > .cargo/config.toml <<'EOF'
|
|
[patch.crates-io]
|
|
libfreemkv = { path = "../libfreemkv" }
|
|
EOF
|
|
- uses: dtolnay/rust-toolchain@1.97.0
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: freemkv-keysources
|
|
- run: cargo build --tests
|
|
working-directory: freemkv-keysources
|
|
|
|
check-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
path: freemkv-keysources
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/libfreemkv
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: libfreemkv
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: freemkv/freemkv-unlock
|
|
ref: "${{ github.ref_name == 'qa' && 'qa' || 'dev' }}"
|
|
path: freemkv-unlock
|
|
- name: Resolve siblings from their dev tips
|
|
shell: bash
|
|
working-directory: freemkv-keysources
|
|
run: |
|
|
mkdir -p .cargo
|
|
cat > .cargo/config.toml <<'EOF'
|
|
[patch.crates-io]
|
|
libfreemkv = { path = "../libfreemkv" }
|
|
EOF
|
|
- uses: dtolnay/rust-toolchain@1.97.0
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: freemkv-keysources
|
|
- run: cargo build --tests
|
|
working-directory: freemkv-keysources
|