Bootstrap CI: test matrix and AI code review workflows - #2
Conversation
|
🔍 OpenCodeReview found 6 issue(s) in this PR.
📄
|
| pull_request: | ||
| branches: [main] | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always |
There was a problem hiding this comment.
There is no dependency caching (no actions/cache or Swatinem/rust-cache) and no concurrency group. Every push/PR triggers six parallel jobs each doing a full cold cargo build of the dependency graph, and multiple runs for the same PR are not cancelled. Adding rust-cache and a concurrency group would significantly cut runner minutes.
Suggestion:
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ci-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always |
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: |
There was a problem hiding this comment.
This workflow defines six jobs but has no top-level permissions: block, so every job runs with the default (potentially broad) GITHUB_TOKEN permissions. All these jobs only need to check out code and run cargo; contents: read is sufficient. Add a least-privilege permissions block.
Suggestion:
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: read | |
| jobs: |
| fmt: | ||
| name: Format | ||
| runs-on: ubuntu-latest | ||
| steps: |
There was a problem hiding this comment.
None of the six jobs set timeout-minutes, so a hung cargo build or a blocking test (e.g., on windows-latest) can consume runner time indefinitely. The companion code-review.yml sets 40 minutes; apply a similar job-level timeout here (GitHub's default 360 minutes is far too long for CI).
Suggestion:
| fmt: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| fmt: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: |
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt |
There was a problem hiding this comment.
The fmt job uses dtolnay/rust-toolchain@stable while every other job pins 1.92.0, and there is no rust-toolchain.toml in the repo to normalize the version. rustfmt formatting rules can differ between stable and 1.92.0, causing CI failures on code formatted with one version and checked with the other. Pin fmt to the same toolchain for consistency.
Suggestion:
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - uses: dtolnay/rust-toolchain@1.92.0 | |
| with: | |
| components: rustfmt |
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt |
There was a problem hiding this comment.
dtolnay/rust-toolchain is a third-party action referenced by mutable tag (@stable, @1.92.0). Tags can be repointed, so a compromise of the action's repo would execute arbitrary code in CI with access to the GITHUB_TOKEN. Pin the action to a full commit SHA (e.g., uses: dtolnay/rust-toolchain@<sha> with toolchain: 1.92.0 passed via with:). Applies to all five clippy/test/platform/doc jobs and the fmt job.
Suggestion:
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - uses: dtolnay/rust-toolchain@<full-commit-sha> | |
| with: | |
| toolchain: 1.92.0 | |
| components: rustfmt |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - run: ./scripts/check-license.sh |
There was a problem hiding this comment.
The license job runs ./scripts/check-license.sh, but no scripts/ directory or check-license.sh file exists in the repository. This job will always fail with an unclear runner error. Either commit the script (with the executable bit set) in this change, or remove the job until the script lands.
Suggestion:
| - run: ./scripts/check-license.sh | |
| - name: Check license headers | |
| shell: bash | |
| run: | | |
| test -x ./scripts/check-license.sh || { echo "scripts/check-license.sh missing or not executable"; exit 1; } | |
| ./scripts/check-license.sh |
…OCR review fixes)
| on: | ||
| push: | ||
| branches: [main] | ||
| paths-ignore: [".github/**"] |
There was a problem hiding this comment.
paths-ignore: [".github/**"] on both push and pull_request excludes the workflow's own file, so changes to ci.yml (or other CI configuration) will never trigger CI. A broken or misconfigured workflow would go unnoticed until an unrelated code change happens. Consider removing .github/** from the ignore list, or at least keeping ci.yml itself in scope.
There was a problem hiding this comment.
Acknowledged tradeoff: workflow-only PRs would previously have failed all 18 crate jobs with "could not find Cargo.toml" (there is no crate on the bootstrap branch this PR touches). The workflows themselves are exercised on every code-touching PR, and a broken ci.yml surfaces on the next code change. If we want workflow-only changes validated too, the options are a dorny/paths-filter job-level setup or accepting a full 3-platform matrix run on CI-only PRs — happy to switch if preferred.
| # The default path blows past the Windows MAX_PATH limit inside the | ||
| # mintlayer-core git checkouts (same reason mintlayer-core's own | ||
| # build.yml does this). | ||
| run: echo "CARGO_HOME=C:\crg" >> "$GITHUB_ENV" |
There was a problem hiding this comment.
The Windows step sets CARGO_HOME=C:\crg before Swatinem/rust-cache runs. rust-cache by default caches the cargo home and target directories based on the effective environment, so an override here changes cache paths; also this custom CARGO_HOME persists into the cargo build/test steps. Verify rust-cache handles the overridden CARGO_HOME (or pass explicit workspaces/cache-directories inputs) so Windows legs don't silently skip caching and rebuild from scratch every run.
There was a problem hiding this comment.
Intentional: the override is set for all subsequent steps precisely so that rust-cache and cargo resolve the same short CARGO_HOME on Windows (registry/target under C:\crg), keeping the cache path consistent across runs. rust-cache v2 derives the cargo home from the effective environment, so caching is active — just relocated. If we ever see silent cache misses on the Windows leg we can pin cache-directories explicitly.
Adds the CI workflows to
mainso that pull_request events (including #1 from the fork) can trigger them — fork PRs only pick up workflow definitions that exist on the base branch.