tests-fast.yml
This file
Path
.github/workflows/tests-fast.yml
240 lines · 8.3 KiB · YAML
Last changed by
[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
History of this fileTake it
[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 1–8why, one step back1name: 'Tests: fast'23on: [push, pull_request]45permissions:6 contents: read78jobs:[actions] run the fast suite on macOS and WSL tooJordan Harbandbefore adoption52a1e55
line 9why, one step back9 fast-linux:[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 10–47why, one step back10 permissions:11 contents: read1213 name: 'fast (${{ matrix.shell }}, ${{ matrix.awk }})'14 runs-on: ubuntu-latest15 defaults:16 run:17 shell: 'script -q -e -c "${{ matrix.shell }} {0}"'1819 strategy:20 fail-fast: false21 matrix:22 shell:23 - sh24 - bash25 - dash26 - zsh27 # - ksh28 awk:29 - gawk30 - mawk3132 steps:33 - name: Harden Runner34 uses: step-security/harden-runner@v235 with:36 allowed-endpoints:37 github.com:44338 registry.npmjs.org:44339 raw.githubusercontent.com:44340 nodejs.org:44341 iojs.org:44342 unofficial-builds.nodejs.org:44343 azure.archive.ubuntu.com:8044 packages.microsoft.com:44345 registry-1.docker.io:44346 auth.docker.io:44347 production.cloudflare.docker.com:443[actions] allow DockerHub's CloudFront CDN so image pulls aren't blockedJordan Harbandbefore adoptionc4d9239
line 48why, one step back48 production.cloudfront.docker.com:443[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
line 49why, one step back49 - uses: actions/checkout@v6[actions] fall back to the canonical nvmrc submodule when a fork lacks its ownJordan Harbandbefore adoption77fca77
lines 50–51why, one step back50 id: checkout51 continue-on-error: true[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 52–53why, one step back52 with:53 submodules: true[actions] fall back to the canonical nvmrc submodule when a fork lacks its ownJordan Harbandbefore adoption77fca77
lines 54–60why, one step back54 - name: 'nvmrc submodule fallback (forks without their own nvmrc)'55 if: steps.checkout.outcome == 'failure'56 shell: bash57 run: |58 git submodule set-url test/fixtures/nvmrc https://github.com/nvm-sh/nvmrc.git59 git submodule sync --recursive60 git submodule update --init --recursive[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 61–62why, one step back61 - name: Install zsh, additional shells, and awk variant62 run: |[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
line 63why, one step back63 PACKAGES="zsh ${{ matrix.awk }}"[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
line 64why, one step back64 if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
line 65why, one step back65 PACKAGES="${PACKAGES} ${{ matrix.shell }}"[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
line 66why, one step back66 fi[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
line 67why, one step back67 sh .github/scripts/apt-install.sh ${PACKAGES}[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 68–103why, one step back68 # Set the selected awk as the default69 sudo update-alternatives --set awk /usr/bin/${{ matrix.awk }}70 shell: bash71 - run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}72 - run: awk --version 2>&1 | head -1 || awk -W version 2>&1 | head -173 - run: curl --version74 - run: wget --version75 - uses: ljharb/actions/node/install@main76 name: 'npm install && version checks'77 with:78 node-version: 'lts/*'79 skip-ls-check: true80 - run: npm ls urchin81 - run: npx which urchin82 - run: env83 - name: Hide system node84 run: |85 if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi86 if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi87 if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi88 shell: bash89 - name: Run fast tests90 run: |91 URCHIN_PATH="$(npx which urchin)"92 unset NVM_CD_FLAGS NVM_BIN NVM_INC93 export NVM_DIR="${{ github.workspace }}"94 export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"95 make TERM=xterm-256color TEST_SUITE="fast" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}96 - name: Restore system node97 if: always()98 run: |99 if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi100 if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi101 if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi102 shell: bash103[actions] run the fast suite on macOS and WSL tooJordan Harbandbefore adoption52a1e55
lines 104–196why, one step back104 fast-macos:105 permissions:106 contents: read107108 # APFS is case-insensitive, and /bin/sh and /bin/bash are bash 3.2109 name: 'fast (macOS, ${{ matrix.shell }})'110 runs-on: macos-latest111112 strategy:113 fail-fast: false114 matrix:115 shell:116 - sh117 - bash118 - dash119 - zsh120121 steps:122 - uses: actions/checkout@v6123 id: checkout124 continue-on-error: true125 with:126 submodules: true127 - name: 'nvmrc submodule fallback (forks without their own nvmrc)'128 if: steps.checkout.outcome == 'failure'129 shell: bash130 run: |131 git submodule set-url test/fixtures/nvmrc https://github.com/nvm-sh/nvmrc.git132 git submodule sync --recursive133 git submodule update --init --recursive134 - run: sw_vers; uname -m; which ${{ matrix.shell }}135 - name: Ensure wget is installed136 run: command -v wget || brew install wget137 - run: wget --version138 - uses: ljharb/actions/node/install@main139 name: 'npm install && version checks'140 with:141 node-version: 'lts/*'142 skip-ls-check: true143 - run: npm ls urchin144 - name: Hide system node145 shell: bash146 run: |147 export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"148 for bin in node npm npx; do149 while found="$(command -v "${bin}")"; do150 sudo mv "${found}" "${found}.bak" || break151 echo "${found}" >> "${RUNNER_TEMP}/hidden-node"152 hash -r153 done154 done155 - name: Run fast tests156 shell: bash157 run: |158 unset NVM_CD_FLAGS NVM_BIN NVM_INC159 export NVM_DIR="${{ github.workspace }}"160 export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"161 script -q /dev/null make TERM=xterm-256color TEST_SUITE="fast" SHELL="${{ matrix.shell }}" URCHIN="${{ github.workspace }}/node_modules/.bin/urchin" test-${{ matrix.shell }} < /dev/null162 - name: Restore system node163 if: always()164 shell: bash165 run: |166 if [ -f "${RUNNER_TEMP}/hidden-node" ]; then167 while IFS= read -r found; do sudo mv "${found}.bak" "${found}"; done < "${RUNNER_TEMP}/hidden-node"168 fi169170 fast-windows:171 permissions:172 contents: read173174 # GitHub's Windows runners provide WSL1175 name: 'fast (WSL ${{ matrix.wsl-distrib }}, ${{ matrix.shell }})'176 runs-on: windows-latest177 defaults:178 run:179 shell: wsl-bash {0}180181 strategy:182 fail-fast: false183 matrix:184 wsl-distrib:185 - Ubuntu-24.04186 shell:187 - sh188 - bash189 - dash190 - zsh191192 steps:193 - uses: actions/checkout@v6194 - uses: Vampire/setup-wsl@v7195 with:196 distribution: ${{ matrix.wsl-distrib }}[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
lines 197–201why, one step back197 - name: Install packages with retries198 # the Windows checkout has CRLF line endings199 run: |200 tr -d '\r' < "$(wslpath "${{ github.workspace }}")/.github/scripts/apt-install.sh" > /tmp/apt-install.sh201 sh /tmp/apt-install.sh git make zsh dash sudo curl wget ca-certificates nodejs npm[actions] run the fast suite on macOS and WSL tooJordan Harbandbefore adoption52a1e55
lines 202–232why, one step back202 - name: 'Clone into the WSL filesystem as a non-root user'203 # the Windows checkout shows every file as executable, which urchin would run as tests204 run: |205 set -ex206 useradd -m tester207 echo 'tester ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/tester208 chmod 0440 /etc/sudoers.d/tester209 su tester -c '210 set -ex211 git config --global --add safe.directory "*"212 git clone "$(wslpath "${{ github.workspace }}")" ~/nvm213 cd ~/nvm214 git submodule set-url test/fixtures/nvmrc https://github.com/nvm-sh/nvmrc.git215 git submodule update --init --recursive216 npm install217 npm ls urchin218 '219 - name: Hide system node220 run: |221 for bin in node npm npx; do222 if [ -e "/usr/bin/${bin}" ]; then mv "/usr/bin/${bin}" "/usr/bin/${bin}.bak"; fi223 done224 - name: Run fast tests225 run: |226 su tester -c '227 cd ~/nvm228 unset NVM_CD_FLAGS NVM_BIN NVM_INC229 export NVM_DIR="${HOME}/nvm" GITHUB_ACTIONS=true TERM=xterm-256color230 script -q -e -c "make TEST_SUITE=fast SHELL=${{ matrix.shell }} URCHIN=${HOME}/nvm/node_modules/.bin/urchin test-${{ matrix.shell }}" /dev/null231 '232[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 233–236why, one step back233 all:234 permissions:235 contents: none236 name: 'all fast tests'[actions] run the fast suite on macOS and WSL tooJordan Harbandbefore adoption52a1e55
line 237why, one step back237 needs: [fast-linux, fast-macos, fast-windows][actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 238–240why, one step back238 runs-on: ubuntu-latest239 steps:240 - run: true