Skip to content

Commit 6ff1cd0

Browse files
committed
fixup! tools: run CI with shared libs on GHA
1 parent dd8ddb7 commit 6ff1cd0

File tree

8 files changed

+59
-24
lines changed

8 files changed

+59
-24
lines changed

.github/workflows/linters.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ jobs:
114114
NODE=$(command -v node) make lint-md
115115
env:
116116
NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }}
117+
lint-nix:
118+
if: github.event.pull_request.draft == false
119+
runs-on: ubuntu-latest
120+
steps:
121+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
122+
with:
123+
persist-credentials: false
124+
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
125+
- name: Lint Nix files
126+
run: nix-shell -p '(import "${./nixpkgs.nix}" {}).nixfmt-tree' --run 'treefmt --fail-on-change'
127+
- if: ${{ failure() }}
128+
name: Show diff
129+
run: git --no-pager diff
130+
117131
lint-py:
118132
if: github.event.pull_request.draft == false
119133
runs-on: ubuntu-latest

.github/workflows/test-linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths-ignore:
66
- .mailmap
77
- README.md
8+
- '*.nix'
89
- .github/**
910
- '!.github/workflows/test-linux.yml'
1011
types: [opened, synchronize, reopened, ready_for_review]
@@ -17,6 +18,7 @@ on:
1718
paths-ignore:
1819
- .mailmap
1920
- README.md
21+
- '*.nix'
2022
- .github/**
2123
- '!.github/workflows/test-linux.yml'
2224

.github/workflows/test-macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths-ignore:
77
- .mailmap
88
- '**.md'
9+
- '*.nix'
910
- AUTHORS
1011
- doc/**
1112
- .github/**
@@ -19,6 +20,7 @@ on:
1920
paths-ignore:
2021
- .mailmap
2122
- '**.md'
23+
- '*.nix'
2224
- AUTHORS
2325
- doc/**
2426
- .github/**

.github/workflows/test-shared.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
pull_request:
55
paths-ignore:
66
- .mailmap
7-
- README.md
7+
- '**.md'
8+
- AUTHORS
9+
- doc/**
810
- .github/**
911
- '!.github/workflows/test-shared.yml'
1012
types: [opened, synchronize, reopened, ready_for_review]
@@ -16,7 +18,9 @@ on:
1618
- v[0-9]+.x
1719
paths-ignore:
1820
- .mailmap
19-
- README.md
21+
- '**.md'
22+
- AUTHORS
23+
- doc/**
2024
- .github/**
2125
- '!.github/workflows/test-shared.yml'
2226
workflow_dispatch:
@@ -50,8 +54,6 @@ concurrency:
5054

5155
env:
5256
FLAKY_TESTS: keep_retrying
53-
NIXPKGS_REPO: https://github.com/NixOS/nixpkgs
54-
NIXPKGS_PIN: ca77296380960cd497a765102eeb1356eb80fed0
5557

5658
permissions:
5759
contents: read
@@ -140,11 +142,10 @@ jobs:
140142
env:
141143
EXPECTED_SHA: ${{ inputs.commit }}
142144

143-
- uses: cachix/install-nix-action@f0fe604f8a612776892427721526b4c7cfb23aba # v31
145+
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
144146
with:
145147
extra_nix_config: sandbox = true
146148
github_access_token: ${{ secrets.GITHUB_TOKEN }}
147-
nix_path: nixpkgs=${{ env.NIXPKGS_REPO }}/archive/${{ env.NIXPKGS_PIN }}.tar.gz
148149

149150
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
150151
with:
@@ -173,7 +174,7 @@ jobs:
173174
--pure --keep TAR_DIR --keep FLAKY_TESTS \
174175
--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
175176
--arg loadJSBuiltinsDynamically false \
176-
--arg ccache '(import <nixpkgs> {}).sccache' \
177+
--arg ccache '(import "${./nixpkgs.nix}" {}).sccache' \
177178
--arg devTools '[]' \
178179
--arg benchmarkTools '[]' \
179180
--run '
@@ -249,11 +250,10 @@ jobs:
249250
merge-multiple: true
250251
path: raw-results
251252

252-
- uses: cachix/install-nix-action@f0fe604f8a612776892427721526b4c7cfb23aba # v31
253+
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
253254
with:
254255
extra_nix_config: sandbox = true
255256
github_access_token: ${{ secrets.GITHUB_TOKEN }}
256-
nix_path: nixpkgs=${{ env.NIXPKGS_REPO }}/archive/${{ env.NIXPKGS_PIN }}.tar.gz
257257

258258
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
259259
with:

.github/workflows/tools.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ jobs:
306306
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
307307
with:
308308
python-version: ${{ env.PYTHON_VERSION }}
309+
- name: Set up Nix
310+
if: matrix.id == 'nixpkgs-unstable' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id)
311+
uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
309312
- run: ${{ matrix.run }}
310313
if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
311314
env:

nixpkgs.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
arg:
2+
let
3+
repo = "https://github.com/NixOS/nixpkgs";
4+
rev = "ca77296380960cd497a765102eeb1356eb80fed0";
5+
nixpkgs = import (builtins.fetchTarball {
6+
url = "${repo}/archive/${rev}.tar.gz";
7+
sha256 = "1airrw6l87iyny1a3mb29l28na4s4llifprlgpll2na461jd40iy";
8+
}) arg;
9+
in
10+
nixpkgs

shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
pkgs ? import <nixpkgs> {},
2+
pkgs ? import "${./nixpkgs.nix}" {},
33
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
44
ncu-path ? null, # Provide this if you want to use a local version of NCU
55
icu ? pkgs.icu,

tools/dep_updaters/update-nixpkgs-pin.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ set -ex
44
# version on the unstable channel.
55

66
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
7-
WORKFLOW_FILE="$BASE_DIR/.github/workflows/test-shared.yml"
7+
NIXPKGS_PIN_FILE="$BASE_DIR/nixpkgs.nix"
88

9-
NIXPKGS_REPO=$(grep NIXPKGS_REPO: "$WORKFLOW_FILE" | awk -F': ' '{ print $2 }')
10-
CURRENT_VERSION_SHA1=$(grep NIXPKGS_PIN: "$WORKFLOW_FILE" | awk -F': ' '{ print $2 }')
11-
CURRENT_VERSION=$(echo "$CURRENT_UPSTREAM_SHA1" | head -c 7)
9+
NIXPKGS_REPO=$(grep 'repo =' "$NIXPKGS_PIN_FILE" | awk -F'"' '{ print $2 }')
10+
CURRENT_VERSION_SHA1=$(grep 'rev =' "$NIXPKGS_PIN_FILE" | awk -F'"' '{ print $2 }')
11+
CURRENT_VERSION=$(echo "$CURRENT_VERSION_SHA1" | head -c 7)
1212

1313
NEW_UPSTREAM_SHA1=$(git ls-remote "$NIXPKGS_REPO.git" nixpkgs-unstable | awk '{print $1}')
1414
NEW_VERSION=$(echo "$NEW_UPSTREAM_SHA1" | head -c 7)
@@ -19,17 +19,21 @@ NEW_VERSION=$(echo "$NEW_UPSTREAM_SHA1" | head -c 7)
1919

2020
compare_dependency_version "nixpkgs-unstable" "$NEW_VERSION" "$CURRENT_VERSION"
2121

22+
CURRENT_TARBALL_HASH=$(grep 'sha256 =' "$NIXPKGS_PIN_FILE" | awk -F'"' '{ print $2 }')
23+
NEW_TARBALL_HASH=$(nix-prefetch-url --unpack "$NIXPKGS_REPO/archive/$NEW_UPSTREAM_SHA1.tar.gz")
24+
2225
TMP_FILE=$(mktemp)
23-
sed "s/$CURRENT_VERSION_SHA1/$NEW_UPSTREAM_SHA1/" "$WORKFLOW_FILE" > "$TMP_FILE"
24-
mv "$TMP_FILE" "$WORKFLOW_FILE"
25-
26-
echo "All done!"
27-
echo ""
28-
echo "Please git add and commit the new version:"
29-
echo ""
30-
echo "$ git add $WORKFLOW_FILE"
31-
echo "$ git commit -m 'tools: bump nixpkgs-unstable pin to $NEW_VERSION'"
32-
echo ""
26+
sed "s/$CURRENT_VERSION_SHA1/$NEW_UPSTREAM_SHA1/;s/$CURRENT_TARBALL_HASH/$NEW_TARBALL_HASH/" "$NIXPKGS_PIN_FILE" > "$TMP_FILE"
27+
mv "$TMP_FILE" "$NIXPKGS_PIN_FILE"
28+
29+
cat -<<EOF
30+
All done!
31+
32+
Please git add and commit the new version:
33+
34+
$ git add $NIXPKGS_PIN_FILE
35+
$ git commit -m 'tools: bump nixpkgs-unstable pin to $NEW_VERSION'
36+
EOF
3337

3438
# The last line of the script should always print the new version,
3539
# as we need to add it to $GITHUB_ENV variable.

0 commit comments

Comments
 (0)