Skip to content
Myr

[actions] migrate Travis CI tests to GitHub Actions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 35212c1 · Browse files · 8 files+444 added−97 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+444 added−97 removed

  • tests:+8 added−1 removed
  • other:+436 added−96 removed

8 files+444 added−97 removed

added:.github/workflows/tests-fast.yml+101 added
1name: 'Tests: fast'23on: [push, pull_request]45permissions:6 contents: read78jobs:9 fast:10 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:44348 - uses: actions/checkout@v649 with:50 submodules: true51 - name: Install zsh, additional shells, and awk variant52 run: |53 sudo apt-get update54 sudo apt-get install -y zsh ${{ matrix.awk }}55 if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then56 sudo apt-get install -y ${{ matrix.shell }}57 fi58 # Set the selected awk as the default59 sudo update-alternatives --set awk /usr/bin/${{ matrix.awk }}60 shell: bash61 - run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}62 - run: awk --version 2>&1 | head -1 || awk -W version 2>&1 | head -163 - run: curl --version64 - run: wget --version65 - uses: ljharb/actions/node/install@main66 name: 'npm install && version checks'67 with:68 node-version: 'lts/*'69 skip-ls-check: true70 - run: npm ls urchin71 - run: npx which urchin72 - run: env73 - name: Hide system node74 run: |75 if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi76 if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi77 if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi78 shell: bash79 - name: Run fast tests80 run: |81 URCHIN_PATH="$(npx which urchin)"82 unset NVM_CD_FLAGS NVM_BIN NVM_INC83 export NVM_DIR="${{ github.workspace }}"84 export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"85 make TERM=xterm-256color TEST_SUITE="fast" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}86 - name: Restore system node87 if: always()88 run: |89 if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi90 if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi91 if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi92 shell: bash9394 all:95 permissions:96 contents: none97 name: 'all fast tests'98 needs: [fast]99 runs-on: ubuntu-latest100 steps:101 - run: true
added:.github/workflows/tests-installation-iojs.yml+99 added
1name: 'Tests: installation_iojs'23on: [push, pull_request]45permissions:6 contents: read78jobs:9 installation_iojs_without_curl:10 permissions:11 contents: read1213 name: 'installation_iojs without curl (${{ matrix.shell }})'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 # - ksh2829 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 - uses: actions/checkout@v642 with:43 submodules: true44 - name: Install zsh and additional shells45 run: |46 sudo apt-get update47 sudo apt-get install -y zsh48 if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then49 sudo apt-get install -y ${{ matrix.shell }}50 fi51 shell: bash52 - run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}53 - run: wget --version54 - uses: ljharb/actions/node/install@main55 name: 'npm install && version checks'56 with:57 node-version: 'lts/*'58 skip-ls-check: true59 - run: npm ls urchin60 - run: npx which urchin61 - name: Remove curl62 run: sudo apt-get remove curl -y63 shell: bash64 - run: '! command -v curl'65 shell: bash66 - run: env67 - name: Hide system node68 run: |69 if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi70 if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi71 if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi72 shell: bash73 - name: Run installation_iojs tests74 run: |75 URCHIN_PATH="$(npx which urchin)"76 unset NVM_CD_FLAGS NVM_BIN NVM_INC77 export NVM_DIR="${{ github.workspace }}"78 export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"79 make TERM=xterm-256color TEST_SUITE="installation_iojs" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}80 - name: Restore system node81 if: always()82 run: |83 if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi84 if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi85 if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi86 shell: bash87 - name: Restore curl88 if: always()89 run: sudo apt-get install curl -y90 shell: bash9192 all:93 permissions:94 contents: none95 name: 'all installation_iojs tests'96 needs: [installation_iojs_without_curl]97 runs-on: ubuntu-latest98 steps:99 - run: true
added:.github/workflows/tests-installation-node.yml+122 added
1name: '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:44344 registry-1.docker.io:44345 auth.docker.io:44346 - uses: actions/checkout@v647 with:48 submodules: true49 - uses: ljharb/actions/node/install@main50 name: 'npm install && version checks'51 with:52 node-version: 'lts/*'53 skip-ls-check: true54 - run: npm ls urchin55 - run: npx which urchin56 - name: Run installation_node tests in container57 run: |58 docker run --rm \59 -v "${{ github.workspace }}:/workspace" \60 -w /workspace \61 -e "TEST_SHELL=${{ matrix.shell }}" \62 -e "TERM=xterm-256color" \63 -e "DEBIAN_FRONTEND=noninteractive" \64 -e "GITHUB_ACTIONS=true" \65 -e "WITHOUT_CURL=${{ matrix.without_curl }}" \66 ubuntu:16.04 \67 bash -c '68 set -ex6970 # Retry apt-get update up to 5 times due to flaky Ubuntu mirrors71 # apt-get update can return 0 even with partial failures, so check for warnings72 for i in 1 2 3 4 5; do73 if apt-get update 2>&1 | tee /tmp/apt-update.log | grep -qE "^(W:|E:|Err:)"; then74 echo "apt-get update had warnings/errors, attempt $i/5"75 cat /tmp/apt-update.log76 sleep $((i * 5))77 else78 break79 fi80 done8182 apt-get install -y git curl wget make build-essential python zsh libssl-dev83 if [ "$TEST_SHELL" != "sh" ] && [ "$TEST_SHELL" != "bash" ]; then84 apt-get install -y $TEST_SHELL || true85 fi8687 # Use nvm to install Node.js for running urchin88 # Node 16 is the last version supporting GLIBC 2.23 (Ubuntu 16.04)89 export NVM_DIR="/workspace"90 . /workspace/nvm.sh91 nvm install 1692 nvm use 169394 npm ls urchin95 URCHIN_PATH="$(npx which urchin)"9697 # Remove curl if testing without it98 if [ "$WITHOUT_CURL" = "true" ]; then99 apt-get remove curl -y100 ! command -v curl101 fi102103 # Now clean up nvm state for the actual tests, but keep NVM_DIR set104 nvm deactivate || true105 nvm unalias default || true106 unset NVM_CD_FLAGS NVM_BIN NVM_INC107 export PATH="$(echo "$PATH" | tr ":" "\n" | grep -v "\.nvm" | grep -v "toolcache" | tr "\n" ":")"108109 # Clean any cached files from the nvm install above110 rm -rf "$NVM_DIR/.cache" "$NVM_DIR/versions" "$NVM_DIR/alias"111112 make TEST_SUITE="installation_node" SHELL="$TEST_SHELL" URCHIN="$URCHIN_PATH" test-$TEST_SHELL113 '114115 all:116 permissions:117 contents: none118 name: 'all installation_node tests'119 needs: [installation_node]120 runs-on: ubuntu-latest121 steps:122 - run: true
added:.github/workflows/tests-xenial.yml+112 added
1name: 'Tests: xenial'23on: [push, pull_request]45permissions:6 contents: read78jobs:9 xenial:10 permissions:11 contents: read1213 name: 'xenial (${{ matrix.shell }})'14 runs-on: ubuntu-latest1516 strategy:17 fail-fast: false18 matrix:19 shell:20 - sh21 - bash22 - dash23 - zsh24 # - ksh2526 steps:27 - name: Harden Runner28 uses: step-security/harden-runner@v229 with:30 allowed-endpoints:31 github.com:44332 registry.npmjs.org:44333 raw.githubusercontent.com:44334 nodejs.org:44335 iojs.org:44336 azure.archive.ubuntu.com:8037 packages.microsoft.com:44338 archive.ubuntu.com:8039 security.ubuntu.com:8040 production.cloudflare.docker.com:44341 registry-1.docker.io:44342 auth.docker.io:44343 - uses: actions/checkout@v644 with:45 submodules: true46 - uses: ljharb/actions/node/install@main47 name: 'npm install && version checks'48 with:49 node-version: 'lts/*'50 skip-ls-check: true51 - run: npm ls urchin52 - run: npx which urchin53 - name: Run xenial tests in container54 run: |55 docker run --rm \56 -v "${{ github.workspace }}:/workspace" \57 -w /workspace \58 -e "TEST_SHELL=${{ matrix.shell }}" \59 -e "TERM=xterm-256color" \60 -e "DEBIAN_FRONTEND=noninteractive" \61 -e "GITHUB_ACTIONS=true" \62 ubuntu:16.04 \63 bash -c '64 set -ex6566 # Retry apt-get update up to 5 times due to flaky Ubuntu mirrors67 # apt-get update can return 0 even with partial failures, so check for warnings68 for i in 1 2 3 4 5; do69 if apt-get update 2>&1 | tee /tmp/apt-update.log | grep -qE "^(W:|E:|Err:)"; then70 echo "apt-get update had warnings/errors, attempt $i/5"71 cat /tmp/apt-update.log72 sleep $((i * 5))73 else74 break75 fi76 done7778 apt-get install -y git curl wget make build-essential python zsh libssl-dev79 if [ "$TEST_SHELL" != "sh" ] && [ "$TEST_SHELL" != "bash" ]; then80 apt-get install -y $TEST_SHELL || true81 fi8283 # Use nvm to install Node.js for running urchin84 # Node 16 is the last version supporting GLIBC 2.23 (Ubuntu 16.04)85 export NVM_DIR="/workspace"86 . /workspace/nvm.sh87 nvm install 1688 nvm use 168990 npm ls urchin91 URCHIN_PATH="$(npx which urchin)"9293 # Now clean up nvm state for the actual tests, but keep NVM_DIR set94 nvm deactivate || true95 nvm unalias default || true96 unset NVM_CD_FLAGS NVM_BIN NVM_INC97 export PATH="$(echo "$PATH" | tr ":" "\n" | grep -v "\.nvm" | grep -v "toolcache" | tr "\n" ":")"9899 # Clean any cached files from the nvm install above100 rm -rf "$NVM_DIR/.cache" "$NVM_DIR/versions" "$NVM_DIR/alias"101102 make TEST_SUITE="xenial" SHELL="$TEST_SHELL" URCHIN="$URCHIN_PATH" test-$TEST_SHELL103 '104105 all:106 permissions:107 contents: none108 name: 'all xenial tests'109 needs: [xenial]110 runs-on: ubuntu-latest111 steps:112 - run: true
modified:test/fast/Unit tests/nvm_stdout_is_terminal+1 added-1 removed
23 unmodified lines
24! nvm_stdout_is_terminal >/dev/null || die 'nvm_stdout_is_terminal should be false when stdout goes to /dev/null'25! nvm_stdout_is_terminal >"$tempfile" || die 'nvm_stdout_is_terminal should be false when stdout goes to a file'26[ "$(nvm_stdout_is_terminal; echo $?)" = "1" ] || die 'nvm_stdout_is_terminal should be false in command substitution'2728# also test the 'true' case while running on travis-ci or similar environments28# also test the 'true' case while running on CI or similar environments29nvm_stdout_is_terminal >/dev/tty || die 'nvm_stdout_is_terminal should be true when stdout goes to /dev/tty'30nvm_stdout_is_terminal >/dev/tty 2>/dev/null || die 'nvm_stdout_is_terminal should be true when stdout goes to /dev/tty and stderr is redirected'31nvm_stdout_is_terminal >/dev/tty </dev/null || die 'nvm_stdout_is_terminal should be true when stdout goes to /dev/tty and stdin is redirected'32
1 unmodified line
modified:test/installation_node/install from binary with binary flag set+7 added
41 unmodified lines
42 >&2 echo 'source intentionally failed'43 return 144}4546# Override nvm_get_make_jobs to produce predictable output regardless of actual CPU count47nvm_get_make_jobs() {48 NVM_MAKE_JOBS=149 nvm_echo "Detected that you have 2 CPU core(s)"50 nvm_echo 'Number of CPU core(s) less than or equal to 2, running in single-threaded mode'51}5253# binary fails, falls back to source if -b is not set54OUTPUT="$(nvm install 9.0.0 2>&1)"55EXPECTED_OUTPUT="binary failed56Detected that you have 2 CPU core(s)
4 unmodified lines
deleted:.travis.yml-94 removed
1language: generic2dist: focal3addons:4 apt:5 packages:6 - zsh7 # - ksh8 # - gcc-4.89 # - g++-4.81011# https://gist.github.com/iedemam/983004512git:13 submodules: false1415cache:16 ccache: true17 directories:18 - $TRAVIS_BUILD_DIR/.cache19 - $TRAVIS_BUILD_DIR/node_modules20before_install:21 - sudo sed -i 's/mozilla\/DST_Root_CA_X3.crt/!mozilla\/DST_Root_CA_X3.crt/g' /etc/ca-certificates.conf22 - sudo update-ca-certificates -f2324 # https://gist.github.com/iedemam/983004525 - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules26 - git submodule update --init --recursive2728 - $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL29 - curl --version30 - wget --version31 - bash --version | head32 - zsh --version33 - dpkg -s dash | grep ^Version | awk '{print $2}'34 # install python35 - pyenv local 2.7.18 || pyenv install 2.7.1836 - pyenv local 2.7.18 || echo 'pyenv failed'37 - python -V38install:39 - if [ -z "${SHELLCHECK-}" ]; then nvm install 16 && nvm unalias default && npm install && npm prune && npm ls urchin doctoc eclint dockerfile_lint; fi40 - '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'41script:42 - if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ] || [ "${TEST_SUITE}" = 'xenial' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi43before_cache:44 - if [ -n "$WITHOUT_CURL" ]; then sudo apt-get install curl -y ; fi45jobs:46 include:47 - env: SHELL=bash TEST_SUITE=installation_node48 dist: xenial49 - env: SHELL=bash TEST_SUITE=installation_node WITHOUT_CURL=150 dist: xenial51 - env: SHELL=sh TEST_SUITE=installation_node52 dist: xenial53 - env: SHELL=sh TEST_SUITE=installation_node WITHOUT_CURL=154 dist: xenial55 - env: SHELL=dash TEST_SUITE=installation_node56 dist: xenial57 - env: SHELL=dash TEST_SUITE=installation_node WITHOUT_CURL=158 dist: xenial59 - env: SHELL=zsh TEST_SUITE=installation_node60 dist: xenial61 - env: SHELL=zsh TEST_SUITE=installation_node WITHOUT_CURL=162 dist: xenial63 #- env: SHELL=ksh TEST_SUITE=installation_node64 # dist: xenial65 #- env: SHELL=ksh TEST_SUITE=installation_node WITHOUT_CURL=166 # dist: xenial67 - env: SHELL=bash TEST_SUITE=xenial68 dist: xenial69 - env: SHELL=sh TEST_SUITE=xenial70 dist: xenial71 - env: SHELL=dash TEST_SUITE=xenial72 dist: xenial73 - env: SHELL=zsh TEST_SUITE=xenial74 dist: xenial75 #- env: SHELL=ksh TEST_SUITE=xenial76 # dist: xenial77env:78 global:79 - CXX=g++80 - CC=gcc81 - PATH="$(echo $PATH | sed 's/::/:/')"82 - PATH="/usr/lib/ccache/:$PATH"83 - NVM_DIR="${TRAVIS_BUILD_DIR}"84 matrix:85 - SHELL=sh TEST_SUITE=fast86 - SHELL=dash TEST_SUITE=fast87 - SHELL=bash TEST_SUITE=fast88 - SHELL=zsh TEST_SUITE=fast89 # - SHELL=ksh TEST_SUITE=fast90 - SHELL=sh TEST_SUITE=installation_iojs WITHOUT_CURL=191 - SHELL=dash TEST_SUITE=installation_iojs WITHOUT_CURL=192 - SHELL=bash TEST_SUITE=installation_iojs WITHOUT_CURL=193 - SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=194 # - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1
modified:README.md+2 added-2 removed
4 unmodified lines
5 </picture>6</a>789# Node Version Manager [![Build Status](https://app.travis-ci.com/nvm-sh/nvm.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.40.3-yellow.svg)][4] [![CII Best Practices](https://bestpractices.dev/projects/684/badge)](https://bestpractices.dev/projects/684)9# Node Version Manager [![Tests](https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml/badge.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.40.3-yellow.svg)][4] [![CII Best Practices](https://bestpractices.dev/projects/684/badge)](https://bestpractices.dev/projects/684)1011<!-- To update this table of contents, ensure you have run `npm install` then `npm run doctoc` -->12<!-- START doctoc generated TOC please keep comment here to allow auto update -->13<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1023 unmodified lines
1037To change the user directory and/or account name follow the instructions [here](https://support.apple.com/en-us/HT201548)10381039[1]: https://github.com/nvm-sh/nvm.git1040[2]: https://github.com/nvm-sh/nvm/blob/v0.40.3/install.sh1041[3]: https://app.travis-ci.com/nvm-sh/nvm1041[3]: https://github.com/nvm-sh/nvm/actions/workflows/tests-fast.yml1042[4]: https://github.com/nvm-sh/nvm/releases/tag/v0.40.31043[Urchin]: https://git.sdf.org/tlevine/urchin1044[Fish]: https://fishshell.com1045
132 unmodified lines