-
Notifications
You must be signed in to change notification settings - Fork 36
ci: scope Feature Unification Check to PR-affected crates #1695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gilescope
wants to merge
4
commits into
main
Choose a base branch
from
giles-fast-feature-unification
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Feature Unification | ||
|
|
||
| # Advisory check (not in the main ruleset's required status checks): verifies | ||
| # each crate compiles without dev-deps via `cargo hack check --no-dev-deps`. | ||
| # Feature-unification regressions are almost always introduced by manifest | ||
| # changes, so this only runs on PRs that touch one, scoped to the | ||
| # reverse-dependency closure of the changed crates. Deliberately not run on | ||
| # main pushes or merge queues. | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: ["**"] | ||
| paths: | ||
| - "**/Cargo.toml" | ||
| - "Cargo.lock" | ||
| - "rust-toolchain.toml" | ||
| - "scripts/feature-unification-scope.ts" | ||
| - ".github/workflows/feature-unification.yml" | ||
|
|
||
| # no top level default permissions for security reasons | ||
| permissions: {} | ||
| concurrency: | ||
| group: ${{ format('{0}-{1}', github.workflow, github.head_ref) }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| feature-unification: | ||
| name: Feature Unification Check | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| FORCE_COLOR: 1 | ||
| steps: | ||
| - name: Checkout node repository | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6.0.3 | ||
| with: | ||
| submodules: true | ||
| # The merge commit plus both parents, so HEAD^1 (the base) is | ||
| # available for the scope diff below. | ||
| fetch-depth: 2 | ||
|
|
||
| - id: guard | ||
| uses: ./.github/actions/tree-cache-guard | ||
|
|
||
| # No GHCR login: the build chain only pulls the public | ||
| # midnightntwrk/midnight-node-ci image from docker.io. | ||
| - uses: EarthBuild/actions-setup@cae2d9ab68894d8402751fe42e07c7cca0272f7f | ||
| if: steps.guard.outputs.hit != 'true' | ||
| with: | ||
| version: v0.8.16 | ||
| github-token: ${{ github.token }} | ||
| use-cache: false | ||
|
|
||
| # Uncomment if disk space again becomes an issue. | ||
| # - name: Free disk space | ||
| # if: steps.guard.outputs.hit != 'true' | ||
| # run: scripts/free-disk-space.sh | ||
|
|
||
| # The only git-coupled work: git history exists on the host, and `--ci` | ||
| # (strict) forbids LOCALLY inside the build, so the scope inputs are | ||
| # produced here and COPYed into the container. HEAD^1 is the PR base on a | ||
| # merge-commit checkout (fetch-depth: 2 above). | ||
| - name: Collect scope inputs | ||
| if: steps.guard.outputs.hit != 'true' | ||
| run: | | ||
| mkdir -p .scope | ||
| git diff --name-only HEAD^1 HEAD > .scope/changed.txt | ||
| git show HEAD^1:Cargo.lock > .scope/base-lock.txt 2>/dev/null || : > .scope/base-lock.txt | ||
| git diff HEAD^1 HEAD -- Cargo.toml > .scope/toml-diff.txt 2>/dev/null || : > .scope/toml-diff.txt | ||
|
|
||
| # scripts/feature-unification-scope.ts attributes the diff to crates | ||
| # in-container and skips the cargo-hack check when nothing is affected. | ||
| - name: Run feature unification check | ||
| if: steps.guard.outputs.hit != 'true' | ||
| run: | | ||
| . ./.envrc && earthly --ci +check-feature-unification | ||
|
|
||
| - uses: ./.github/actions/tree-cache-guard/save | ||
| if: steps.guard.outputs.hit != 'true' | ||
| with: | ||
| key: ${{ steps.guard.outputs.key }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path allowlist omits inputs that now directly affect
+check-feature-unification, notablyEarthfileandscripts/package*.json; a PR that changes only the Earthly target or the npm lockfile thatnpm ciconsumes will not start this workflow at all. Since this commit also enables Dependabot for/scripts, those dependency-update PRs can merge without ever exercising the scoper install/runtime path they modify.Useful? React with 👍 / 👎.