# GENERATED BY ./ci.ts -- DO NOT DIRECTLY EDIT

name: ci
on:
  push:
    branches:
      - main
    tags:
      - '*'
  pull_request:
    types:
      - opened
      - reopened
      - synchronize
      - ready_for_review
permissions:
  contents: write
  id-token: write
concurrency:
  group: '${{ github.workflow }}-${{ !contains(github.event.pull_request.labels.*.name, ''ci-test-flaky'') && github.head_ref || github.run_id }}'
  cancel-in-progress: true
jobs:
  pre_build:
    name: pre-build
    runs-on: ubuntu-latest
    outputs:
      skip_build: '${{ steps.check.outputs.skip_build }}'
      skip_deno_core_test: '${{ steps.deno_core_changes.outputs.skip_deno_core_test }}'
      docs_only: '${{ steps.docs_only_changes.outputs.docs_only }}'
    steps:
      - name: Configure git
        if: github.event_name == 'pull_request'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: github.event_name == 'pull_request'
        with:
          fetch-depth: 5
          submodules: false
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: github.event_name == 'pull_request'
        with:
          deno-version: v2.x
      - id: check
        if: 'github.event_name == ''pull_request'' && github.event.pull_request.draft == true && !contains(github.event.pull_request.labels.*.name, ''ci-draft'')'
        run: |-
          GIT_MESSAGE=$(git log --format=%s -n 1 ${{github.event.after}})
          echo Commit message: $GIT_MESSAGE
          echo $GIT_MESSAGE | grep '\[ci\]' || (echo 'Exiting due to draft PR. Commit with [ci] to bypass or add the ci-draft label.' ; echo 'skip_build=true' >> $GITHUB_OUTPUT)
      - id: deno_core_changes
        if: github.event_name == 'pull_request'
        run: |-
          git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
          deno run -A tools/check_deno_core_changes.js ${{ github.event.pull_request.base.sha }}
      - id: docs_only_changes
        if: github.event_name == 'pull_request'
        run: 'deno run -A tools/check_docs_only_changes.js ${{ github.event.pull_request.base.sha }}'
  bench:
    name: bench release linux-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    steps:
      - name: Configure git
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-x86_64-bench-
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
      - name: Clone submodule ./tests/bench/testdata/lsp_benchdata
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/bench/testdata/lsp_benchdata
      - name: Clone submodule ./tests/util/std
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Set up incremental LTO and sysroot build
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          deno-version: v2.x
      - name: Install benchmark tools
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js wrk hyperfine
      - name: Build deno
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: cargo build --release -p deno
      - name: Run benchmarks
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        run: cargo bench -p bench_tests --bench deno_bench --locked
      - name: Post benchmarks
        if: '!startsWith(github.ref, ''refs/tags/'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          DENOBOT_PAT: '${{ secrets.DENOBOT_PAT }}'
        run: |-
          git clone --depth 1 --branch gh-pages                             \
              https://${DENOBOT_PAT}@github.com/denoland/benchmark_data.git \
              gh-pages
          ./target/release/deno run --allow-all ./tools/build_benchmark_jsons.js --release
          cd gh-pages
          git config user.email "propelml@gmail.com"
          git config user.name "denobot"
          git add .
          git commit --message "Update benchmarks"
          git push origin gh-pages
      - name: Worker info
        if: '(contains(github.event.pull_request.labels.*.name, ''ci-bench'') || github.ref == ''refs/heads/main'') && !startsWith(github.ref, ''refs/tags/'')'
        run: |-
          cat /proc/cpuinfo
          cat /proc/meminfo
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-bench-${{ github.sha }}'
  build-debug-macos-x86_64:
    name: build debug macos-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: macos-15-intel
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Remove macOS cURL --ipv4 flag
        run: |-
          curl --version
          which curl
          cat /etc/hosts
          rm ~/.curlrc || true
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-macos-x86_64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-macos-x86_64-debug-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Build debug
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo build --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/debug/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact debug-macos-x86_64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-macos-x86_64-deno
          path: target/debug/deno
          retention-days: 3
      - name: Upload artifact debug-macos-x86_64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-macos-x86_64-denort
          path: target/debug/denort
          retention-days: 3
      - name: Upload artifact debug-macos-x86_64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-macos-x86_64-test-server
          path: target/debug/test_server
          retention-days: 3
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-macos-x86_64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-macos-x86_64-debug-build-main-${{ github.sha }}'
  test-debug-macos-x86_64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}debug macos-x86_64'
    needs:
      - build-debug-macos-x86_64
    runs-on: macos-15-intel
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-macos-x86_64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-macos-x86_64-debug-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact debug-macos-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: debug-macos-x86_64-deno
          path: target/debug
      - name: Set target/debug/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/debug/deno
      - name: Download artifact debug-macos-x86_64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: debug-macos-x86_64-denort
          path: target/debug
      - name: Set target/debug/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/debug/denort
      - name: Download artifact debug-macos-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: debug-macos-x86_64-test-server
          path: target/debug
      - name: Set target/debug/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/debug/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build -p test_ffi
      - name: Test (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }}'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-macos-x86_64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-macos-x86_64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-macos-x86_64-debug-test-${{ matrix.test_crate }}-${{ github.sha }}'
  build-release-macos-x86_64:
    name: build release macos-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''macos-15-intel'' }}'
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Remove macOS cURL --ipv4 flag
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          curl --version
          which curl
          cat /etc/hosts
          rm ~/.curlrc || true
      - if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        with:
          deno-version: v2.x
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-macos-x86_64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-macos-x86_64-release-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
      - name: Log versions
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Configure canary build
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && !startsWith(github.ref, ''refs/tags/'')'
        run: echo "DENO_CANARY=true" >> $GITHUB_ENV
      - name: Build release
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: |-
          if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ]; then
            git submodule update --init tools/lzld
            make -C tools/lzld
            sed -i '' "s#-fuse-ld=lld #-fuse-ld=$GITHUB_WORKSPACE/tools/lzld/lzld -L$GITHUB_WORKSPACE/tools/lzld -llzld_arm64 #" .cargo/config.toml
            grep -n fuse-ld .cargo/config.toml
          fi
          df -h
          cargo build --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
          cargo build --release --locked -p denort_desktop
          df -h
      - name: Generate symcache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno -A tools/release/create_symcache.ts ./deno.symcache
          du -h deno.symcache
          du -h target/release/deno
      - name: Install rust-codesign
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js rcodesign
      - name: Pre-release (mac)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          APPLE_CODESIGN_KEY: '${{ secrets.APPLE_CODESIGN_KEY }}'
          APPLE_CODESIGN_PASSWORD: '${{ secrets.APPLE_CODESIGN_PASSWORD }}'
        run: |-
          target/release/deno -A tools/release/create_symcache.ts target/release/deno-x86_64-apple-darwin.symcache
          strip -x -S target/release/deno
          if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/tags/* ]]; then
            echo "Key is $(echo $APPLE_CODESIGN_KEY | base64 -d | wc -c) bytes"
            rcodesign sign target/release/deno --code-signature-flags=runtime --p12-password="$APPLE_CODESIGN_PASSWORD" --p12-file=<(echo $APPLE_CODESIGN_KEY | base64 -d) --entitlements-xml-file=cli/entitlements.plist
          fi
          cd target/release
          shasum -a 256 deno > deno-x86_64-apple-darwin.sha256sum
          zip -r deno-x86_64-apple-darwin.zip deno
          shasum -a 256 deno-x86_64-apple-darwin.zip > deno-x86_64-apple-darwin.zip.sha256sum
          strip -x -S ./denort
          zip -r denort-x86_64-apple-darwin.zip denort
          shasum -a 256 denort-x86_64-apple-darwin.zip > denort-x86_64-apple-darwin.zip.sha256sum
          strip -x -S ./libdenort.dylib
          zip -r libdenort-x86_64-apple-darwin.zip libdenort.dylib
          shasum -a 256 libdenort-x86_64-apple-darwin.zip > libdenort-x86_64-apple-darwin.zip.sha256sum
          restore_v8_runtimes() {
            test ! -e denort.v8 || mv -f denort.v8 denort
            test ! -e libdenort.v8.dylib || mv -f libdenort.v8.dylib libdenort.dylib
          }
          trap restore_v8_runtimes EXIT
          mv denort denort.v8
          mv libdenort.dylib libdenort.v8.dylib
          (cd ../.. && cargo build --release --locked -p denort -p denort_desktop --no-default-features --features quickjs)
          strip -x -S ./denort
          zip -r denort-quickjs-x86_64-apple-darwin.zip denort
          shasum -a 256 denort-quickjs-x86_64-apple-darwin.zip > denort-quickjs-x86_64-apple-darwin.zip.sha256sum
          strip -x -S ./libdenort.dylib
          zip -r libdenort-quickjs-x86_64-apple-darwin.zip libdenort.dylib
          shasum -a 256 libdenort-quickjs-x86_64-apple-darwin.zip > libdenort-quickjs-x86_64-apple-darwin.zip.sha256sum
          restore_v8_runtimes
          trap - EXIT
      - name: Build bsdiff helper
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: cargo build --release -p bsdiff_helper
      - name: Generate delta patch (mac)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          TARGET="x86_64-apple-darwin"
          PREV_VERSION=$(curl -sf https://dl.deno.land/release-latest.txt | tr -d "v\n") || true
          if [ -z "$PREV_VERSION" ]; then echo "No previous version found, skipping delta"; exit 0; fi
          echo "Generating delta from $PREV_VERSION for $TARGET"
          curl -fSL -o prev.zip "https://github.com/denoland/deno/releases/download/v${PREV_VERSION}/deno-${TARGET}.zip" || { echo "Previous release not found, skipping delta"; exit 0; }
          unzip -o prev.zip -d prev/
          ./target/release/bsdiff_helper prev/deno target/release/deno "target/release/deno-${TARGET}.from-${PREV_VERSION}.bsdiff"
          cd target/release && shasum -a 256 "deno-${TARGET}.from-${PREV_VERSION}.bsdiff" > "deno-${TARGET}.from-${PREV_VERSION}.bsdiff.sha256sum"
      - name: Upload canary to dl.deno.land
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.symcache"
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
          rm canary-latest.txt
      - name: Build product size info
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        run: |-
          du -hd1 "./target/release"
          du -ha  "./target/release/deno"
          du -ha  "./target/release/denort"
      - name: Check deno binary
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: target/release/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact release-macos-x86_64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-macos-x86_64-deno
          path: target/release/deno
          retention-days: 3
      - name: Upload artifact release-macos-x86_64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-macos-x86_64-denort
          path: target/release/denort
          retention-days: 3
      - name: Upload artifact release-macos-x86_64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-macos-x86_64-test-server
          path: target/release/test_server
          retention-days: 3
      - name: Upload release to dl.deno.land (unix)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.symcache"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.bsdiff"
      - name: Create release notes
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          export PATH=$PATH:$(pwd)/target/release
          ./tools/release/05_create_release_notes.ts
      - name: Upload release to GitHub
        uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        with:
          files: |-
            target/release/deno-x86_64-pc-windows-msvc.zip
            target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-pc-windows-msvc.sha256sum
            target/release/denort-x86_64-pc-windows-msvc.zip
            target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-x86_64-pc-windows-msvc.zip
            target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.zip
            target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.sha256sum
            target/release/denort-aarch64-pc-windows-msvc.zip
            target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-aarch64-pc-windows-msvc.zip
            target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.zip
            target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.sha256sum
            target/release/denort-x86_64-unknown-linux-gnu.zip
            target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-x86_64-unknown-linux-gnu.zip
            target/release/libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.zip
            target/release/deno-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.sha256sum
            target/release/denort-x86_64-apple-darwin.zip
            target/release/denort-x86_64-apple-darwin.zip.sha256sum
            target/release/libdenort-x86_64-apple-darwin.zip
            target/release/libdenort-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.zip
            target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.sha256sum
            target/release/denort-aarch64-unknown-linux-gnu.zip
            target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-aarch64-unknown-linux-gnu.zip
            target/release/libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.zip
            target/release/deno-aarch64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.sha256sum
            target/release/denort-aarch64-apple-darwin.zip
            target/release/denort-aarch64-apple-darwin.zip.sha256sum
            target/release/libdenort-aarch64-apple-darwin.zip
            target/release/libdenort-aarch64-apple-darwin.zip.sha256sum
            target/release/deno_src.tar.gz
            target/release/lib.deno.d.ts
            target/release/deno-*.bsdiff
            target/release/deno-*.bsdiff.sha256sum
          body_path: target/release/release-notes.md
          draft: true
          prerelease: '${{ contains(github.ref_name, ''-'') }}'
  test-release-macos-x86_64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}release macos-x86_64'
    needs:
      - build-release-macos-x86_64
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''macos-15-intel'' }}'
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-macos-x86_64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-macos-x86_64-release-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact release-macos-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: release-macos-x86_64-deno
          path: target/release
      - name: Set target/release/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/release/deno
      - name: Download artifact release-macos-x86_64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: release-macos-x86_64-denort
          path: target/release
      - name: Set target/release/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/release/denort
      - name: Download artifact release-macos-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: release-macos-x86_64-test-server
          path: target/release
      - name: Set target/release/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/release/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build --release -p test_ffi
      - name: Test (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }} --release'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-macos-x86_64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
  build-debug-macos-aarch64:
    name: build debug macos-aarch64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: macos-14
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Remove macOS cURL --ipv4 flag
        run: |-
          curl --version
          which curl
          cat /etc/hosts
          rm ~/.curlrc || true
      - env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        with:
          deno-version: v2.x
      - name: Install macOS aarch64 lld
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js ld64.lld
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-macos-aarch64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-macos-aarch64-debug-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Build debug
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo build --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Check QuickJS backend (deno + denort)
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo check --locked -p deno -p denort --no-default-features --features quickjs
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/debug/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact debug-macos-aarch64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-macos-aarch64-deno
          path: target/debug/deno
          retention-days: 3
      - name: Upload artifact debug-macos-aarch64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-macos-aarch64-denort
          path: target/debug/denort
          retention-days: 3
      - name: Upload artifact debug-macos-aarch64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-macos-aarch64-test-server
          path: target/debug/test_server
          retention-days: 3
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-macos-aarch64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-macos-aarch64-debug-build-main-${{ github.sha }}'
  test-debug-macos-aarch64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}debug macos-aarch64'
    needs:
      - build-debug-macos-aarch64
    runs-on: macos-14
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-macos-aarch64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-macos-aarch64-debug-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          deno-version: v2.x
      - if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH
      - name: Install macOS aarch64 lld
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js ld64.lld
      - name: Download artifact debug-macos-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: debug-macos-aarch64-deno
          path: target/debug
      - name: Set target/debug/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/debug/deno
      - name: Download artifact debug-macos-aarch64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: debug-macos-aarch64-denort
          path: target/debug
      - name: Set target/debug/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/debug/denort
      - name: Download artifact debug-macos-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: debug-macos-aarch64-test-server
          path: target/debug
      - name: Set target/debug/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/debug/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build -p test_ffi
      - name: Test (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }}'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-macos-aarch64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-macos-aarch64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-macos-aarch64-debug-test-${{ matrix.test_crate }}-${{ github.sha }}'
  test-libs-debug-macos-aarch64:
    name: test libs debug macos-aarch64
    needs:
      - build-debug-macos-aarch64
    runs-on: macos-14
    timeout-minutes: 30
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-macos-aarch64-test-libs-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-macos-aarch64-debug-test-libs-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'')'
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          deno-version: v2.x
      - if: '!startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH
      - name: Install macOS aarch64 lld
        if: '!startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js ld64.lld
      - name: Download artifact debug-macos-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: debug-macos-aarch64-deno
          path: target/debug
      - name: Set target/debug/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: chmod +x target/debug/deno
      - name: Download artifact debug-macos-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: debug-macos-aarch64-test-server
          path: target/debug
      - name: Set target/debug/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: chmod +x target/debug/test_server
      - name: Test libs
        if: '!startsWith(github.ref, ''refs/tags/'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p denort_desktop -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_cli_parser -p deno_config -p deno_crypto_provider -p deno_v8 -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_print -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-macos-aarch64-test-libs-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-macos-aarch64-debug-test-libs-${{ github.sha }}'
  build-release-macos-aarch64:
    name: build release macos-aarch64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''macos-14'' }}'
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Remove macOS cURL --ipv4 flag
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          curl --version
          which curl
          cat /etc/hosts
          rm ~/.curlrc || true
      - if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          deno-version: v2.x
      - name: Install macOS aarch64 lld
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js ld64.lld
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-macos-aarch64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-macos-aarch64-release-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
      - name: Log versions
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Configure canary build
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && !startsWith(github.ref, ''refs/tags/'')'
        run: echo "DENO_CANARY=true" >> $GITHUB_ENV
      - name: Build release
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: |-
          if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ]; then
            git submodule update --init tools/lzld
            make -C tools/lzld
            sed -i '' "s#-fuse-ld=lld #-fuse-ld=$GITHUB_WORKSPACE/tools/lzld/lzld -L$GITHUB_WORKSPACE/tools/lzld -llzld_arm64 #" .cargo/config.toml
            grep -n fuse-ld .cargo/config.toml
          fi
          df -h
          cargo build --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
          cargo build --release --locked -p denort_desktop
          df -h
      - name: Trace startup order
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          NO_COLOR: 1
        run: |-
          cp -p target/release/deno target/release/deno-before-startup-order
          target/release/deno run -A tools/startup_order/generate_macos_function_orderfile.ts \
            --binary $GITHUB_WORKSPACE/target/release/deno-before-startup-order \
            --output $GITHUB_WORKSPACE/target/release/startup-order-aarch64-apple-darwin.order \
            --repeats 3 \
            --workload-profile run-first
      - name: Relink release deno with startup order
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
          DENO_USE_STARTUP_ORDER: '1'
          DENO_STARTUP_ORDER_FILE: '${{ github.workspace }}/target/release/startup-order-aarch64-apple-darwin.order'
        run: cargo build --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Verify startup order
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno run -A tools/startup_order/verify_orderfile.ts \
            --baseline-binary target/release/deno-before-startup-order \
            --binary target/release/deno \
            --order target/release/startup-order-aarch64-apple-darwin.order \
            --output target/release/startup-order-aarch64-apple-darwin.order.verify.json
      - name: Upload startup order
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && always()'
        with:
          name: startup-order-release-macos-aarch64
          path: |-
            target/release/startup-order-aarch64-apple-darwin.order
            target/release/startup-order-aarch64-apple-darwin.order.json
            target/release/startup-order-aarch64-apple-darwin.order.verify.json
          retention-days: 7
          if-no-files-found: warn
      - name: Generate symcache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno -A tools/release/create_symcache.ts ./deno.symcache
          du -h deno.symcache
          du -h target/release/deno
      - name: Install rust-codesign
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js rcodesign
      - name: Pre-release (mac)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          APPLE_CODESIGN_KEY: '${{ secrets.APPLE_CODESIGN_KEY }}'
          APPLE_CODESIGN_PASSWORD: '${{ secrets.APPLE_CODESIGN_PASSWORD }}'
        run: |-
          target/release/deno -A tools/release/create_symcache.ts target/release/deno-aarch64-apple-darwin.symcache
          strip -x -S target/release/deno
          if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/tags/* ]]; then
            echo "Key is $(echo $APPLE_CODESIGN_KEY | base64 -d | wc -c) bytes"
            rcodesign sign target/release/deno --code-signature-flags=runtime --p12-password="$APPLE_CODESIGN_PASSWORD" --p12-file=<(echo $APPLE_CODESIGN_KEY | base64 -d) --entitlements-xml-file=cli/entitlements.plist
          fi
          cd target/release
          shasum -a 256 deno > deno-aarch64-apple-darwin.sha256sum
          zip -r deno-aarch64-apple-darwin.zip deno
          shasum -a 256 deno-aarch64-apple-darwin.zip > deno-aarch64-apple-darwin.zip.sha256sum
          strip -x -S ./denort
          zip -r denort-aarch64-apple-darwin.zip denort
          shasum -a 256 denort-aarch64-apple-darwin.zip > denort-aarch64-apple-darwin.zip.sha256sum
          strip -x -S ./libdenort.dylib
          zip -r libdenort-aarch64-apple-darwin.zip libdenort.dylib
          shasum -a 256 libdenort-aarch64-apple-darwin.zip > libdenort-aarch64-apple-darwin.zip.sha256sum
          restore_v8_runtimes() {
            test ! -e denort.v8 || mv -f denort.v8 denort
            test ! -e libdenort.v8.dylib || mv -f libdenort.v8.dylib libdenort.dylib
          }
          trap restore_v8_runtimes EXIT
          mv denort denort.v8
          mv libdenort.dylib libdenort.v8.dylib
          (cd ../.. && cargo build --release --locked -p denort -p denort_desktop --no-default-features --features quickjs)
          strip -x -S ./denort
          zip -r denort-quickjs-aarch64-apple-darwin.zip denort
          shasum -a 256 denort-quickjs-aarch64-apple-darwin.zip > denort-quickjs-aarch64-apple-darwin.zip.sha256sum
          strip -x -S ./libdenort.dylib
          zip -r libdenort-quickjs-aarch64-apple-darwin.zip libdenort.dylib
          shasum -a 256 libdenort-quickjs-aarch64-apple-darwin.zip > libdenort-quickjs-aarch64-apple-darwin.zip.sha256sum
          restore_v8_runtimes
          trap - EXIT
      - name: Build bsdiff helper
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: cargo build --release -p bsdiff_helper
      - name: Generate delta patch (mac)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          TARGET="aarch64-apple-darwin"
          PREV_VERSION=$(curl -sf https://dl.deno.land/release-latest.txt | tr -d "v\n") || true
          if [ -z "$PREV_VERSION" ]; then echo "No previous version found, skipping delta"; exit 0; fi
          echo "Generating delta from $PREV_VERSION for $TARGET"
          curl -fSL -o prev.zip "https://github.com/denoland/deno/releases/download/v${PREV_VERSION}/deno-${TARGET}.zip" || { echo "Previous release not found, skipping delta"; exit 0; }
          unzip -o prev.zip -d prev/
          ./target/release/bsdiff_helper prev/deno target/release/deno "target/release/deno-${TARGET}.from-${PREV_VERSION}.bsdiff"
          cd target/release && shasum -a 256 "deno-${TARGET}.from-${PREV_VERSION}.bsdiff" > "deno-${TARGET}.from-${PREV_VERSION}.bsdiff.sha256sum"
      - name: Upload canary to dl.deno.land
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.symcache"
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
          rm canary-latest.txt
      - name: Build product size info
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        run: |-
          du -hd1 "./target/release"
          du -ha  "./target/release/deno"
          du -ha  "./target/release/denort"
      - name: Check deno binary
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: target/release/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact release-macos-aarch64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-macos-aarch64-deno
          path: target/release/deno
          retention-days: 3
      - name: Upload artifact release-macos-aarch64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-macos-aarch64-denort
          path: target/release/denort
          retention-days: 3
      - name: Upload artifact release-macos-aarch64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-macos-aarch64-test-server
          path: target/release/test_server
          retention-days: 3
      - name: Upload release to dl.deno.land (unix)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.symcache"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.bsdiff"
      - name: Create release notes
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          export PATH=$PATH:$(pwd)/target/release
          ./tools/release/05_create_release_notes.ts
      - name: Upload release to GitHub
        uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        with:
          files: |-
            target/release/deno-x86_64-pc-windows-msvc.zip
            target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-pc-windows-msvc.sha256sum
            target/release/denort-x86_64-pc-windows-msvc.zip
            target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-x86_64-pc-windows-msvc.zip
            target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.zip
            target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.sha256sum
            target/release/denort-aarch64-pc-windows-msvc.zip
            target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-aarch64-pc-windows-msvc.zip
            target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.zip
            target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.sha256sum
            target/release/denort-x86_64-unknown-linux-gnu.zip
            target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-x86_64-unknown-linux-gnu.zip
            target/release/libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.zip
            target/release/deno-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.sha256sum
            target/release/denort-x86_64-apple-darwin.zip
            target/release/denort-x86_64-apple-darwin.zip.sha256sum
            target/release/libdenort-x86_64-apple-darwin.zip
            target/release/libdenort-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.zip
            target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.sha256sum
            target/release/denort-aarch64-unknown-linux-gnu.zip
            target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-aarch64-unknown-linux-gnu.zip
            target/release/libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.zip
            target/release/deno-aarch64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.sha256sum
            target/release/denort-aarch64-apple-darwin.zip
            target/release/denort-aarch64-apple-darwin.zip.sha256sum
            target/release/libdenort-aarch64-apple-darwin.zip
            target/release/libdenort-aarch64-apple-darwin.zip.sha256sum
            target/release/deno_src.tar.gz
            target/release/lib.deno.d.ts
            target/release/deno-*.bsdiff
            target/release/deno-*.bsdiff.sha256sum
          body_path: target/release/release-notes.md
          draft: true
          prerelease: '${{ contains(github.ref_name, ''-'') }}'
  test-release-macos-aarch64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}release macos-aarch64'
    needs:
      - build-release-macos-aarch64
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''macos-14'' }}'
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-macos-aarch64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-macos-aarch64-release-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          deno-version: v2.x
      - if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH
      - name: Install macOS aarch64 lld
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: ./tools/install_prebuilt.js ld64.lld
      - name: Download artifact release-macos-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: release-macos-aarch64-deno
          path: target/release
      - name: Set target/release/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/release/deno
      - name: Download artifact release-macos-aarch64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: release-macos-aarch64-denort
          path: target/release
      - name: Set target/release/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/release/denort
      - name: Download artifact release-macos-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: release-macos-aarch64-test-server
          path: target/release
      - name: Set target/release/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/release/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build --release -p test_ffi
      - name: Test (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }} --release'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-macos-aarch64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
  build-debug-windows-x86_64:
    name: build debug windows-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: windows-2022
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-windows-x86_64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-windows-x86_64-debug-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Build debug
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo build --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/debug/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact debug-windows-x86_64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-windows-x86_64-deno
          path: target/debug/deno.exe
          retention-days: 3
      - name: Upload artifact debug-windows-x86_64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-windows-x86_64-denort
          path: target/debug/denort.exe
          retention-days: 3
      - name: Upload artifact debug-windows-x86_64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-windows-x86_64-test-server
          path: target/debug/test_server.exe
          retention-days: 3
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-windows-x86_64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-windows-x86_64-debug-build-main-${{ github.sha }}'
  test-debug-windows-x86_64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}debug windows-x86_64'
    needs:
      - build-debug-windows-x86_64
    runs-on: windows-2022
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-windows-x86_64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-windows-x86_64-debug-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact debug-windows-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: debug-windows-x86_64-deno
          path: target/debug
      - name: Download artifact debug-windows-x86_64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: debug-windows-x86_64-denort
          path: target/debug
      - name: Download artifact debug-windows-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: debug-windows-x86_64-test-server
          path: target/debug
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build -p test_ffi
      - name: Test (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }}'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-windows-x86_64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-windows-x86_64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-windows-x86_64-debug-test-${{ matrix.test_crate }}-${{ github.sha }}'
  test-libs-debug-windows-x86_64:
    name: test libs debug windows-x86_64
    needs:
      - build-debug-windows-x86_64
    runs-on: windows-2022
    timeout-minutes: 30
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-windows-x86_64-test-libs-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-windows-x86_64-debug-test-libs-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'')'
      - name: Download artifact debug-windows-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: debug-windows-x86_64-deno
          path: target/debug
      - name: Download artifact debug-windows-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: debug-windows-x86_64-test-server
          path: target/debug
      - name: Test libs
        if: '!startsWith(github.ref, ''refs/tags/'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p denort_desktop -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_cli_parser -p deno_config -p deno_crypto_provider -p deno_v8 -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_print -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-windows-x86_64-test-libs-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-windows-x86_64-debug-test-libs-${{ github.sha }}'
  build-release-windows-x86_64:
    name: build release windows-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || github.repository == ''denoland/deno'' && ''windows-2022-xl'' || ''windows-2022'' }}'
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        with:
          deno-version: v2.x
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-windows-x86_64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-windows-x86_64-release-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
      - name: Log versions
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Configure canary build
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && !startsWith(github.ref, ''refs/tags/'')'
        run: echo "DENO_CANARY=true" >> $GITHUB_ENV
      - name: Build release
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: |-
          if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ]; then
            git submodule update --init tools/lzld
            make -C tools/lzld
            sed -i '' "s#-fuse-ld=lld #-fuse-ld=$GITHUB_WORKSPACE/tools/lzld/lzld -L$GITHUB_WORKSPACE/tools/lzld -llzld_arm64 #" .cargo/config.toml
            grep -n fuse-ld .cargo/config.toml
          fi
          df -h
          cargo build --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
          cargo build --release --locked -p denort_desktop
          df -h
      - name: Generate symcache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno -A tools/release/create_symcache.ts ./deno.symcache
          du -h deno.symcache
          du -h target/release/deno
      - name: Authenticate with Azure (windows)
        uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        with:
          client-id: '${{ secrets.AZURE_CLIENT_ID }}'
          tenant-id: '${{ secrets.AZURE_TENANT_ID }}'
          subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}'
          enable-AzPSSession: true
      - name: Code sign deno.exe (windows)
        uses: Azure/artifact-signing-action@1d365fec12862c4aa68fcac418143d73f0cea293
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        with:
          endpoint: 'https://eus.codesigning.azure.net/'
          trusted-signing-account-name: deno-cli-code-signing
          certificate-profile-name: deno-cli-code-signing-cert
          files-folder: target/release
          files-folder-filter: deno.exe
          file-digest: SHA256
          timestamp-rfc3161: 'http://timestamp.acs.microsoft.com'
          timestamp-digest: SHA256
          exclude-environment-credential: true
          exclude-workload-identity-credential: true
          exclude-managed-identity-credential: true
          exclude-shared-token-cache-credential: true
          exclude-visual-studio-credential: true
          exclude-visual-studio-code-credential: true
          exclude-azure-cli-credential: false
      - name: Verify signature (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        shell: pwsh
        run: |-
          $SignTool = Get-ChildItem -Path "C:\Program Files*\Windows Kits\*\bin\*\x64\signtool.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
          $SignToolPath = $SignTool.FullName
          & $SignToolPath verify /pa /v target\release\deno.exe
      - name: Pre-release (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        shell: pwsh
        run: |-
          Get-FileHash target/release/deno.exe -Algorithm SHA256 | Format-List > target/release/deno-x86_64-pc-windows-msvc.sha256sum
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip
          Get-FileHash target/release/deno-x86_64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-x86_64-pc-windows-msvc.zip
          Get-FileHash target/release/denort-x86_64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.dll -DestinationPath target/release/libdenort-x86_64-pc-windows-msvc.zip
          Get-FileHash target/release/libdenort-x86_64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
          try {
            Move-Item target/release/denort.exe target/release/denort.v8.exe
            Move-Item target/release/denort.dll target/release/denort.v8.dll
            cargo build --release --locked -p denort --no-default-features --features quickjs
            if ($LASTEXITCODE -ne 0) { throw "QuickJS denort build failed" }
            cargo build --release --locked -p denort_desktop --no-default-features --features quickjs
            if ($LASTEXITCODE -ne 0) { throw "QuickJS denort_desktop build failed" }
            Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-quickjs-x86_64-pc-windows-msvc.zip
            Get-FileHash target/release/denort-quickjs-x86_64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-quickjs-x86_64-pc-windows-msvc.zip.sha256sum
            Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.dll -DestinationPath target/release/libdenort-quickjs-x86_64-pc-windows-msvc.zip
            Get-FileHash target/release/libdenort-quickjs-x86_64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/libdenort-quickjs-x86_64-pc-windows-msvc.zip.sha256sum
          } finally {
            if (Test-Path target/release/denort.v8.exe) { Move-Item -Force target/release/denort.v8.exe target/release/denort.exe }
            if (Test-Path target/release/denort.v8.dll) { Move-Item -Force target/release/denort.v8.dll target/release/denort.dll }
          }
          target/release/deno.exe -A tools/release/create_symcache.ts target/release/deno-x86_64-pc-windows-msvc.symcache
      - name: Build bsdiff helper
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: cargo build --release -p bsdiff_helper
      - name: Generate delta patch (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        shell: pwsh
        run: |-
          $Target = "x86_64-pc-windows-msvc"
          $PrevVersion = (Invoke-RestMethod https://dl.deno.land/release-latest.txt).Trim() -replace "^v", ""
          if (-not $PrevVersion) { Write-Host "No previous version found, skipping delta"; exit 0 }
          Write-Host "Generating delta from $PrevVersion for $Target"
          try { Invoke-WebRequest -Uri "https://github.com/denoland/deno/releases/download/v$PrevVersion/deno-$Target.zip" -OutFile prev.zip } catch { Write-Host "Previous release not found, skipping delta"; exit 0 }
          Remove-Item -Recurse -Force prev -ErrorAction SilentlyContinue; New-Item -ItemType Directory -Path prev | Out-Null
          Expand-Archive -Force -Path prev.zip -DestinationPath prev
          & .\target\release\bsdiff_helper.exe "prev\deno.exe" "target\release\deno.exe" "target\release\deno-$Target.from-$PrevVersion.bsdiff"
          Get-FileHash "target\release\deno-$Target.from-$PrevVersion.bsdiff" -Algorithm SHA256 | Format-List > "target\release\deno-$Target.from-$PrevVersion.bsdiff.sha256sum"
      - name: Upload canary to dl.deno.land
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.symcache"
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
          rm canary-latest.txt
      - name: Build product size info
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        run: |-
          du -hd1 "./target/release"
          du -ha  "./target/release/deno"
          du -ha  "./target/release/denort"
      - name: Check deno binary
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: target/release/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact release-windows-x86_64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-windows-x86_64-deno
          path: target/release/deno.exe
          retention-days: 3
      - name: Upload artifact release-windows-x86_64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-windows-x86_64-denort
          path: target/release/denort.exe
          retention-days: 3
      - name: Upload artifact release-windows-x86_64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-windows-x86_64-test-server
          path: target/release/test_server.exe
          retention-days: 3
      - name: Upload release to dl.deno.land (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
          CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.symcache"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.bsdiff"
      - name: Create release notes
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          export PATH=$PATH:$(pwd)/target/release
          ./tools/release/05_create_release_notes.ts
      - name: Upload release to GitHub
        uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        with:
          files: |-
            target/release/deno-x86_64-pc-windows-msvc.zip
            target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-pc-windows-msvc.sha256sum
            target/release/denort-x86_64-pc-windows-msvc.zip
            target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-x86_64-pc-windows-msvc.zip
            target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.zip
            target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.sha256sum
            target/release/denort-aarch64-pc-windows-msvc.zip
            target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-aarch64-pc-windows-msvc.zip
            target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.zip
            target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.sha256sum
            target/release/denort-x86_64-unknown-linux-gnu.zip
            target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-x86_64-unknown-linux-gnu.zip
            target/release/libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.zip
            target/release/deno-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.sha256sum
            target/release/denort-x86_64-apple-darwin.zip
            target/release/denort-x86_64-apple-darwin.zip.sha256sum
            target/release/libdenort-x86_64-apple-darwin.zip
            target/release/libdenort-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.zip
            target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.sha256sum
            target/release/denort-aarch64-unknown-linux-gnu.zip
            target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-aarch64-unknown-linux-gnu.zip
            target/release/libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.zip
            target/release/deno-aarch64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.sha256sum
            target/release/denort-aarch64-apple-darwin.zip
            target/release/denort-aarch64-apple-darwin.zip.sha256sum
            target/release/libdenort-aarch64-apple-darwin.zip
            target/release/libdenort-aarch64-apple-darwin.zip.sha256sum
            target/release/deno_src.tar.gz
            target/release/lib.deno.d.ts
            target/release/deno-*.bsdiff
            target/release/deno-*.bsdiff.sha256sum
          body_path: target/release/release-notes.md
          draft: true
          prerelease: '${{ contains(github.ref_name, ''-'') }}'
  test-release-windows-x86_64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}release windows-x86_64'
    needs:
      - build-release-windows-x86_64
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''windows-2022'' }}'
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-windows-x86_64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-windows-x86_64-release-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact release-windows-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: release-windows-x86_64-deno
          path: target/release
      - name: Download artifact release-windows-x86_64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: release-windows-x86_64-denort
          path: target/release
      - name: Download artifact release-windows-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: release-windows-x86_64-test-server
          path: target/release
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build --release -p test_ffi
      - name: Test (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }} --release'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-windows-x86_64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
  build-debug-windows-aarch64:
    name: build debug windows-aarch64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: windows-11-arm
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-windows-aarch64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-windows-aarch64-debug-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Build debug
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo build --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/debug/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact debug-windows-aarch64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-windows-aarch64-deno
          path: target/debug/deno.exe
          retention-days: 3
      - name: Upload artifact debug-windows-aarch64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-windows-aarch64-denort
          path: target/debug/denort.exe
          retention-days: 3
      - name: Upload artifact debug-windows-aarch64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-windows-aarch64-test-server
          path: target/debug/test_server.exe
          retention-days: 3
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-windows-aarch64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-windows-aarch64-debug-build-main-${{ github.sha }}'
  test-debug-windows-aarch64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}debug windows-aarch64'
    needs:
      - build-debug-windows-aarch64
    runs-on: windows-11-arm
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-windows-aarch64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-windows-aarch64-debug-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact debug-windows-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: debug-windows-aarch64-deno
          path: target/debug
      - name: Download artifact debug-windows-aarch64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: debug-windows-aarch64-denort
          path: target/debug
      - name: Download artifact debug-windows-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: debug-windows-aarch64-test-server
          path: target/debug
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build -p test_ffi
      - name: Test (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }}'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-windows-aarch64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-windows-aarch64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-windows-aarch64-debug-test-${{ matrix.test_crate }}-${{ github.sha }}'
  build-release-windows-aarch64:
    name: build release windows-aarch64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''windows-11-arm'' }}'
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        with:
          deno-version: v2.x
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-windows-aarch64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-windows-aarch64-release-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
      - name: Log versions
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Configure canary build
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && !startsWith(github.ref, ''refs/tags/'')'
        run: echo "DENO_CANARY=true" >> $GITHUB_ENV
      - name: Build release
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: |-
          if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ]; then
            git submodule update --init tools/lzld
            make -C tools/lzld
            sed -i '' "s#-fuse-ld=lld #-fuse-ld=$GITHUB_WORKSPACE/tools/lzld/lzld -L$GITHUB_WORKSPACE/tools/lzld -llzld_arm64 #" .cargo/config.toml
            grep -n fuse-ld .cargo/config.toml
          fi
          df -h
          cargo build --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
          cargo build --release --locked -p denort_desktop
          df -h
      - name: Generate symcache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno -A tools/release/create_symcache.ts ./deno.symcache
          du -h deno.symcache
          du -h target/release/deno
      - name: Authenticate with Azure (windows)
        uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        with:
          client-id: '${{ secrets.AZURE_CLIENT_ID }}'
          tenant-id: '${{ secrets.AZURE_TENANT_ID }}'
          subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}'
          enable-AzPSSession: true
      - name: Code sign deno.exe (windows)
        uses: Azure/artifact-signing-action@1d365fec12862c4aa68fcac418143d73f0cea293
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        with:
          endpoint: 'https://eus.codesigning.azure.net/'
          trusted-signing-account-name: deno-cli-code-signing
          certificate-profile-name: deno-cli-code-signing-cert
          files-folder: target/release
          files-folder-filter: deno.exe
          file-digest: SHA256
          timestamp-rfc3161: 'http://timestamp.acs.microsoft.com'
          timestamp-digest: SHA256
          exclude-environment-credential: true
          exclude-workload-identity-credential: true
          exclude-managed-identity-credential: true
          exclude-shared-token-cache-credential: true
          exclude-visual-studio-credential: true
          exclude-visual-studio-code-credential: true
          exclude-azure-cli-credential: false
      - name: Verify signature (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        shell: pwsh
        run: |-
          $SignTool = Get-ChildItem -Path "C:\Program Files*\Windows Kits\*\bin\*\x64\signtool.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
          $SignToolPath = $SignTool.FullName
          & $SignToolPath verify /pa /v target\release\deno.exe
      - name: Pre-release (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        shell: pwsh
        run: |-
          Get-FileHash target/release/deno.exe -Algorithm SHA256 | Format-List > target/release/deno-aarch64-pc-windows-msvc.sha256sum
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-aarch64-pc-windows-msvc.zip
          Get-FileHash target/release/deno-aarch64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-aarch64-pc-windows-msvc.zip
          Get-FileHash target/release/denort-aarch64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.dll -DestinationPath target/release/libdenort-aarch64-pc-windows-msvc.zip
          Get-FileHash target/release/libdenort-aarch64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
          try {
            Move-Item target/release/denort.exe target/release/denort.v8.exe
            Move-Item target/release/denort.dll target/release/denort.v8.dll
            cargo build --release --locked -p denort --no-default-features --features quickjs
            if ($LASTEXITCODE -ne 0) { throw "QuickJS denort build failed" }
            cargo build --release --locked -p denort_desktop --no-default-features --features quickjs
            if ($LASTEXITCODE -ne 0) { throw "QuickJS denort_desktop build failed" }
            Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-quickjs-aarch64-pc-windows-msvc.zip
            Get-FileHash target/release/denort-quickjs-aarch64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-quickjs-aarch64-pc-windows-msvc.zip.sha256sum
            Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.dll -DestinationPath target/release/libdenort-quickjs-aarch64-pc-windows-msvc.zip
            Get-FileHash target/release/libdenort-quickjs-aarch64-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/libdenort-quickjs-aarch64-pc-windows-msvc.zip.sha256sum
          } finally {
            if (Test-Path target/release/denort.v8.exe) { Move-Item -Force target/release/denort.v8.exe target/release/denort.exe }
            if (Test-Path target/release/denort.v8.dll) { Move-Item -Force target/release/denort.v8.dll target/release/denort.dll }
          }
          target/release/deno.exe -A tools/release/create_symcache.ts target/release/deno-aarch64-pc-windows-msvc.symcache
      - name: Build bsdiff helper
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: cargo build --release -p bsdiff_helper
      - name: Generate delta patch (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        shell: pwsh
        run: |-
          $Target = "aarch64-pc-windows-msvc"
          $PrevVersion = (Invoke-RestMethod https://dl.deno.land/release-latest.txt).Trim() -replace "^v", ""
          if (-not $PrevVersion) { Write-Host "No previous version found, skipping delta"; exit 0 }
          Write-Host "Generating delta from $PrevVersion for $Target"
          try { Invoke-WebRequest -Uri "https://github.com/denoland/deno/releases/download/v$PrevVersion/deno-$Target.zip" -OutFile prev.zip } catch { Write-Host "Previous release not found, skipping delta"; exit 0 }
          Remove-Item -Recurse -Force prev -ErrorAction SilentlyContinue; New-Item -ItemType Directory -Path prev | Out-Null
          Expand-Archive -Force -Path prev.zip -DestinationPath prev
          & .\target\release\bsdiff_helper.exe "prev\deno.exe" "target\release\deno.exe" "target\release\deno-$Target.from-$PrevVersion.bsdiff"
          Get-FileHash "target\release\deno-$Target.from-$PrevVersion.bsdiff" -Algorithm SHA256 | Format-List > "target\release\deno-$Target.from-$PrevVersion.bsdiff.sha256sum"
      - name: Upload canary to dl.deno.land
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.symcache"
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
          rm canary-latest.txt
      - name: Build product size info
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        run: |-
          du -hd1 "./target/release"
          du -ha  "./target/release/deno"
          du -ha  "./target/release/denort"
      - name: Check deno binary
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: target/release/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact release-windows-aarch64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-windows-aarch64-deno
          path: target/release/deno.exe
          retention-days: 3
      - name: Upload artifact release-windows-aarch64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-windows-aarch64-denort
          path: target/release/denort.exe
          retention-days: 3
      - name: Upload artifact release-windows-aarch64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-windows-aarch64-test-server
          path: target/release/test_server.exe
          retention-days: 3
      - name: Upload release to dl.deno.land (windows)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
          CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.symcache"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.bsdiff"
      - name: Create release notes
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          export PATH=$PATH:$(pwd)/target/release
          ./tools/release/05_create_release_notes.ts
      - name: Upload release to GitHub
        uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        with:
          files: |-
            target/release/deno-x86_64-pc-windows-msvc.zip
            target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-pc-windows-msvc.sha256sum
            target/release/denort-x86_64-pc-windows-msvc.zip
            target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-x86_64-pc-windows-msvc.zip
            target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.zip
            target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.sha256sum
            target/release/denort-aarch64-pc-windows-msvc.zip
            target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-aarch64-pc-windows-msvc.zip
            target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.zip
            target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.sha256sum
            target/release/denort-x86_64-unknown-linux-gnu.zip
            target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-x86_64-unknown-linux-gnu.zip
            target/release/libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.zip
            target/release/deno-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.sha256sum
            target/release/denort-x86_64-apple-darwin.zip
            target/release/denort-x86_64-apple-darwin.zip.sha256sum
            target/release/libdenort-x86_64-apple-darwin.zip
            target/release/libdenort-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.zip
            target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.sha256sum
            target/release/denort-aarch64-unknown-linux-gnu.zip
            target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-aarch64-unknown-linux-gnu.zip
            target/release/libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.zip
            target/release/deno-aarch64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.sha256sum
            target/release/denort-aarch64-apple-darwin.zip
            target/release/denort-aarch64-apple-darwin.zip.sha256sum
            target/release/libdenort-aarch64-apple-darwin.zip
            target/release/libdenort-aarch64-apple-darwin.zip.sha256sum
            target/release/deno_src.tar.gz
            target/release/lib.deno.d.ts
            target/release/deno-*.bsdiff
            target/release/deno-*.bsdiff.sha256sum
          body_path: target/release/release-notes.md
          draft: true
          prerelease: '${{ contains(github.ref_name, ''-'') }}'
  test-release-windows-aarch64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}release windows-aarch64'
    needs:
      - build-release-windows-aarch64
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''windows-11-arm'' }}'
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-windows-aarch64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-windows-aarch64-release-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact release-windows-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: release-windows-aarch64-deno
          path: target/release
      - name: Download artifact release-windows-aarch64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: release-windows-aarch64-denort
          path: target/release
      - name: Download artifact release-windows-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: release-windows-aarch64-test-server
          path: target/release
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build --release -p test_ffi
      - name: Test (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        env:
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }} --release'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-windows-aarch64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
  build-release-linux-x86_64:
    name: build release linux-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: 'Create source tarballs (release, linux)'
        if: 'github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          mkdir -p target/release
          tar --exclude=".git*" --exclude=target --exclude=third_party/prebuilt \
              -czvf target/release/deno_src.tar.gz -C .. deno
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        with:
          deno-version: v2.x
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-x86_64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-x86_64-release-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Set up incremental LTO and sysroot build
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Configure canary build
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: echo "DENO_CANARY=true" >> $GITHUB_ENV
      - name: Configure frame-pointer panic traces
        run: |-
          echo "RUSTC_BOOTSTRAP=1" >> "$GITHUB_ENV"
          {
            echo "RUSTFLAGS<<__DENO_RUSTFLAGS"
            echo "$RUSTFLAGS -C force-frame-pointers=yes -C force-unwind-tables=no -C link-arg=-Wl,--no-eh-frame-hdr"
            echo "__DENO_RUSTFLAGS"
          } >> "$GITHUB_ENV"
      - name: Build release
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: |-
          if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ]; then
            git submodule update --init tools/lzld
            make -C tools/lzld
            sed -i '' "s#-fuse-ld=lld #-fuse-ld=$GITHUB_WORKSPACE/tools/lzld/lzld -L$GITHUB_WORKSPACE/tools/lzld -llzld_arm64 #" .cargo/config.toml
            grep -n fuse-ld .cargo/config.toml
          fi
          df -h
          cargo build -Zbuild-std=core,alloc,std,proc_macro,panic_abort --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace-frame-pointer
          cargo build -Zbuild-std=core,alloc,std,proc_macro,panic_abort --release --locked -p denort_desktop
          df -h
      - name: Trace startup order
        env:
          NO_COLOR: 1
        run: |-
          cp -p target/release/deno target/release/deno-before-startup-order
          target/release/deno run -A tools/startup_order/generate_linux_function_orderfile.ts \
            --binary $GITHUB_WORKSPACE/target/release/deno-before-startup-order \
            --output $GITHUB_WORKSPACE/target/release/startup-order-x86_64-unknown-linux-gnu.order \
            --repeats 3 \
            --workload-profile run-first
      - name: Relink release deno with startup order
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
          DENO_USE_STARTUP_ORDER: '1'
          DENO_STARTUP_ORDER_FILE: '${{ github.workspace }}/target/release/startup-order-x86_64-unknown-linux-gnu.order'
        run: 'cargo build -Zbuild-std=core,alloc,std,proc_macro,panic_abort --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace-frame-pointer'
      - name: Verify startup order
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno run -A tools/startup_order/verify_orderfile.ts \
            --baseline-binary target/release/deno-before-startup-order \
            --binary target/release/deno \
            --order target/release/startup-order-x86_64-unknown-linux-gnu.order \
            --output target/release/startup-order-x86_64-unknown-linux-gnu.order.verify.json
      - name: Upload startup order
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: always()
        with:
          name: startup-order-release-linux-x86_64
          path: |-
            target/release/startup-order-x86_64-unknown-linux-gnu.order
            target/release/startup-order-x86_64-unknown-linux-gnu.order.json
            target/release/startup-order-x86_64-unknown-linux-gnu.order.starts.json
            target/release/startup-order-x86_64-unknown-linux-gnu.order.verify.json
          retention-days: 7
          if-no-files-found: warn
      - name: Check release snapshot flags
        run: |-
          if strings target/release/deno | grep -F -- '--no-lazy --no-lazy-eval --no-lazy-streaming'; then
            echo "release deno binary contains eager snapshot flags"
            exit 1
          fi
      - name: 'Check eager bootstrap does not static-import node:'
        run: |-
          if grep -rEn '^import .* from "node:' runtime/js/; then
            echo "eager bootstrap statically imports a node: module — use core.createLazyLoader so it stays out of the startup snapshot"
            exit 1
          fi
      - name: Generate symcache
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno -A tools/release/create_symcache.ts ./deno.symcache
          du -h deno.symcache
          du -h target/release/deno
      - name: Pre-release (linux)
        if: github.repository == 'denoland/deno'
        run: |-
          cd target/release
          ./deno -A ../../tools/release/create_symcache.ts deno-x86_64-unknown-linux-gnu.symcache
          strip --remove-section=.eh_frame --remove-section=.eh_frame_hdr ./deno
          if readelf -SW ./deno | grep -Eq '\.eh_frame(_hdr)?'; then echo 'unwind sections remain in deno'; exit 1; fi
          if readelf -lW ./deno | grep -q GNU_EH_FRAME; then echo 'PT_GNU_EH_FRAME remains in deno'; exit 1; fi
          shasum -a 256 deno > deno-x86_64-unknown-linux-gnu.sha256sum
          zip -r deno-x86_64-unknown-linux-gnu.zip deno
          shasum -a 256 deno-x86_64-unknown-linux-gnu.zip > deno-x86_64-unknown-linux-gnu.zip.sha256sum
          strip --strip-debug --remove-section=.eh_frame --remove-section=.eh_frame_hdr ./denort
          if readelf -SW ./denort | grep -Eq '\.eh_frame(_hdr)?'; then echo 'unwind sections remain in denort'; exit 1; fi
          if readelf -lW ./denort | grep -q GNU_EH_FRAME; then echo 'PT_GNU_EH_FRAME remains in denort'; exit 1; fi
          zip -r denort-x86_64-unknown-linux-gnu.zip denort
          shasum -a 256 denort-x86_64-unknown-linux-gnu.zip > denort-x86_64-unknown-linux-gnu.zip.sha256sum
          strip --remove-section=.eh_frame --remove-section=.eh_frame_hdr ./libdenort.so
          if readelf -SW ./libdenort.so | grep -Eq '\.eh_frame(_hdr)?'; then echo 'unwind sections remain in libdenort.so'; exit 1; fi
          if readelf -lW ./libdenort.so | grep -q GNU_EH_FRAME; then echo 'PT_GNU_EH_FRAME remains in libdenort.so'; exit 1; fi
          zip -r libdenort-x86_64-unknown-linux-gnu.zip libdenort.so
          shasum -a 256 libdenort-x86_64-unknown-linux-gnu.zip > libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
          restore_v8_runtimes() {
            test ! -e denort.v8 || mv -f denort.v8 denort
            test ! -e libdenort.v8.so || mv -f libdenort.v8.so libdenort.so
          }
          trap restore_v8_runtimes EXIT
          mv denort denort.v8
          mv libdenort.so libdenort.v8.so
          (cd ../.. && cargo build --release --locked -p denort -p denort_desktop --no-default-features --features quickjs)
          strip --strip-debug ./denort
          zip -r denort-quickjs-x86_64-unknown-linux-gnu.zip denort
          shasum -a 256 denort-quickjs-x86_64-unknown-linux-gnu.zip > denort-quickjs-x86_64-unknown-linux-gnu.zip.sha256sum
          strip ./libdenort.so
          zip -r libdenort-quickjs-x86_64-unknown-linux-gnu.zip libdenort.so
          shasum -a 256 libdenort-quickjs-x86_64-unknown-linux-gnu.zip > libdenort-quickjs-x86_64-unknown-linux-gnu.zip.sha256sum
          restore_v8_runtimes
          trap - EXIT
          ./deno types > lib.deno.d.ts
      - name: Build bsdiff helper
        if: 'github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: cargo build --release -p bsdiff_helper
      - name: Generate delta patch (linux)
        if: 'github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          TARGET="x86_64-unknown-linux-gnu"
          PREV_VERSION=$(curl -sf https://dl.deno.land/release-latest.txt | tr -d "v\n") || true
          if [ -z "$PREV_VERSION" ]; then echo "No previous version found, skipping delta"; exit 0; fi
          echo "Generating delta from $PREV_VERSION for $TARGET"
          curl -fSL -o prev.zip "https://github.com/denoland/deno/releases/download/v${PREV_VERSION}/deno-${TARGET}.zip" || { echo "Previous release not found, skipping delta"; exit 0; }
          unzip -o prev.zip -d prev/
          ./target/release/bsdiff_helper prev/deno target/release/deno "target/release/deno-${TARGET}.from-${PREV_VERSION}.bsdiff"
          cd target/release && shasum -a 256 "deno-${TARGET}.from-${PREV_VERSION}.bsdiff" > "deno-${TARGET}.from-${PREV_VERSION}.bsdiff.sha256sum"
      - name: Upload canary to dl.deno.land
        if: github.repository == 'denoland/deno' && github.ref == 'refs/heads/main'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.symcache"
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
          rm canary-latest.txt
      - name: Build product size info
        if: 'github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')'
        run: |-
          du -hd1 "./target/release"
          du -ha  "./target/release/deno"
          du -ha  "./target/release/denort"
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/release/deno eval "console.log(1+2)" | grep 3
      - name: Check deno binary (in sysroot)
        run: sudo chroot /sysroot "$(pwd)/target/release/deno" --version
      - name: Upload artifact release-linux-x86_64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: release-linux-x86_64-deno
          path: target/release/deno
          retention-days: 3
      - name: Upload artifact release-linux-x86_64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: release-linux-x86_64-denort
          path: target/release/denort
          retention-days: 3
      - name: Upload artifact release-linux-x86_64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: release-linux-x86_64-test-server
          path: target/release/test_server
          retention-days: 3
      - name: Upload release to dl.deno.land (unix)
        if: 'github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.symcache"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.bsdiff"
      - name: Create release notes
        if: 'github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          export PATH=$PATH:$(pwd)/target/release
          ./tools/release/05_create_release_notes.ts
      - name: Upload release to GitHub
        uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
        if: 'github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        with:
          files: |-
            target/release/deno-x86_64-pc-windows-msvc.zip
            target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-pc-windows-msvc.sha256sum
            target/release/denort-x86_64-pc-windows-msvc.zip
            target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-x86_64-pc-windows-msvc.zip
            target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.zip
            target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.sha256sum
            target/release/denort-aarch64-pc-windows-msvc.zip
            target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-aarch64-pc-windows-msvc.zip
            target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.zip
            target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.sha256sum
            target/release/denort-x86_64-unknown-linux-gnu.zip
            target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-x86_64-unknown-linux-gnu.zip
            target/release/libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.zip
            target/release/deno-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.sha256sum
            target/release/denort-x86_64-apple-darwin.zip
            target/release/denort-x86_64-apple-darwin.zip.sha256sum
            target/release/libdenort-x86_64-apple-darwin.zip
            target/release/libdenort-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.zip
            target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.sha256sum
            target/release/denort-aarch64-unknown-linux-gnu.zip
            target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-aarch64-unknown-linux-gnu.zip
            target/release/libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.zip
            target/release/deno-aarch64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.sha256sum
            target/release/denort-aarch64-apple-darwin.zip
            target/release/denort-aarch64-apple-darwin.zip.sha256sum
            target/release/libdenort-aarch64-apple-darwin.zip
            target/release/libdenort-aarch64-apple-darwin.zip.sha256sum
            target/release/deno_src.tar.gz
            target/release/lib.deno.d.ts
            target/release/deno-*.bsdiff
            target/release/deno-*.bsdiff.sha256sum
          body_path: target/release/release-notes.md
          draft: true
          prerelease: '${{ contains(github.ref_name, ''-'') }}'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-x86_64-release-build-main-${{ github.sha }}'
  test-release-linux-x86_64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}release linux-x86_64'
    needs:
      - build-release-linux-x86_64
    runs-on: ubuntu-24.04
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-linux-x86_64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-linux-x86_64-release-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Set up incremental LTO and sysroot build
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Download artifact release-linux-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: release-linux-x86_64-deno
          path: target/release
      - name: Set target/release/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/release/deno
      - name: Download artifact release-linux-x86_64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: release-linux-x86_64-denort
          path: target/release
      - name: Set target/release/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/release/denort
      - name: Download artifact release-linux-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: release-linux-x86_64-test-server
          path: target/release
      - name: Set target/release/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/release/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build --release -p test_ffi
      - name: Test (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }} --release'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-linux-x86_64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-x86_64-release-test-${{ matrix.test_crate }}-${{ github.sha }}'
  wpt-release-linux-x86_64:
    name: wpt release linux-x86_64
    needs:
      - build-release-linux-x86_64
    runs-on: ubuntu-24.04
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Clone submodule ./tests/wpt/suite
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/wpt/suite
      - name: Restore cache wpt and autobahn test run hashes
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target/wpt_input_hash
            ./target/autobahn_input_hash
          key: never_saved
          restore-keys: 123-wpt-target-linux-x86_64-release-
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          deno-version: v2.x
      - name: Install Python
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          python-version: 3.11
      - name: Download artifact release-linux-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: release-linux-x86_64-deno
          path: target/release
      - name: Set target/release/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: chmod +x target/release/deno
      - name: Configure hosts file for WPT
        if: '!startsWith(github.ref, ''refs/tags/'')'
        working-directory: tests/wpt/suite/
        run: ./wpt make-hosts-file | sudo tee -a /etc/hosts
      - name: Run web platform tests (release)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        env:
          DENO_BIN: ./target/release/deno
        run: |-
          deno run -RWNE --allow-run --lock=tools/deno.lock.json --config tests/config/deno.json \
              ./tests/wpt/wpt.ts setup
          deno run -RWNE --allow-run --lock=tools/deno.lock.json --config tests/config/deno.json --unsafely-ignore-certificate-errors \
              ./tests/wpt/wpt.ts run --all --quiet --release --binary="$DENO_BIN" --json=wpt.json --wptreport=wptreport.json
      - name: Autobahn testsuite
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: target/release/deno run -A --config tests/config/deno.json ext/websocket/autobahn/fuzzingclient.js
      - name: Upload wpt results to dl.deno.land
        if: '!startsWith(github.ref, ''refs/tags/'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        continue-on-error: true
        run: |-
          gzip ./wptreport.json
          aws s3 cp ./wpt.json s3://dl-deno-land/wpt/$(git rev-parse HEAD).json
          aws s3 cp ./wptreport.json.gz s3://dl-deno-land/wpt/$(git rev-parse HEAD)-wptreport.json.gz
          echo $(git rev-parse HEAD) > wpt-latest.txt
          aws s3 cp wpt-latest.txt s3://dl-deno-land/wpt-latest.txt
      - name: Upload wpt results to wpt.fyi
        if: '!startsWith(github.ref, ''refs/tags/'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          WPT_FYI_USER: deno
          WPT_FYI_PW: '${{ secrets.WPT_FYI_PW }}'
          GITHUB_TOKEN: '${{ secrets.DENOBOT_PAT }}'
        continue-on-error: true
        run: |-
          ./target/release/deno run --allow-all --lock=tools/deno.lock.json \
              ./tools/upload_wptfyi.js $(git rev-parse HEAD) --ghstatus
      - name: Cache wpt and autobahn test run hashes
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target/wpt_input_hash
            ./target/autobahn_input_hash
          key: '123-wpt-target-linux-x86_64-release-${{ github.sha }}'
  build-debug-linux-x86_64:
    name: build debug linux-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-x86_64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-x86_64-debug-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Set up incremental LTO and sysroot build
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Build debug
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo build --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Check QuickJS backend (deno + denort)
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo check --locked -p deno -p denort --no-default-features --features quickjs
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/debug/deno eval "console.log(1+2)" | grep 3
      - name: Check deno binary (in sysroot)
        run: sudo chroot /sysroot "$(pwd)/target/debug/deno" --version
      - name: Upload artifact debug-linux-x86_64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-linux-x86_64-deno
          path: target/debug/deno
          retention-days: 3
      - name: Upload artifact debug-linux-x86_64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-linux-x86_64-denort
          path: target/debug/denort
          retention-days: 3
      - name: Upload artifact debug-linux-x86_64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-linux-x86_64-test-server
          path: target/debug/test_server
          retention-days: 3
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-x86_64-debug-build-main-${{ github.sha }}'
  test-debug-linux-x86_64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}debug linux-x86_64'
    needs:
      - build-debug-linux-x86_64
    runs-on: ubuntu-24.04
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-linux-x86_64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-linux-x86_64-debug-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Set up incremental LTO and sysroot build
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Download artifact debug-linux-x86_64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: debug-linux-x86_64-deno
          path: target/debug
      - name: Set target/debug/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/debug/deno
      - name: Download artifact debug-linux-x86_64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: debug-linux-x86_64-denort
          path: target/debug
      - name: Set target/debug/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/debug/denort
      - name: Download artifact debug-linux-x86_64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: debug-linux-x86_64-test-server
          path: target/debug
      - name: Set target/debug/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/debug/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Build ffi (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build -p test_ffi
      - name: Test (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }}'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-linux-x86_64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-x86_64-debug-test-${{ matrix.test_crate }}-${{ github.sha }}'
  build-libs-debug-linux-x86_64:
    name: build libs debug linux-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04
    timeout-minutes: 30
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'')'
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-x86_64-build-libs-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-x86_64-debug-build-libs-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          cache-path: ./target
      - name: Install wasm target
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: rustup target add wasm32-unknown-unknown
      - name: Cargo check (deno_resolver)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: cargo check --target wasm32-unknown-unknown -p deno_resolver && cargo check --target wasm32-unknown-unknown -p deno_resolver --features graph && cargo check --target wasm32-unknown-unknown -p deno_resolver --features graph --features deno_ast
      - name: Cargo check (deno_npm_installer)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: cargo check --target wasm32-unknown-unknown -p deno_npm_installer
      - name: Cargo check (deno_config)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          cargo check --no-default-features -p deno_config
          cargo check --no-default-features --features workspace -p deno_config
          cargo check --no-default-features --features package_json -p deno_config
          cargo check --no-default-features --features workspace --features sync -p deno_config
          cargo check --target wasm32-unknown-unknown --all-features -p deno_config
          cargo check -p deno --features=lsp-tracing
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-build-libs-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-x86_64-debug-build-libs-${{ github.sha }}'
  build-debug-linux-aarch64:
    name: build debug linux-aarch64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04-arm
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-aarch64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-aarch64-debug-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Log versions
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Build debug
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo build --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace
      - name: Check deno binary
        env:
          NO_COLOR: 1
        run: target/debug/deno eval "console.log(1+2)" | grep 3
      - name: Upload artifact debug-linux-aarch64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-linux-aarch64-deno
          path: target/debug/deno
          retention-days: 3
      - name: Upload artifact debug-linux-aarch64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-linux-aarch64-denort
          path: target/debug/denort
          retention-days: 3
      - name: Upload artifact debug-linux-aarch64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        with:
          name: debug-linux-aarch64-test-server
          path: target/debug/test_server
          retention-days: 3
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-aarch64-build-main-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-aarch64-debug-build-main-${{ github.sha }}'
  test-debug-linux-aarch64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}debug linux-aarch64'
    needs:
      - build-debug-linux-aarch64
    runs-on: ubuntu-24.04-arm
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-linux-aarch64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-linux-aarch64-debug-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Download artifact debug-linux-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: debug-linux-aarch64-deno
          path: target/debug
      - name: Set target/debug/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/debug/deno
      - name: Download artifact debug-linux-aarch64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: debug-linux-aarch64-denort
          path: target/debug
      - name: Set target/debug/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/debug/denort
      - name: Download artifact debug-linux-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: debug-linux-aarch64-test-server
          path: target/debug
      - name: Set target/debug/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/debug/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Load 'vsock_loopback; kernel module
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: sudo modprobe vsock_loopback
      - name: Build ffi (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build -p test_ffi
      - name: Test (debug)
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }}'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-linux-aarch64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-aarch64-test-${{ matrix.test_crate }}-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-aarch64-debug-test-${{ matrix.test_crate }}-${{ github.sha }}'
  test-libs-debug-linux-aarch64:
    name: test libs debug linux-aarch64
    needs:
      - build-debug-linux-aarch64
    runs-on: ubuntu-24.04-arm
    timeout-minutes: 30
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-aarch64-test-libs-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-aarch64-debug-test-libs-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'')'
      - name: Download artifact debug-linux-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: debug-linux-aarch64-deno
          path: target/debug
      - name: Set target/debug/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: chmod +x target/debug/deno
      - name: Download artifact debug-linux-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          name: debug-linux-aarch64-test-server
          path: target/debug
      - name: Set target/debug/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: chmod +x target/debug/test_server
      - name: Test libs
        if: '!startsWith(github.ref, ''refs/tags/'')'
        env:
          CARGO_PROFILE_DEV_DEBUG: 0
        run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p denort_desktop -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_cli_parser -p deno_config -p deno_crypto_provider -p deno_v8 -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_print -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-aarch64-test-libs-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-aarch64-debug-test-libs-${{ github.sha }}'
  build-release-linux-aarch64:
    name: build release linux-aarch64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || github.repository == ''denoland/deno'' && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'') || contains(github.event.pull_request.labels.*.name, ''ci-full'')) && ''ubuntu-24.04-arm64-xl'' || ''ubuntu-24.04-arm'' }}'
    environment:
      name: '${{ (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/'')) && ''build'' || '''' }}'
    timeout-minutes: 240
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          deno-version: v2.x
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-aarch64-build-main-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-aarch64-release-build-main-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
      - name: Log versions
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          echo '*** Python'
          command -v python && python --version || echo 'No python found or bad executable'
          echo '*** Rust'
          command -v rustc && rustc --version || echo 'No rustc found or bad executable'
          echo '*** Cargo'
          command -v cargo && cargo --version || echo 'No cargo found or bad executable'
          echo '*** Deno'
          command -v deno && deno --version || echo 'No deno found or bad executable'
          echo '*** Node'
          command -v node && node --version || echo 'No node found or bad executable'
          echo '*** Installed packages'
          command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'
      - name: Set up incremental LTO and sysroot build
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Configure canary build
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && !startsWith(github.ref, ''refs/tags/'')'
        run: echo "DENO_CANARY=true" >> $GITHUB_ENV
      - name: Configure frame-pointer panic traces
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          echo "RUSTC_BOOTSTRAP=1" >> "$GITHUB_ENV"
          {
            echo "RUSTFLAGS<<__DENO_RUSTFLAGS"
            echo "$RUSTFLAGS -C force-frame-pointers=yes -C force-unwind-tables=no -C link-arg=-Wl,--no-eh-frame-hdr"
            echo "__DENO_RUSTFLAGS"
          } >> "$GITHUB_ENV"
      - name: Build release
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
        run: |-
          if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = arm64 ]; then
            git submodule update --init tools/lzld
            make -C tools/lzld
            sed -i '' "s#-fuse-ld=lld #-fuse-ld=$GITHUB_WORKSPACE/tools/lzld/lzld -L$GITHUB_WORKSPACE/tools/lzld -llzld_arm64 #" .cargo/config.toml
            grep -n fuse-ld .cargo/config.toml
          fi
          df -h
          cargo build -Zbuild-std=core,alloc,std,proc_macro,panic_abort --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace-frame-pointer
          cargo build -Zbuild-std=core,alloc,std,proc_macro,panic_abort --release --locked -p denort_desktop
          df -h
      - name: Trace startup order
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: |-
          cp -p target/release/deno target/release/deno-before-startup-order
          target/release/deno run -A tools/startup_order/generate_linux_function_orderfile.ts \
            --binary $GITHUB_WORKSPACE/target/release/deno-before-startup-order \
            --output $GITHUB_WORKSPACE/target/release/startup-order-aarch64-unknown-linux-gnu.order \
            --repeats 3 \
            --workload-profile run-first
      - name: Relink release deno with startup order
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          DENO_SNAPSHOT_MINIFY_SOURCES: '1'
          DENO_USE_STARTUP_ORDER: '1'
          DENO_STARTUP_ORDER_FILE: '${{ github.workspace }}/target/release/startup-order-aarch64-unknown-linux-gnu.order'
        run: 'cargo build -Zbuild-std=core,alloc,std,proc_macro,panic_abort --release --locked -p deno -p denort -p test_server --bin deno --bin denort --bin test_server --features=deno/panic-trace-frame-pointer'
      - name: Verify startup order
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno run -A tools/startup_order/verify_orderfile.ts \
            --baseline-binary target/release/deno-before-startup-order \
            --binary target/release/deno \
            --order target/release/startup-order-aarch64-unknown-linux-gnu.order \
            --output target/release/startup-order-aarch64-unknown-linux-gnu.order.verify.json
      - name: Upload startup order
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && always()'
        with:
          name: startup-order-release-linux-aarch64
          path: |-
            target/release/startup-order-aarch64-unknown-linux-gnu.order
            target/release/startup-order-aarch64-unknown-linux-gnu.order.json
            target/release/startup-order-aarch64-unknown-linux-gnu.order.starts.json
            target/release/startup-order-aarch64-unknown-linux-gnu.order.verify.json
          retention-days: 7
          if-no-files-found: warn
      - name: Check release snapshot flags
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          if strings target/release/deno | grep -F -- '--no-lazy --no-lazy-eval --no-lazy-streaming'; then
            echo "release deno binary contains eager snapshot flags"
            exit 1
          fi
      - name: 'Check eager bootstrap does not static-import node:'
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: |-
          if grep -rEn '^import .* from "node:' runtime/js/; then
            echo "eager bootstrap statically imports a node: module — use core.createLazyLoader so it stays out of the startup snapshot"
            exit 1
          fi
      - name: Generate symcache
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: |-
          target/release/deno -A tools/release/create_symcache.ts ./deno.symcache
          du -h deno.symcache
          du -h target/release/deno
      - name: Pre-release (linux)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'''
        run: |-
          cd target/release
          ./deno -A ../../tools/release/create_symcache.ts deno-aarch64-unknown-linux-gnu.symcache
          strip --remove-section=.eh_frame --remove-section=.eh_frame_hdr ./deno
          if readelf -SW ./deno | grep -Eq '\.eh_frame(_hdr)?'; then echo 'unwind sections remain in deno'; exit 1; fi
          if readelf -lW ./deno | grep -q GNU_EH_FRAME; then echo 'PT_GNU_EH_FRAME remains in deno'; exit 1; fi
          shasum -a 256 deno > deno-aarch64-unknown-linux-gnu.sha256sum
          zip -r deno-aarch64-unknown-linux-gnu.zip deno
          shasum -a 256 deno-aarch64-unknown-linux-gnu.zip > deno-aarch64-unknown-linux-gnu.zip.sha256sum
          strip --strip-debug --remove-section=.eh_frame --remove-section=.eh_frame_hdr ./denort
          if readelf -SW ./denort | grep -Eq '\.eh_frame(_hdr)?'; then echo 'unwind sections remain in denort'; exit 1; fi
          if readelf -lW ./denort | grep -q GNU_EH_FRAME; then echo 'PT_GNU_EH_FRAME remains in denort'; exit 1; fi
          zip -r denort-aarch64-unknown-linux-gnu.zip denort
          shasum -a 256 denort-aarch64-unknown-linux-gnu.zip > denort-aarch64-unknown-linux-gnu.zip.sha256sum
          strip --remove-section=.eh_frame --remove-section=.eh_frame_hdr ./libdenort.so
          if readelf -SW ./libdenort.so | grep -Eq '\.eh_frame(_hdr)?'; then echo 'unwind sections remain in libdenort.so'; exit 1; fi
          if readelf -lW ./libdenort.so | grep -q GNU_EH_FRAME; then echo 'PT_GNU_EH_FRAME remains in libdenort.so'; exit 1; fi
          zip -r libdenort-aarch64-unknown-linux-gnu.zip libdenort.so
          shasum -a 256 libdenort-aarch64-unknown-linux-gnu.zip > libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
          restore_v8_runtimes() {
            test ! -e denort.v8 || mv -f denort.v8 denort
            test ! -e libdenort.v8.so || mv -f libdenort.v8.so libdenort.so
          }
          trap restore_v8_runtimes EXIT
          mv denort denort.v8
          mv libdenort.so libdenort.v8.so
          (cd ../.. && cargo build --release --locked -p denort -p denort_desktop --no-default-features --features quickjs)
          strip --strip-debug ./denort
          zip -r denort-quickjs-aarch64-unknown-linux-gnu.zip denort
          shasum -a 256 denort-quickjs-aarch64-unknown-linux-gnu.zip > denort-quickjs-aarch64-unknown-linux-gnu.zip.sha256sum
          strip ./libdenort.so
          zip -r libdenort-quickjs-aarch64-unknown-linux-gnu.zip libdenort.so
          shasum -a 256 libdenort-quickjs-aarch64-unknown-linux-gnu.zip > libdenort-quickjs-aarch64-unknown-linux-gnu.zip.sha256sum
          restore_v8_runtimes
          trap - EXIT
          ./deno types > lib.deno.d.ts
      - name: Build bsdiff helper
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: cargo build --release -p bsdiff_helper
      - name: Generate delta patch (linux)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          TARGET="aarch64-unknown-linux-gnu"
          PREV_VERSION=$(curl -sf https://dl.deno.land/release-latest.txt | tr -d "v\n") || true
          if [ -z "$PREV_VERSION" ]; then echo "No previous version found, skipping delta"; exit 0; fi
          echo "Generating delta from $PREV_VERSION for $TARGET"
          curl -fSL -o prev.zip "https://github.com/denoland/deno/releases/download/v${PREV_VERSION}/deno-${TARGET}.zip" || { echo "Previous release not found, skipping delta"; exit 0; }
          unzip -o prev.zip -d prev/
          ./target/release/bsdiff_helper prev/deno target/release/deno "target/release/deno-${TARGET}.from-${PREV_VERSION}.bsdiff"
          cd target/release && shasum -a 256 "deno-${TARGET}.from-${PREV_VERSION}.bsdiff" > "deno-${TARGET}.from-${PREV_VERSION}.bsdiff.sha256sum"
      - name: Upload canary to dl.deno.land
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && github.ref == ''refs/heads/main'''
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/canary/$(git rev-parse HEAD)/ --exclude "*" --include "*.symcache"
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
          rm canary-latest.txt
      - name: Build product size info
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (github.ref == ''refs/heads/main'' || startsWith(github.ref, ''refs/tags/''))'
        run: |-
          du -hd1 "./target/release"
          du -ha  "./target/release/deno"
          du -ha  "./target/release/denort"
      - name: Check deno binary
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        env:
          NO_COLOR: 1
        run: target/release/deno eval "console.log(1+2)" | grep 3
      - name: Check deno binary (in sysroot)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        run: sudo chroot /sysroot "$(pwd)/target/release/deno" --version
      - name: Upload artifact release-linux-aarch64-deno
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-linux-aarch64-deno
          path: target/release/deno
          retention-days: 3
      - name: Upload artifact release-linux-aarch64-denort
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-linux-aarch64-denort
          path: target/release/denort
          retention-days: 3
      - name: Upload artifact release-linux-aarch64-test-server
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'')'
        with:
          name: release-linux-aarch64-test-server
          path: target/release/test_server
          retention-days: 3
      - name: Upload release to dl.deno.land (unix)
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.zip"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.sha256sum"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.symcache"
          aws s3 sync ./target/release/ s3://dl-deno-land/release/${GITHUB_REF#refs/*/}/ --exclude "*" --include "*.bsdiff"
      - name: Create release notes
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        run: |-
          export PATH=$PATH:$(pwd)/target/release
          ./tools/release/05_create_release_notes.ts
      - name: Upload release to GitHub
        uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
        if: '!(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.repository == ''denoland/deno'' && startsWith(github.ref, ''refs/tags/'')'
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        with:
          files: |-
            target/release/deno-x86_64-pc-windows-msvc.zip
            target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-pc-windows-msvc.sha256sum
            target/release/denort-x86_64-pc-windows-msvc.zip
            target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-x86_64-pc-windows-msvc.zip
            target/release/libdenort-x86_64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.zip
            target/release/deno-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-aarch64-pc-windows-msvc.sha256sum
            target/release/denort-aarch64-pc-windows-msvc.zip
            target/release/denort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/libdenort-aarch64-pc-windows-msvc.zip
            target/release/libdenort-aarch64-pc-windows-msvc.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.zip
            target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-unknown-linux-gnu.sha256sum
            target/release/denort-x86_64-unknown-linux-gnu.zip
            target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-x86_64-unknown-linux-gnu.zip
            target/release/libdenort-x86_64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.zip
            target/release/deno-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-x86_64-apple-darwin.sha256sum
            target/release/denort-x86_64-apple-darwin.zip
            target/release/denort-x86_64-apple-darwin.zip.sha256sum
            target/release/libdenort-x86_64-apple-darwin.zip
            target/release/libdenort-x86_64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.zip
            target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-unknown-linux-gnu.sha256sum
            target/release/denort-aarch64-unknown-linux-gnu.zip
            target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/libdenort-aarch64-unknown-linux-gnu.zip
            target/release/libdenort-aarch64-unknown-linux-gnu.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.zip
            target/release/deno-aarch64-apple-darwin.zip.sha256sum
            target/release/deno-aarch64-apple-darwin.sha256sum
            target/release/denort-aarch64-apple-darwin.zip
            target/release/denort-aarch64-apple-darwin.zip.sha256sum
            target/release/libdenort-aarch64-apple-darwin.zip
            target/release/libdenort-aarch64-apple-darwin.zip.sha256sum
            target/release/deno_src.tar.gz
            target/release/lib.deno.d.ts
            target/release/deno-*.bsdiff
            target/release/deno-*.bsdiff.sha256sum
          body_path: target/release/release-notes.md
          draft: true
          prerelease: '${{ contains(github.ref_name, ''-'') }}'
  test-release-linux-aarch64:
    name: 'test ${{ matrix.test_crate }} ${{ matrix.shard_label }}release linux-aarch64'
    needs:
      - build-release-linux-aarch64
    runs-on: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'' && ''ubuntu-24.04'' || ''ubuntu-24.04-arm'' }}'
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - test_crate: integration
            test_package: integration_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: integration
            test_package: integration_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '0'
            shard_total: '3'
            shard_label: '(1/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '1'
            shard_total: '3'
            shard_label: '(2/3) '
          - test_crate: node_compat
            test_package: node_compat_tests
            shard_index: '2'
            shard_total: '3'
            shard_label: '(3/3) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '0'
            shard_total: '2'
            shard_label: '(1/2) '
          - test_crate: specs
            test_package: specs_tests
            shard_index: '1'
            shard_total: '2'
            shard_label: '(2/2) '
          - test_crate: unit
            test_package: unit_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
          - test_crate: unit_node
            test_package: unit_node_tests
            shard_index: '0'
            shard_total: '1'
            shard_label: ''
      fail-fast: false
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/node_compat/runner/suite
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''node_compat'''
        run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
      - name: Clone submodule ./tests/util/std
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-linux-aarch64-test-${{ matrix.test_crate }}-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-linux-aarch64-release-test-${{ matrix.test_crate }}-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          cache-path: ./target
      - name: Install Node
        uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          node-version: 22
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
      - name: Set up incremental LTO and sysroot build
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Download artifact release-linux-aarch64-deno
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          name: release-linux-aarch64-deno
          path: target/release
      - name: Set target/release/deno permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: chmod +x target/release/deno
      - name: Download artifact release-linux-aarch64-denort
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        with:
          name: release-linux-aarch64-denort
          path: target/release
      - name: Set target/release/denort permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'')'
        run: chmod +x target/release/denort
      - name: Download artifact release-linux-aarch64-test-server
        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        with:
          name: release-linux-aarch64-test-server
          path: target/release
      - name: Set target/release/test_server permissions
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && (matrix.test_crate == ''integration'' || matrix.test_crate == ''specs'' || matrix.test_crate == ''unit'' || matrix.test_crate == ''unit_node'')'
        run: chmod +x target/release/test_server
      - name: Set up playwright cache
        uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        with:
          path: ./.ms-playwright
          key: 'playwright-${{ runner.os }}-${{ runner.arch }}'
      - name: Load 'vsock_loopback; kernel module
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        run: sudo modprobe vsock_loopback
      - name: Build ffi (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && matrix.test_crate == ''specs'''
        run: cargo build --release -p test_ffi
      - name: Test (release)
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'')'
        env:
          CI_SHARD_INDEX: '${{ github.event_name == ''pull_request'' && matrix.shard_index || '''' }}'
          CI_SHARD_TOTAL: '${{ github.event_name == ''pull_request'' && matrix.shard_total || '''' }}'
        run: 'cargo test -p ${{ matrix.test_package }} --test ${{ matrix.test_crate }} --release'
      - name: Ensure no git changes
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
        run: |-
          if [[ -n "$(git status --porcelain)" ]]; then
          echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."
          echo ""
          echo "📋 Status:"
          git status
          echo ""
          exit 1
          fi
      - name: Upload test results
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
        with:
          name: 'test-results-linux-aarch64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
          path: 'target/test_results_${{ matrix.test_crate }}.json'
  lint:
    name: 'lint ${{ matrix.profile }} ${{ matrix.os }}-${{ matrix.arch }}'
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true'
    runs-on: '${{ matrix.runner }}'
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
          - os: linux
            arch: x86_64
            runner: ubuntu-24.04
            profile: debug
            job: lint
          - os: macos
            arch: x86_64
            runner: macos-15-intel
            profile: debug
            job: lint
          - os: windows
            arch: x86_64
            runner: windows-2022
            profile: debug
            job: lint
    steps:
      - name: Configure git
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 5
          submodules: false
      - name: Clone submodule ./tests/util/std
        run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: '123-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-lint-'
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: '123-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-lint-'
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        with:
          deno-version: v2.x
      - name: test_format.js
        if: matrix.os == 'linux'
        run: deno run --allow-write --allow-read --allow-run --allow-net ./tools/format.js --check
      - name: jsdoc_checker.js
        if: matrix.os == 'linux'
        run: deno run --allow-read --allow-env --allow-sys ./tools/jsdoc_checker.js
      - name: lint.js
        env:
          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
        run: deno run --allow-write --allow-read --allow-run --allow-net --allow-env ./tools/lint.js
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-lint-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: 'github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-lint-${{ github.sha }}'
  deno-core-test:
    name: deno_core test linux-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.skip_deno_core_test != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Free disk space
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/share/boost "$AGENT_TOOLSDIRECTORY" || true
          df -h
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Restore cache cargo home
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: never_saved
          restore-keys: 123-cargo-home-linux-x86_64-deno-core-test-
      - name: Restore cache build output
        uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref != ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: never_saved
          restore-keys: 123-cargo-target-linux-x86_64-release-deno-core-test-
      - name: Apply and update mtime cache
        uses: ./.github/mtime_cache
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          cache-path: ./target
      - name: Pre-install rustup 1.28.2 (workaround broken 1.29.0)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        shell: bash
        run: |-
          if command -v rustup >/dev/null 2>&1; then
            if ! rustup --version 2>&1 | grep -q '1\.29\.0'; then exit 0; fi
            echo "Detected broken rustup 1.29.0, replacing with 1.28.2"
          fi
          case "${RUNNER_OS}-${RUNNER_ARCH}" in
            Linux-X64)     target=x86_64-unknown-linux-gnu; ext= ;;
            Linux-ARM64)   target=aarch64-unknown-linux-gnu; ext= ;;
            macOS-X64)     target=x86_64-apple-darwin; ext= ;;
            macOS-ARM64)   target=aarch64-apple-darwin; ext= ;;
            Windows-X64)   target=x86_64-pc-windows-msvc; ext=.exe ;;
            Windows-ARM64) target=aarch64-pc-windows-msvc; ext=.exe ;;
            *) echo "Unsupported: ${RUNNER_OS}-${RUNNER_ARCH}"; exit 1 ;;
          esac
          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
            "https://static.rust-lang.org/rustup/archive/1.28.2/${target}/rustup-init${ext}" \
            -o "rustup-init${ext}"
          chmod +x "rustup-init${ext}"
          "./rustup-init${ext}" -y --default-toolchain none --no-modify-path
          rm "rustup-init${ext}"
          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH"
      - uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
        if: '!startsWith(github.ref, ''refs/tags/'')'
      - name: Install Deno
        uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          deno-version: v2.x
      - name: Set up incremental LTO and sysroot build
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          # Setting up sysroot
          export DEBIAN_FRONTEND=noninteractive
          # Avoid running man-db triggers, which sometimes takes several minutes
          # to complete.
          sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null
          # Remove older clang before we install
          sudo apt-get -qq remove   'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'clang-19*' 'clang-20*' 'clang-21*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'llvm-17*' 'llvm-18*' 'llvm-19*' 'llvm-20*' 'llvm-21*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' 'lld-19*' 'lld-20*' 'lld-21*' > /dev/null 2> /dev/null

          # Install clang-XXX, lld-XXX, and debootstrap.
          echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" |
            sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-noble-22.list
          curl https://apt.llvm.org/llvm-snapshot.gpg.key |
            gpg --dearmor                                 |
          sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
          sudo apt-get update
          # this was unreliable sometimes, so try again if it fails
          sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22 || (echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-22 lld-22 clang-tools-22 clang-format-22 clang-tidy-22)
          # Fix alternatives
          (yes '' | sudo update-alternatives --force --all) > /dev/null 2> /dev/null || true

          clang-22 -c -o /tmp/memfd_create_shim.o tools/memfd_create_shim.c -fPIC
          clang-22 -c -o /tmp/glibc_math_shim.o tools/glibc_math_shim.c -fPIC

          echo "Decompressing sysroot..."
          wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20250207/sysroot-`uname -m`.tar.xz -O /tmp/sysroot.tar.xz
          cd /
          xzcat /tmp/sysroot.tar.xz | sudo tar -x
          sudo mount --rbind /dev /sysroot/dev
          sudo mount --rbind /sys /sysroot/sys
          sudo mount --rbind /home /sysroot/home
          sudo mount -t proc /proc /sysroot/proc
          cd

          echo "Done."

          # Configure the build environment. Both Rust and Clang will produce
          # llvm bitcode only, so we can use lld's incremental LTO support.

          # Load the sysroot's env vars
          echo "sysroot env:"
          cat /sysroot/.env
          . /sysroot/.env

          # Important notes:
          #   1. -ldl seems to be required to avoid a failure in FFI tests. This flag seems
          #      to be in the Rust default flags in the smoketest, so uncertain why we need
          #      to be explicit here.
          #   2. RUSTFLAGS and RUSTDOCFLAGS must be specified, otherwise the doctests fail
          #      to build because the object formats are not compatible.
          echo "
          CARGO_PROFILE_BENCH_INCREMENTAL=false
          CARGO_PROFILE_RELEASE_INCREMENTAL=false
          RUSTFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          RUSTDOCFLAGS<<__1
            -C linker-plugin-lto=true
            -C linker=clang-22
            -C link-arg=-fuse-ld=lld-22
            -C link-arg=-Wl,--icf=safe
            -C link-arg=-ldl
            -C link-arg=-Wl,--allow-shlib-undefined
            -C link-arg=-Wl,--thinlto-cache-dir=$(pwd)/target/release/lto-cache
            -C link-arg=-Wl,--thinlto-cache-policy,cache_size_bytes=700m
            -C link-arg=/tmp/memfd_create_shim.o
            -C link-arg=/tmp/glibc_math_shim.o
            -C link-arg=-Wl,--wrap=expf
            -C link-arg=-Wl,--wrap=powf
            -C link-arg=-Wl,--wrap=exp2f
            -C link-arg=-Wl,--wrap=log2f
            -C link-arg=-Wl,--wrap=logf
            --cfg tokio_unstable
            $RUSTFLAGS
          __1
          CC=/usr/bin/clang-22
          CFLAGS=$CFLAGS
          " > $GITHUB_ENV
      - name: Install cargo-binstall
        uses: cargo-bins/cargo-binstall@0b24824336e2b3800b0f89d9e08b2c08bfa3dcdd
        if: '!startsWith(github.ref, ''refs/tags/'')'
      - name: Install nextest
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: cargo binstall cargo-nextest --secure --locked
      - name: Cargo nextest (release)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          cargo nextest run --release \
                --features "deno_core/default deno_core/unsafe_use_unprotected_platform deno_core/v8" \
                --tests --examples \
                -p deno_core -p deno_v8 -p build-your-own-js-snapshot -p dcore -p deno_ops -p deno_ops_compile_test_runner -p serde_v8 -p deno_core_testing
      - name: Cargo nextest ops compile test runner (release)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: cargo nextest run --release -p deno_ops_compile_test_runner -p deno_v8
      - name: Cargo doc test
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: cargo test --doc --release -p deno_core -p deno_v8 -p build-your-own-js-snapshot -p deno_ops -p serde_v8 -p deno_core_testing
      - name: Run examples (regression tests)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: cargo run -p deno_core --example op2 --features v8
      - name: Cache cargo home
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ~/.cargo/.crates.toml
            ~/.cargo/.crates2.json
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: '123-cargo-home-linux-x86_64-deno-core-test-${{ github.sha }}'
      - name: Cache build output
        uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
        if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
        with:
          path: |-
            ./target
            !./target/*/gn_out
            !./target/*/gn_root
            !./target/*/*.zip
            !./target/*/*.tar.gz
          key: '123-cargo-target-linux-x86_64-release-deno-core-test-${{ github.sha }}'
  deno-core-miri:
    name: deno_core miri linux-x86_64
    needs:
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && needs.pre_build.outputs.docs_only != 'true'
    runs-on: ubuntu-24.04
    timeout-minutes: 60
    defaults:
      run:
        shell: bash
    env:
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: full
      RUST_LIB_BACKTRACE: 0
    steps:
      - name: Configure git
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          git config --global core.symlinks true
          git config --global fetch.parallel 32
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          fetch-depth: 5
          submodules: false
      - name: Install Rust (nightly)
        uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
        if: '!startsWith(github.ref, ''refs/tags/'')'
        with:
          toolchain: nightly-2025-11-12
      - name: Cargo test (miri)
        if: '!startsWith(github.ref, ''refs/tags/'')'
        run: |-
          cargo clean
          rustup component add --toolchain nightly-2025-11-12 miri
          # This somehow prints errors in CI that don't show up locally
          RUSTFLAGS=-Awarnings cargo +nightly-2025-11-12 miri test -p deno_core --features v8
  ci-status:
    name: ci status
    needs:
      - bench
      - build-debug-macos-x86_64
      - test-debug-macos-x86_64
      - build-release-macos-x86_64
      - test-release-macos-x86_64
      - build-debug-macos-aarch64
      - test-debug-macos-aarch64
      - test-libs-debug-macos-aarch64
      - build-release-macos-aarch64
      - test-release-macos-aarch64
      - build-debug-windows-x86_64
      - test-debug-windows-x86_64
      - test-libs-debug-windows-x86_64
      - build-release-windows-x86_64
      - test-release-windows-x86_64
      - build-debug-windows-aarch64
      - test-debug-windows-aarch64
      - build-release-windows-aarch64
      - test-release-windows-aarch64
      - build-release-linux-x86_64
      - test-release-linux-x86_64
      - wpt-release-linux-x86_64
      - build-debug-linux-x86_64
      - test-debug-linux-x86_64
      - build-libs-debug-linux-x86_64
      - build-debug-linux-aarch64
      - test-debug-linux-aarch64
      - test-libs-debug-linux-aarch64
      - build-release-linux-aarch64
      - test-release-linux-aarch64
      - lint
      - deno-core-test
      - deno-core-miri
      - pre_build
    if: needs.pre_build.outputs.skip_build != 'true' && always()
    runs-on: ubuntu-latest
    steps:
      - name: Ensure CI success
        run: |-
          if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
            echo 'CI failed'
            exit 1
          fi
  publish-canary:
    name: publish canary
    needs:
      - build-debug-macos-x86_64
      - build-release-macos-x86_64
      - build-debug-macos-aarch64
      - build-release-macos-aarch64
      - build-debug-windows-x86_64
      - build-release-windows-x86_64
      - build-debug-windows-aarch64
      - build-release-windows-aarch64
      - build-release-linux-x86_64
      - build-debug-linux-x86_64
      - build-debug-linux-aarch64
      - build-release-linux-aarch64
    if: github.repository == 'denoland/deno' && github.ref == 'refs/heads/main'
    runs-on: ubuntu-24.04
    steps:
      - name: Upload canary version file to dl.deno.land
        env:
          AWS_ACCESS_KEY_ID: '${{ vars.S3_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.S3_SECRET_ACCESS_KEY }}'
          AWS_ENDPOINT_URL_S3: '${{ vars.S3_ENDPOINT }}'
          AWS_DEFAULT_REGION: '${{ vars.S3_REGION }}'
        run: |-
          echo ${{ github.sha }} > canary-latest.txt
          aws s3 cp canary-latest.txt s3://dl-deno-land/canary-latest.txt

# gagen:pin Azure/artifact-signing-action@v0 = 1d365fec12862c4aa68fcac418143d73f0cea293
# gagen:pin actions/cache/restore@v4 = 0057852bfaa89a56745cba8c7296529d2fc39830
# gagen:pin actions/cache/save@v4 = 0057852bfaa89a56745cba8c7296529d2fc39830
# gagen:pin actions/cache@v5 = 668228422ae6a00e4ad889ee87cd7109ec5666a7
# gagen:pin actions/checkout@v6 = de0fac2e4500dabe0009e67214ff5f5447ce83dd
# gagen:pin actions/download-artifact@v6 = 018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
# gagen:pin actions/setup-node@v6 = 53b83947a5a98c8d113130e565377fae1a50d02f
# gagen:pin actions/setup-python@v6 = a309ff8b426b58ec0e2a45f0f869d46889d02405
# gagen:pin actions/upload-artifact@v6 = b7c566a772e6b6bfb58ed0dc250532a479d7789f
# gagen:pin azure/login@v2 = a457da9ea143d694b1b9c7c869ebb04ebe844ef5
# gagen:pin cargo-bins/cargo-binstall@main = 0b24824336e2b3800b0f89d9e08b2c08bfa3dcdd
# gagen:pin denoland/setup-deno@v2 = 667a34cdef165d8d2b2e98dde39547c9daac7282
# gagen:pin dsherret/rust-toolchain-file@v1 = 3551321aa44dd44a0393eb3b6bdfbc5d25ecf621
# gagen:pin dtolnay/rust-toolchain@master = 3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
# gagen:pin softprops/action-gh-release@v2 = 153bb8e04406b158c6c84fc1615b65b24149a1fe
