workflows/merge-group: compare eval against previous queue item
This runs the compare step in the merge queue, to get a combined diff against the previous queue item. This can be used as a base for multiple different features in the future, for example preventing accidental mass rebuilds in the merge queue, or diffing of packages' meta.
This commit is contained in:
25
.github/workflows/eval.yml
vendored
25
.github/workflows/eval.yml
vendored
@@ -122,19 +122,29 @@ jobs:
|
|||||||
# Note: Keep the same further down in sync!
|
# Note: Keep the same further down in sync!
|
||||||
|
|
||||||
- name: Evaluate the ${{ matrix.system }} output paths at the target commit
|
- name: Evaluate the ${{ matrix.system }} output paths at the target commit
|
||||||
if: inputs.targetSha
|
|
||||||
env:
|
env:
|
||||||
MATRIX_SYSTEM: ${{ matrix.system }}
|
MATRIX_SYSTEM: ${{ matrix.system }}
|
||||||
# This is very quick, because it pulls the eval results from Cachix.
|
|
||||||
run: |
|
run: |
|
||||||
nix-build nixpkgs/trusted/ci --arg nixpkgs ./nixpkgs/trusted-pinned -A eval.singleSystem \
|
TARGET_DRV=$(nix-instantiate nixpkgs/trusted/ci --arg nixpkgs ./nixpkgs/trusted-pinned -A eval.singleSystem \
|
||||||
--argstr evalSystem "$MATRIX_SYSTEM" \
|
--argstr evalSystem "$MATRIX_SYSTEM" \
|
||||||
--arg chunkSize 8000 \
|
--arg chunkSize 8000 \
|
||||||
--argstr nixPath "nixVersions.latest" \
|
--argstr nixPath "nixVersions.latest")
|
||||||
--out-link target
|
|
||||||
|
# Try to fetch this from Cachix a few times, for up to 30 seconds. This avoids running Eval
|
||||||
|
# twice in the Merge Queue, when a later item finishes Eval at the merge commit earlier.
|
||||||
|
for _i in {1..6}; do
|
||||||
|
# Using --max-jobs 0 will cause nix-build to fail if this can't be substituted from cachix.
|
||||||
|
if nix-build "$TARGET_DRV" --max-jobs 0; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
# Either fetches from Cachix or runs Eval itself. The fallback is required
|
||||||
|
# for pull requests into wip-branches without merge queue.
|
||||||
|
nix-build "$TARGET_DRV" --out-link target
|
||||||
|
|
||||||
- name: Compare outpaths against the target branch
|
- name: Compare outpaths against the target branch
|
||||||
if: inputs.targetSha
|
|
||||||
env:
|
env:
|
||||||
MATRIX_SYSTEM: ${{ matrix.system }}
|
MATRIX_SYSTEM: ${{ matrix.system }}
|
||||||
run: |
|
run: |
|
||||||
@@ -145,7 +155,6 @@ jobs:
|
|||||||
--out-link diff
|
--out-link diff
|
||||||
|
|
||||||
- name: Upload outpaths diff and stats
|
- name: Upload outpaths diff and stats
|
||||||
if: inputs.targetSha
|
|
||||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.artifact-prefix }}${{ matrix.version && format('{0}-', matrix.version) || '' }}diff-${{ matrix.system }}
|
name: ${{ inputs.artifact-prefix }}${{ matrix.version && format('{0}-', matrix.version) || '' }}diff-${{ matrix.system }}
|
||||||
@@ -154,7 +163,7 @@ jobs:
|
|||||||
compare:
|
compare:
|
||||||
runs-on: ubuntu-24.04-arm
|
runs-on: ubuntu-24.04-arm
|
||||||
needs: [eval]
|
needs: [eval]
|
||||||
if: inputs.targetSha && !cancelled() && !failure()
|
if: ${{ !cancelled() && !failure() }}
|
||||||
permissions:
|
permissions:
|
||||||
statuses: write
|
statuses: write
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
|
|||||||
1
.github/workflows/merge-group.yml
vendored
1
.github/workflows/merge-group.yml
vendored
@@ -59,6 +59,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
artifact-prefix: ${{ inputs.artifact-prefix }}
|
artifact-prefix: ${{ inputs.artifact-prefix }}
|
||||||
mergedSha: ${{ inputs.mergedSha || github.event.merge_group.head_sha }}
|
mergedSha: ${{ inputs.mergedSha || github.event.merge_group.head_sha }}
|
||||||
|
targetSha: ${{ inputs.targetSha || github.event.merge_group.base_sha }}
|
||||||
systems: ${{ needs.prepare.outputs.systems }}
|
systems: ${{ needs.prepare.outputs.systems }}
|
||||||
|
|
||||||
# This job's only purpose is to create the target for the "Required Status Checks" branch ruleset.
|
# This job's only purpose is to create the target for the "Required Status Checks" branch ruleset.
|
||||||
|
|||||||
Reference in New Issue
Block a user