tests-installation-node.yml
This file
Path
.github/workflows/tests-installation-node.yml
135 lines · 4.6 KiB · YAML
Last changed by
[actions] cache container images, verified against digests looked up liveJordan Harbandbefore adoption5c05fb6
History of this fileTake it
[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 1–43why, one step back1name: 'Tests: installation_node'23on: [push, pull_request]45permissions:6 contents: read78jobs:9 installation_node:10 permissions:11 contents: read1213 name: "installation_node (${{ matrix.shell }}${{ matrix.without_curl && ', without curl' || '' }})"14 runs-on: ubuntu-latest1516 strategy:17 fail-fast: false18 matrix:19 shell:20 - sh21 - bash22 - dash23 - zsh24 # - ksh25 without_curl:26 - false27 - true2829 steps:30 - name: Harden Runner31 uses: step-security/harden-runner@v232 with:33 allowed-endpoints:34 github.com:44335 registry.npmjs.org:44336 raw.githubusercontent.com:44337 nodejs.org:44338 iojs.org:44339 azure.archive.ubuntu.com:8040 packages.microsoft.com:44341 archive.ubuntu.com:8042 security.ubuntu.com:8043 production.cloudflare.docker.com:443[actions] allow DockerHub's CloudFront CDN so image pulls aren't blockedJordan Harbandbefore adoptionc4d9239
line 44why, one step back44 production.cloudfront.docker.com:443[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 45–46why, one step back45 registry-1.docker.io:44346 auth.docker.io:443[actions] pull container images through Google's Docker Hub mirrorJordan Harbandbefore adoption37be73f
line 47why, one step back47 mirror.gcr.io:443[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
line 48why, one step back48 - uses: actions/checkout@v6[actions] fall back to the canonical nvmrc submodule when a fork lacks its ownJordan Harbandbefore adoption77fca77
lines 49–50why, one step back49 id: checkout50 continue-on-error: true[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 51–52why, one step back51 with:52 submodules: true[actions] fall back to the canonical nvmrc submodule when a fork lacks its ownJordan Harbandbefore adoption77fca77
lines 53–59why, one step back53 - name: 'nvmrc submodule fallback (forks without their own nvmrc)'54 if: steps.checkout.outcome == 'failure'55 shell: bash56 run: |57 git submodule set-url test/fixtures/nvmrc https://github.com/nvm-sh/nvmrc.git58 git submodule sync --recursive59 git submodule update --init --recursive[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 60–66why, one step back60 - uses: ljharb/actions/node/install@main61 name: 'npm install && version checks'62 with:63 node-version: 'lts/*'64 skip-ls-check: true65 - run: npm ls urchin66 - run: npx which urchin[actions] cache container images, verified against digests looked up liveJordan Harbandbefore adoption5c05fb6
lines 67–80why, one step back67 # Pull through Google's Docker Hub mirror, which is not subject to Docker Hub's68 # anonymous pull rate limits, and cache the image; a cached image is only used69 # if it matches the digests the registry serves now70 - name: Resolve the ubuntu:16.04 image digests71 id: image72 run: sh .github/scripts/docker-image.sh resolve mirror.gcr.io/library/ubuntu:16.04 >> "$GITHUB_OUTPUT"73 - uses: actions/cache@v674 with:75 path: ${{ runner.temp }}/docker-image.tar76 key: docker-image-${{ runner.arch }}-${{ steps.image.outputs.key }}77 - name: Load or pull the ubuntu:16.04 image78 env:79 DIGESTS: ${{ steps.image.outputs.digests }}80 run: sh .github/scripts/docker-image.sh ensure mirror.gcr.io/library/ubuntu:16.04 "${RUNNER_TEMP}/docker-image.tar"[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 81–90why, one step back81 - name: Run installation_node tests in container82 run: |83 docker run --rm \84 -v "${{ github.workspace }}:/workspace" \85 -w /workspace \86 -e "TEST_SHELL=${{ matrix.shell }}" \87 -e "TERM=xterm-256color" \88 -e "DEBIAN_FRONTEND=noninteractive" \89 -e "GITHUB_ACTIONS=true" \90 -e "WITHOUT_CURL=${{ matrix.without_curl }}" \[actions] pull container images through Google's Docker Hub mirrorJordan Harbandbefore adoption37be73f
line 91why, one step back91 mirror.gcr.io/library/ubuntu:16.04 \[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 92–94why, one step back92 bash -c '93 set -ex94[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
line 95why, one step back95 sh /workspace/.github/scripts/apt-install.sh git curl wget make build-essential python zsh libssl-dev[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
line 96why, one step back96 if [ "$TEST_SHELL" != "sh" ] && [ "$TEST_SHELL" != "bash" ]; then[actions] retry apt package installs through Ubuntu mirror outagesJordan Harbandbefore adoption50e73c4
line 97why, one step back97 sh /workspace/.github/scripts/apt-install.sh $TEST_SHELL || true[actions] migrate Travis CI tests to GitHub ActionsJordan Harbandbefore adoption4c3edc5
lines 98–135why, one step back98 fi99100 # Use nvm to install Node.js for running urchin101 # Node 16 is the last version supporting GLIBC 2.23 (Ubuntu 16.04)102 export NVM_DIR="/workspace"103 . /workspace/nvm.sh104 nvm install 16105 nvm use 16106107 npm ls urchin108 URCHIN_PATH="$(npx which urchin)"109110 # Remove curl if testing without it111 if [ "$WITHOUT_CURL" = "true" ]; then112 apt-get remove curl -y113 ! command -v curl114 fi115116 # Now clean up nvm state for the actual tests, but keep NVM_DIR set117 nvm deactivate || true118 nvm unalias default || true119 unset NVM_CD_FLAGS NVM_BIN NVM_INC120 export PATH="$(echo "$PATH" | tr ":" "\n" | grep -v "\.nvm" | grep -v "toolcache" | tr "\n" ":")"121122 # Clean any cached files from the nvm install above123 rm -rf "$NVM_DIR/.cache" "$NVM_DIR/versions" "$NVM_DIR/alias"124125 make TEST_SUITE="installation_node" SHELL="$TEST_SHELL" URCHIN="$URCHIN_PATH" test-$TEST_SHELL126 '127128 all:129 permissions:130 contents: none131 name: 'all installation_node tests'132 needs: [installation_node]133 runs-on: ubuntu-latest134 steps:135 - run: true