@@ -117,12 +117,10 @@ jobs: |
117 | 117 | runs-on: ubuntu-slim |
118 | 118 | steps: |
119 | 119 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
120 | | - if: ${{ github.event_name != 'workflow_dispatch' }} |
121 | 120 | with: |
122 | 121 | persist-credentials: false |
123 | 122 |
|
124 | 123 | - name: Make tarball |
125 | | - if: ${{ github.event_name != 'workflow_dispatch' }} |
126 | 124 | run: | |
127 | 125 | export DATESTRING=$(date "+%Y-%m-%d") |
128 | 126 | export COMMIT=$(git rev-parse --short=10 "$GITHUB_SHA") |
@@ -131,7 +129,6 @@ jobs: |
131 | 129 | DISTTYPE: nightly |
132 | 130 |
|
133 | 131 | - name: Upload tarball artifact |
134 | | - if: ${{ github.event_name != 'workflow_dispatch' }} |
135 | 132 | uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
136 | 133 | with: |
137 | 134 | name: tarballs |
@@ -157,55 +154,78 @@ jobs: |
157 | 154 | runs-on: ${{ matrix.runner }} |
158 | 155 | steps: |
159 | 156 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
160 | | - if: ${{ github.event_name != 'workflow_dispatch' }} |
161 | 157 | with: |
162 | 158 | persist-credentials: false |
163 | 159 | sparse-checkout: .github/actions |
| 160 | + sparse-checkout-cone-mode: false |
164 | 161 | - uses: ./.github/actions/build-shared |
165 | | - if: ${{ github.event_name != 'workflow_dispatch' }} |
| 162 | + name: Build and test Node.js |
166 | 163 | with: |
167 | | - system: ${{ matrix.system }} |
168 | 164 | cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 165 | + extra-nix-flags: | |
| 166 | + --arg useSeparateDerivationForV8 true \ |
| 167 | + ${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }} |
169 | 168 |
|
170 | 169 | build-aarch64-linux-v8: |
171 | 170 | needs: build-tarball |
172 | 171 | runs-on: ubuntu-24.04-arm |
173 | 172 | name: 'aarch64-linux: Cache V8 build' |
| 173 | + outputs: |
| 174 | + local-cache: ${{ steps.upload.outcome != 'skipped' && 'true' || '' }} |
174 | 175 | steps: |
175 | | - - name: Check if Cachix is available |
176 | | - id: cachix-check |
177 | | - run: echo 'IS_AVAILABLE=${{ secrets.CACHIX_AUTH_TOKEN && 'true' }}' >> "$GITHUB_OUTPUT" |
178 | | - |
179 | 176 | - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
180 | | - if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
181 | 177 | with: |
182 | 178 | name: tarballs |
183 | 179 | path: tarballs |
184 | 180 |
|
185 | 181 | - name: Extract tarball |
186 | | - if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
187 | 182 | shell: bash |
188 | 183 | run: | |
189 | 184 | tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP" |
190 | 185 | echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV" |
191 | 186 |
|
192 | 187 | - uses: cachix/install-nix-action@ab739621df7a23f52766f9ccc97f38da6b7af14f # v31.10.5 |
193 | | - if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
194 | 188 | with: |
195 | 189 | extra_nix_config: sandbox = true |
196 | 190 |
|
| 191 | + - name: Evaluate V8 derivation |
| 192 | + id: v8-drv |
| 193 | + run: | |
| 194 | + V8_DRV=$( |
| 195 | + nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs" |
| 196 | + ) |
| 197 | + echo "V8_DRV=$V8_DRV" >> "$GITHUB_OUTPUT" |
| 198 | + echo "STORE_PATH=$(nix-store -q --outputs "$V8_DRV")" >> "$GITHUB_OUTPUT" |
| 199 | +
|
| 200 | + - name: Check if available on Cachix |
| 201 | + id: cachix-check |
| 202 | + run: | |
| 203 | + echo 'HAS_WRITE_TOKEN=${{ secrets.CACHIX_AUTH_TOKEN && 'true' }}' >> "$GITHUB_OUTPUT" |
| 204 | + set -x |
| 205 | + [ "$(curl -ISsw "%{http_code}" -o /dev/null "https://nodejs.cachix.org/$(basename ${V8_STORE_PATH%-v8-*}).narinfo")" != "200" ] || |
| 206 | + echo "ALREADY_CACHED=true" >> "$GITHUB_OUTPUT" |
| 207 | + env: |
| 208 | + V8_STORE_PATH: ${{ steps.v8-drv.outputs.STORE_PATH }} |
| 209 | + |
197 | 210 | - uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17 |
198 | | - if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
| 211 | + if: ${{ steps.cachix-check.outputs.ALREADY_CACHED != 'true' }} |
199 | 212 | with: |
200 | 213 | name: nodejs |
201 | 214 | authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
202 | 215 |
|
203 | 216 | - name: Build V8 derivation |
204 | | - if: ${{ steps.cachix-check.outputs.IS_AVAILABLE == 'true' }} |
205 | | - run: | |
206 | | - nix-build "$( |
207 | | - nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/shell.nix { useSeparateDerivationForV8=true; }).buildInputs" |
208 | | - )" |
| 217 | + if: ${{ steps.cachix-check.outputs.ALREADY_CACHED != 'true' }} |
| 218 | + run: nix-store --export "$(nix-build "$V8_DRV")" > libv8 |
| 219 | + env: |
| 220 | + V8_DRV: ${{ steps.v8-drv.outputs.V8_DRV }} |
| 221 | + |
| 222 | + - name: Upload libv8 |
| 223 | + if: ${{ steps.cachix-check.outputs.ALREADY_CACHED != 'true' && steps.cachix-check.outputs.HAS_WRITE_TOKEN != 'true' }} |
| 224 | + id: upload |
| 225 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 226 | + with: |
| 227 | + name: libv8 |
| 228 | + path: libv8 |
209 | 229 |
|
210 | 230 | # Builds the matrix for `build-openssl` from tools/nix/openssl-matrix.json. |
211 | 231 | # Output shape: |
@@ -253,14 +273,25 @@ jobs: |
253 | 273 | with: |
254 | 274 | persist-credentials: false |
255 | 275 | sparse-checkout: .github/actions |
| 276 | + sparse-checkout-cone-mode: false |
| 277 | + |
| 278 | + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 279 | + if: ${{ needs.build-aarch64-linux-v8.outputs.local-cache }} |
| 280 | + with: |
| 281 | + name: libv8 |
| 282 | + |
256 | 283 | - uses: ./.github/actions/build-shared |
| 284 | + name: Build and test Node.js |
257 | 285 | with: |
258 | | - system: aarch64-linux |
259 | 286 | cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} |
260 | 287 | # Override just the `openssl` attr of the default shared-lib set with |
261 | 288 | # the matrix-selected nixpkgs attribute (e.g. `openssl_3_6`). All |
262 | 289 | # other shared libs (brotli, cares, libuv, …) keep their defaults. |
263 | 290 | # `permittedInsecurePackages` whitelists just the matrix-selected |
264 | 291 | # release (e.g. `openssl-1.1.1w`) so EOL-with-extended-support |
265 | 292 | # cycles evaluate without relaxing nixpkgs' meta check globally. |
266 | | - extra-nix-args: --arg sharedLibDeps "(import $TAR_DIR/tools/nix/sharedLibDeps.nix {}) // { openssl = (import $TAR_DIR/tools/nix/pkgs.nix { config.permittedInsecurePackages = [ \"openssl-$OPENSSL_VERSION\" ]; }).$OPENSSL_ATTR; }" |
| 293 | + extra-nix-flags: | |
| 294 | + --arg useSeparateDerivationForV8 ${{ needs.build-aarch64-linux-v8.outputs.local-cache && '"$(nix-store --import < libv8)"' || 'true' }} \ |
| 295 | + --arg sharedLibDeps "(import $TAR_DIR/tools/nix/sharedLibDeps.nix {}) // { |
| 296 | + openssl = (import $TAR_DIR/tools/nix/pkgs.nix { config.permittedInsecurePackages = [ \"openssl-$OPENSSL_VERSION\" ]; }).$OPENSSL_ATTR; |
| 297 | + }" \ |