mirror of
https://github.com/freemkv/freemkv-keysources.git
synced 2026-10-07 18:13:11 +00:00
ci: build against libfreemkv's dev tip, not its last release
Two things were wrong here. `cargo test --locked` could never pass. Cargo.lock is gitignored for this crate (library convention), so there is no committed lockfile to lock against and cargo refuses to create one — every run failed before compiling a line. That is the immediate red. The deeper problem is what the workflow was building against. The committed Cargo.toml resolves libfreemkv from a git tag, so CI compiled this branch against the LAST RELEASE of libfreemkv and never against libfreemkv's dev tip. A change spanning the two repos could not be verified until release.sh cut the tags — at which point a break is discovered in the middle of shipping. Green meant "compiles against last month's library". Now each repo is checked out into a subdirectory of the workspace, reproducing the local ~/Developer/freemkv layout, and a generated .cargo/config.toml redirects the git-tag patch at those paths. That is the same config-level [patch.crates-io] mechanism local development already uses, and it wins over the manifest patch. Subdirectories because actions/checkout refuses a path: outside $GITHUB_WORKSPACE. Nothing in the manifests or the release cascade changes. Adds macOS and Windows jobs: this crate ships wherever freemkv and autorip ship and drags in all of libfreemkv's platform code, and neither OS was compiling it outside a release build. clippy gains --all-targets, which is what turned up the manual str::repeat in keydb_format's round-trip test — test code had never been linted.
This commit is contained in:
+143
-9
@@ -8,32 +8,166 @@ on:
|
||||
branches: [main, dev]
|
||||
pull_request:
|
||||
|
||||
# freemkv-keysources depends on libfreemkv from crates.io (see Cargo.toml).
|
||||
# No sibling-repo checkout is needed.
|
||||
# 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: dev
|
||||
path: libfreemkv
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
repository: freemkv/freemkv-unlock
|
||||
ref: 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
|
||||
# Cache ~/.cargo/registry + target/ across runs. Saves ~30-60s
|
||||
# of crates.io index download per job; incremental compilation
|
||||
# helps on re-runs that don't bump Cargo.lock.
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: freemkv-keysources-ci
|
||||
workspaces: freemkv-keysources
|
||||
- run: cargo fmt --check
|
||||
- run: cargo clippy -- -D warnings
|
||||
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: dev
|
||||
path: libfreemkv
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
repository: freemkv/freemkv-unlock
|
||||
ref: 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:
|
||||
shared-key: freemkv-keysources-ci
|
||||
- run: cargo test --locked
|
||||
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: dev
|
||||
path: libfreemkv
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
repository: freemkv/freemkv-unlock
|
||||
ref: 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: dev
|
||||
path: libfreemkv
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
repository: freemkv/freemkv-unlock
|
||||
ref: 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
|
||||
|
||||
+1
-5
@@ -779,11 +779,7 @@ mod tests {
|
||||
/// internal key forms (e.g. the `0x`-prefixed disc-hash) match by construction.
|
||||
#[test]
|
||||
fn to_keydb_cfg_round_trips_through_parse() {
|
||||
let h = |b: u8, n: usize| {
|
||||
std::iter::repeat(format!("{b:02x}"))
|
||||
.take(n)
|
||||
.collect::<String>()
|
||||
};
|
||||
let h = |b: u8, n: usize| format!("{b:02x}").repeat(n);
|
||||
let cert = h(0x99, 92); // AACS 1.0 host cert is 92 bytes
|
||||
let src = format!(
|
||||
"| HC | HOST_PRIV_KEY 0x{priv20} | HOST_CERT 0x{cert} ; Revoked in MKBv72\n\
|
||||
|
||||
Reference in New Issue
Block a user