mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-02-05 09:22:50 +08:00
[actions] migrate Travis CI tests to GitHub Actions
Add new workflow for tests that were only running on Travis CI: - fast test suite (sh, bash, dash, zsh) - installation_iojs without curl (sh, bash, dash, zsh) - installation_node with and without curl (sh, bash, dash, zsh) - xenial test suite (sh, bash, dash, zsh) The installation_node and xenial tests run on ubuntu-20.04 to match the Travis xenial environment as closely as possible.
This commit is contained in:
95
.github/workflows/tests-fast.yml
vendored
Normal file
95
.github/workflows/tests-fast.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
name: 'Tests: fast'
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fast:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
name: 'fast (${{ matrix.shell }})'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shell:
|
||||
- sh
|
||||
- bash
|
||||
- dash
|
||||
- zsh
|
||||
# - ksh
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
registry.npmjs.org:443
|
||||
raw.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
iojs.org:443
|
||||
unofficial-builds.nodejs.org:443
|
||||
azure.archive.ubuntu.com:80
|
||||
packages.microsoft.com:443
|
||||
registry-1.docker.io:443
|
||||
auth.docker.io:443
|
||||
production.cloudflare.docker.com:443
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install zsh and additional shells
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y zsh
|
||||
if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then
|
||||
sudo apt-get install -y ${{ matrix.shell }}
|
||||
fi
|
||||
shell: bash
|
||||
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
|
||||
- run: curl --version
|
||||
- run: wget --version
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'npm install && version checks'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
skip-ls-check: true
|
||||
- run: npm ls urchin
|
||||
- run: npx which urchin
|
||||
- run: env
|
||||
- name: Hide system node
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi
|
||||
if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi
|
||||
if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi
|
||||
shell: bash
|
||||
- name: Run fast tests
|
||||
run: |
|
||||
URCHIN_PATH="$(npx which urchin)"
|
||||
unset NVM_CD_FLAGS NVM_BIN NVM_INC
|
||||
export NVM_DIR="${{ github.workspace }}"
|
||||
export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"
|
||||
make TERM=xterm-256color TEST_SUITE="fast" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}
|
||||
- name: Restore system node
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi
|
||||
if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi
|
||||
if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi
|
||||
shell: bash
|
||||
|
||||
all:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'all fast tests'
|
||||
needs: [fast]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
||||
99
.github/workflows/tests-installation-iojs.yml
vendored
Normal file
99
.github/workflows/tests-installation-iojs.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
name: 'Tests: installation_iojs'
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
installation_iojs_without_curl:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
name: 'installation_iojs without curl (${{ matrix.shell }})'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shell:
|
||||
- sh
|
||||
- bash
|
||||
- dash
|
||||
- zsh
|
||||
# - ksh
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
registry.npmjs.org:443
|
||||
raw.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
iojs.org:443
|
||||
azure.archive.ubuntu.com:80
|
||||
packages.microsoft.com:443
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install zsh and additional shells
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y zsh
|
||||
if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then
|
||||
sudo apt-get install -y ${{ matrix.shell }}
|
||||
fi
|
||||
shell: bash
|
||||
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
|
||||
- run: wget --version
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'npm install && version checks'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
skip-ls-check: true
|
||||
- run: npm ls urchin
|
||||
- run: npx which urchin
|
||||
- name: Remove curl
|
||||
run: sudo apt-get remove curl -y
|
||||
shell: bash
|
||||
- run: '! command -v curl'
|
||||
shell: bash
|
||||
- run: env
|
||||
- name: Hide system node
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi
|
||||
if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi
|
||||
if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi
|
||||
shell: bash
|
||||
- name: Run installation_iojs tests
|
||||
run: |
|
||||
URCHIN_PATH="$(npx which urchin)"
|
||||
unset NVM_CD_FLAGS NVM_BIN NVM_INC
|
||||
export NVM_DIR="${{ github.workspace }}"
|
||||
export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"
|
||||
make TERM=xterm-256color TEST_SUITE="installation_iojs" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}
|
||||
- name: Restore system node
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi
|
||||
if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi
|
||||
if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi
|
||||
shell: bash
|
||||
- name: Restore curl
|
||||
if: always()
|
||||
run: sudo apt-get install curl -y
|
||||
shell: bash
|
||||
|
||||
all:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'all installation_iojs tests'
|
||||
needs: [installation_iojs_without_curl]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
||||
107
.github/workflows/tests-installation-node.yml
vendored
Normal file
107
.github/workflows/tests-installation-node.yml
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
name: 'Tests: installation_node'
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
installation_node:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
name: "installation_node (${{ matrix.shell }}${{ matrix.without_curl && ', without curl' || '' }})"
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shell:
|
||||
- sh
|
||||
- bash
|
||||
- dash
|
||||
- zsh
|
||||
# - ksh
|
||||
without_curl:
|
||||
- false
|
||||
- true
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
registry.npmjs.org:443
|
||||
raw.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
iojs.org:443
|
||||
azure.archive.ubuntu.com:80
|
||||
packages.microsoft.com:443
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install zsh and additional shells
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y zsh
|
||||
if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then
|
||||
sudo apt-get install -y ${{ matrix.shell }}
|
||||
fi
|
||||
shell: bash
|
||||
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
|
||||
- run: curl --version
|
||||
if: ${{ !matrix.without_curl }}
|
||||
- run: wget --version
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'npm install && version checks'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
skip-ls-check: true
|
||||
- run: npm ls urchin
|
||||
- run: npx which urchin
|
||||
- name: Remove curl
|
||||
if: ${{ matrix.without_curl }}
|
||||
run: sudo apt-get remove curl -y
|
||||
shell: bash
|
||||
- name: Verify curl removed
|
||||
if: ${{ matrix.without_curl }}
|
||||
run: '! command -v curl'
|
||||
shell: bash
|
||||
- run: env
|
||||
- name: Hide system node
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi
|
||||
if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi
|
||||
if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi
|
||||
shell: bash
|
||||
- name: Run installation_node tests
|
||||
run: |
|
||||
URCHIN_PATH="$(npx which urchin)"
|
||||
unset NVM_CD_FLAGS NVM_BIN NVM_INC
|
||||
export NVM_DIR="${{ github.workspace }}"
|
||||
export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"
|
||||
make TERM=xterm-256color TEST_SUITE="installation_node" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}
|
||||
- name: Restore system node
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi
|
||||
if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi
|
||||
if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi
|
||||
shell: bash
|
||||
- name: Restore curl
|
||||
if: ${{ always() && matrix.without_curl }}
|
||||
run: sudo apt-get install curl -y
|
||||
shell: bash
|
||||
|
||||
all:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'all installation_node tests'
|
||||
needs: [installation_node]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
||||
91
.github/workflows/tests-xenial.yml
vendored
Normal file
91
.github/workflows/tests-xenial.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
name: 'Tests: xenial'
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
xenial:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
name: 'xenial (${{ matrix.shell }})'
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shell:
|
||||
- sh
|
||||
- bash
|
||||
- dash
|
||||
- zsh
|
||||
# - ksh
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
registry.npmjs.org:443
|
||||
raw.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
iojs.org:443
|
||||
azure.archive.ubuntu.com:80
|
||||
packages.microsoft.com:443
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install zsh and additional shells
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y zsh
|
||||
if [ "${{ matrix.shell }}" != "sh" ] && [ "${{ matrix.shell }}" != "bash" ] && [ "${{ matrix.shell }}" != "zsh" ]; then
|
||||
sudo apt-get install -y ${{ matrix.shell }}
|
||||
fi
|
||||
shell: bash
|
||||
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
|
||||
- run: curl --version
|
||||
- run: wget --version
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'npm install && version checks'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
skip-ls-check: true
|
||||
- run: npm ls urchin
|
||||
- run: npx which urchin
|
||||
- run: env
|
||||
- name: Hide system node
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node ]; then sudo mv /usr/local/bin/node /usr/local/bin/node.bak; fi
|
||||
if [ -f /usr/local/bin/npm ]; then sudo mv /usr/local/bin/npm /usr/local/bin/npm.bak; fi
|
||||
if [ -f /usr/local/bin/npx ]; then sudo mv /usr/local/bin/npx /usr/local/bin/npx.bak; fi
|
||||
shell: bash
|
||||
- name: Run xenial tests
|
||||
run: |
|
||||
URCHIN_PATH="$(npx which urchin)"
|
||||
unset NVM_CD_FLAGS NVM_BIN NVM_INC
|
||||
export NVM_DIR="${{ github.workspace }}"
|
||||
export PATH="$(echo "$PATH" | tr ':' '\n' | grep -v '\.nvm' | grep -v 'toolcache' | tr '\n' ':')"
|
||||
make TERM=xterm-256color TEST_SUITE="xenial" SHELL="${{ matrix.shell }}" URCHIN="$URCHIN_PATH" test-${{ matrix.shell }}
|
||||
- name: Restore system node
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /usr/local/bin/node.bak ]; then sudo mv /usr/local/bin/node.bak /usr/local/bin/node; fi
|
||||
if [ -f /usr/local/bin/npm.bak ]; then sudo mv /usr/local/bin/npm.bak /usr/local/bin/npm; fi
|
||||
if [ -f /usr/local/bin/npx.bak ]; then sudo mv /usr/local/bin/npx.bak /usr/local/bin/npx; fi
|
||||
shell: bash
|
||||
|
||||
all:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'all xenial tests'
|
||||
needs: [xenial]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
||||
Reference in New Issue
Block a user