Files
node/.github/workflows/nix-changes.yml
Antoine du Hamel 67e45e4a87 tools: enable strict mode for yamllint
Treats warnings as errors, so we can detect regressions.

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67380
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-12 15:39:25 +00:00

138 lines
4.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# This action uses the following secrets:
# CACHIX_AUTH_TOKEN: Write access to nodejs.cachix.org – without it, the cache is read-only.
name: Nix files edited
on:
push:
branches:
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
paths:
- '**.nix'
- tools/certdata.txt
- tools/nix/**
- .github/workflows/nix-changes.yml
pull_request:
paths:
- '**.nix'
- tools/certdata.txt
- tools/nix/**
- .github/workflows/nix-changes.yml
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
diff:
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
system: x86_64-linux
- runner: ubuntu-24.04-arm
system: aarch64-linux
- runner: macos-15-intel
system: x86_64-darwin
- runner: macos-latest
system: aarch64-darwin
name: '${{ matrix.system }}: dependencies diff'
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 2
persist-credentials: true # We need read access in case we need to fetch in `Compute requisites before change` step
sparse-checkout: |
shell.nix
tools/nix/
tools/certdata.txt
sparse-checkout-cone-mode: false
- uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31.11.3
with:
extra_nix_config: sandbox = true
- uses: cachix/cachix-action@38b082610b782e7e93e209c35fd730d399dee866 # v17
with:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
name: nodejs
- name: Compute requisites after change
run: ./tools/nix/list-requisites.sh > requisites-${{ matrix.system }}-after.list
env:
# Making sure we do not depend on eval-time fetches, which are not cached.
# The only exception is nixpkgs source tarballs.
NIX_CONFIG: |
restrict-eval = true
allowed-uris = https://github.com/NixOS/nixpkgs/archive/
- name: Compute requisites before change
run: |
BASE_SHA="$(git rev-parse HEAD^)"
if [ -n "$PUSH_BEFORE_SHA" ] && [ "$PUSH_BEFORE_SHA" != "$BASE_SHA" ] \
&& [ "$PUSH_BEFORE_SHA" != "0000000000000000000000000000000000000000" ] \
&& git fetch --no-tags --depth=1 origin "$PUSH_BEFORE_SHA"; then
BASE_SHA="$PUSH_BEFORE_SHA"
fi
git reset "$BASE_SHA" --hard
./tools/nix/list-requisites.sh > requisites-${{ matrix.system }}-before.list
env:
PUSH_BEFORE_SHA: ${{ github.event_name == 'push' && github.event.before || '' }}
- name: Output diff
run: |
{
if diff_output="$(git diff -U0 --no-color --no-index requisites-${{ matrix.system }}-before.list requisites-${{ matrix.system }}-after.list)"; then
echo 'No changes detected.'
else
echo '```diff'
echo "$diff_output" | tail -n +5
echo '```'
fi
} >> "$GITHUB_STEP_SUMMARY"
- name: Store PR number
if: ${{ github.event.pull_request && matrix.system == 'x86_64-linux' }}
run: echo "${{ github.event.pull_request.number }}" > pr_number.txt
- name: Upload requisites lists
if: ${{ github.event.pull_request }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: requisites-${{ matrix.system }}
path: |
pr_number.*
requisites-${{ matrix.system }}-before.list
requisites-${{ matrix.system }}-after.list
lint-nix:
if: github.event.pull_request.draft == false
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
sparse-checkout: '*.nix'
sparse-checkout-cone-mode: false
- uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31.11.3
- name: Lint Nix files
run: |
NIX_LINTER=$(nix-instantiate --eval --raw -E '(import ./shell.nix {}).NIX_LINTER')
# Attempt to get it from cache, and fallback to building `devTools.nix` otherwise.
nix-store --realise "${NIX_LINTER%/bin/*}" || nix-build -I nixpkgs=tools/nix/pkgs.nix ./tools/nix/devTools.nix --no-out-link
"$NIX_LINTER" --quiet --ci && EXIT_CODE="$?" || EXIT_CODE="$?"
if [ "$EXIT_CODE" != "0" ]
then
git --no-pager diff || true
exit "$EXIT_CODE"
fi