mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-20 04:23:43 +00:00
Compare commits
2 Commits
554e89d5ef
...
5edfb00f1c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5edfb00f1c | ||
![]() |
c3627a2ddf |
81
.github/workflows/latest-npm.yml
vendored
81
.github/workflows/latest-npm.yml
vendored
@ -1,81 +0,0 @@
|
||||
name: 'Tests: `nvm install-latest-npm`'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
latest: ${{ steps.set-matrix.outputs.requireds }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
iojs.org:443
|
||||
nodejs.org:443
|
||||
raw.githubusercontent.com:443
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
versionsAsRoot: true
|
||||
type: majors
|
||||
preset: '>=1'
|
||||
|
||||
nodes:
|
||||
needs: [matrix]
|
||||
permissions:
|
||||
contents: read
|
||||
name: 'nvm install-latest-npm'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
|
||||
include:
|
||||
- node-version: "9.2"
|
||||
- node-version: "9.1"
|
||||
- node-version: "9.0"
|
||||
- node-version: "6.1"
|
||||
- node-version: "5.9"
|
||||
- node-version: "4.6"
|
||||
- node-version: "4.5"
|
||||
- node-version: "4.4"
|
||||
- node-version: "0.12"
|
||||
- node-version: "0.10"
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
raw.githubusercontent.com:443
|
||||
iojs.org:443
|
||||
nodejs.org:443
|
||||
registry.npmjs.org:443
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'install node'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
skip-ls-check: true
|
||||
skip-install: true
|
||||
skip-latest-npm: true
|
||||
- run: npm --version
|
||||
- run: '. ./nvm.sh ; nvm install-latest-npm'
|
||||
name: 'nvm install-latest-npm'
|
||||
- run: npm --version
|
||||
|
||||
node:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'nvm install-latest-npm'
|
||||
needs: [nodes]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
72
.github/workflows/lint.yml
vendored
72
.github/workflows/lint.yml
vendored
@ -1,72 +0,0 @@
|
||||
name: 'Tests: linting'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
eclint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
raw.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
registry.npmjs.org:443
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'nvm install ${{ matrix.node-version }} && npm install'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- run: npm run eclint
|
||||
|
||||
dockerfile_lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
ghcr.io:443
|
||||
github.com:443
|
||||
raw.githubusercontent.com:443
|
||||
pkg-containers.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
registry.npmjs.org:443
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'nvm install ${{ matrix.node-version }} && npm install'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- run: npm run dockerfile_lint
|
||||
|
||||
doctoc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
raw.githubusercontent.com:443
|
||||
nodejs.org:443
|
||||
registry.npmjs.org:443
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ljharb/actions/node/install@main
|
||||
name: 'nvm install ${{ matrix.node-version }} && npm install'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- run: npm run doctoc:check
|
||||
|
||||
test_naming:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
raw.githubusercontent.com:443
|
||||
- uses: actions/checkout@v4
|
||||
- name: check tests filenames
|
||||
run: ./rename_test.sh --check
|
98
.github/workflows/nvm-install-test.yml
vendored
Normal file
98
.github/workflows/nvm-install-test.yml
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
name: 'Tests: nvm install with set -e'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'git ref to use'
|
||||
required: false
|
||||
default: 'HEAD'
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- id: matrix
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.ref }}" ]; then
|
||||
echo "matrix=\"[\"${{ github.event.inputs.ref }}\"]\"" >> $GITHUB_OUTPUT
|
||||
else
|
||||
TAGS="$((echo "HEAD" && git tag --sort=-v:refname --merged HEAD --format='%(refname:strip=2) %(creatordate:short)' | grep '^v' | while read tag date; do
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
timestamp=$(date -j -f "%Y-%m-%d" "$date" +%s)
|
||||
threshold=$(date -j -v-4y +%s)
|
||||
else
|
||||
timestamp=$(date -d "$date" +%s)
|
||||
threshold=$(date -d "4 years ago" +%s)
|
||||
fi
|
||||
if [ $timestamp -ge $threshold ]; then echo "$tag"; fi
|
||||
done) | xargs)"
|
||||
echo $TAGS
|
||||
TAGS_JSON=$(printf "%s\n" $TAGS | jq -R . | jq -sc .)
|
||||
echo "matrix=${TAGS_JSON}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
test:
|
||||
needs: [matrix]
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.ref == 'v0.40.0' }} # https://github.com/nvm-sh/nvm/issues/3405
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ref: ${{ fromJson(needs.matrix.outputs.matrix) }}
|
||||
has-nvmrc:
|
||||
- 'no nvmrc'
|
||||
- 'nvmrc'
|
||||
shell-level:
|
||||
- 1 shlvl
|
||||
- 2 shlvls
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: resolve HEAD to sha
|
||||
run: |
|
||||
if [ '${{ matrix.ref }}' = 'HEAD' ]; then
|
||||
REF="$(git rev-parse HEAD)"
|
||||
else
|
||||
REF="${{ matrix.ref }}"
|
||||
fi
|
||||
echo "resolved ref: ${REF}"
|
||||
echo "ref="$REF"" >> $GITHUB_ENV
|
||||
- run: echo $- # which options are set
|
||||
- run: echo node > .nvmrc
|
||||
if: ${{ matrix.has-nvmrc == 'nvmrc' }}
|
||||
- run: curl -I --compressed -v https://nodejs.org/dist/
|
||||
- name: 'install nvm'
|
||||
run: |
|
||||
set -e
|
||||
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${ref}/install.sh" | bash
|
||||
- name: nvm install in 1 shell level, ${{ matrix.has-nvmrc }}
|
||||
if: ${{ matrix.shell-level == '1 shlvl' }}
|
||||
run: |
|
||||
set -e && source ~/.nvm/nvm.sh
|
||||
echo nvm.sh sourced
|
||||
nvm --version
|
||||
if [ '${{ matrix.has-nvmrc }}' == 'nvmrc' ]; then
|
||||
nvm install
|
||||
fi
|
||||
- name: nvm install in 2 shell levels, ${{ matrix.has-nvmrc }}
|
||||
if: ${{ matrix.shell-level == '2 shlvls' }}
|
||||
run: |
|
||||
if [ '${{ matrix.has-nvmrc }}' == 'nvmrc' ]; then
|
||||
bash -c "set -e && source ~/.nvm/nvm.sh && echo nvm.sh sourced && nvm --version && nvm install"
|
||||
else
|
||||
bash -c "set -e && source ~/.nvm/nvm.sh && echo nvm.sh sourced && nvm --version"
|
||||
fi
|
||||
|
||||
finisher:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test]
|
||||
steps:
|
||||
- run: true
|
26
.github/workflows/rebase.yml
vendored
26
.github/workflows/rebase.yml
vendored
@ -1,26 +0,0 @@
|
||||
name: Automatic Rebase
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
_:
|
||||
permissions:
|
||||
contents: write
|
||||
name: "Automatic Rebase"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
api.github.com:443
|
||||
github.com:443
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ljharb/rebase@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: 'Tests: release process'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
api.github.com:443
|
||||
objects.githubusercontent.com:443
|
||||
raw.githubusercontent.com:443
|
||||
registry.npmjs.org:443
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "14"
|
||||
- run: npm install
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
git fetch --unshallow --tags -f || git fetch --tags -f
|
||||
- name: Attempt `make release` process
|
||||
run: echo proceed | make TAG=99.99.99 release
|
||||
env:
|
||||
GIT_EDITOR: "sed -i '1 s/^/99.99.99 make release test/'"
|
||||
- name: Ensure tag is created
|
||||
run: git tag | grep v99.99.99
|
24
.github/workflows/require-allow-edits.yml
vendored
24
.github/workflows/require-allow-edits.yml
vendored
@ -1,24 +0,0 @@
|
||||
name: Require “Allow Edits”
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
_:
|
||||
permissions:
|
||||
pull-requests: read
|
||||
name: "Require “Allow Edits”"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
api.github.com:443
|
||||
- uses: ljharb/require-allow-edits@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
56
.github/workflows/shellcheck.yml
vendored
56
.github/workflows/shellcheck.yml
vendored
@ -1,56 +0,0 @@
|
||||
name: 'Tests: shellcheck'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
shellcheck_matrix:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shell:
|
||||
- bash
|
||||
- sh
|
||||
- dash
|
||||
- ksh
|
||||
file:
|
||||
- nvm.sh
|
||||
include:
|
||||
- shell: bash
|
||||
file: install.sh # only supported on bash
|
||||
- shell: bash
|
||||
file: bash_completion # only needed in bash/zsh
|
||||
- shell: bash
|
||||
file: nvm-exec # only runs in bash
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
ghcr.io:443
|
||||
github.com:443
|
||||
pkg-containers.githubusercontent.com:443
|
||||
formulae.brew.sh:443
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Homebrew
|
||||
uses: Homebrew/actions/setup-homebrew@master
|
||||
- name: Install latest shellcheck
|
||||
run: brew install shellcheck
|
||||
env:
|
||||
HOMEBREW_NO_ANALYTICS: 1
|
||||
- run: which shellcheck
|
||||
- run: shellcheck --version
|
||||
- name: Run shellcheck on ${{ matrix.file }}
|
||||
run: shellcheck -s ${{ matrix.shell }} ${{ matrix.file }}
|
||||
|
||||
shellcheck:
|
||||
permissions:
|
||||
contents: none
|
||||
needs: [shellcheck_matrix]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
61
.github/workflows/tests.yml
vendored
61
.github/workflows/tests.yml
vendored
@ -1,61 +0,0 @@
|
||||
name: urchin tests
|
||||
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
name: "tests"
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: 'script -q -e -c "${{ matrix.shell }} {0}"'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- shell: bash
|
||||
suite: install_script
|
||||
# shell:
|
||||
# - bash
|
||||
# suite:
|
||||
# - install_script
|
||||
|
||||
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
|
||||
- uses: actions/checkout@v4
|
||||
- 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/run@main
|
||||
name: 'npm install && version checks'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
skip-ls-check: true
|
||||
shell-command: echo installed
|
||||
- run: npm ls urchin
|
||||
- run: env
|
||||
- run: make TERM=xterm-256color TEST_SUITE="${{ matrix.suite }}" SHELL="${{ matrix.shell }}" URCHIN="$(npx which urchin)" test-${{ matrix.shell }}
|
||||
|
||||
nvm:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'all test suites, all shells'
|
||||
needs: [tests]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
40
.github/workflows/toc.yml
vendored
40
.github/workflows/toc.yml
vendored
@ -1,40 +0,0 @@
|
||||
name: update readme TOC
|
||||
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
_:
|
||||
permissions:
|
||||
contents: write
|
||||
name: "update readme TOC"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@v2
|
||||
with:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
registry.npmjs.org:443
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# https://github.com/actions/checkout/issues/217#issue-599945005
|
||||
# pulls all commits (needed for lerna / semantic release to correctly version)
|
||||
fetch-depth: "0"
|
||||
|
||||
# pulls all tags (needed for lerna / semantic release to correctly version)
|
||||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: npm install
|
||||
- run: npm run doctoc
|
||||
- name: commit changes
|
||||
uses: ljharb/actions-js-build/commit@v3+amendpush
|
||||
with:
|
||||
amend: true
|
||||
force: true
|
193
.github/workflows/windows-npm.yml
vendored
193
.github/workflows/windows-npm.yml
vendored
@ -1,193 +0,0 @@
|
||||
name: 'Tests on Windows: `nvm install`'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NVM_INSTALL_GITHUB_REPO: ${{ github.repository }}
|
||||
NVM_INSTALL_VERSION: ${{ github.sha }}
|
||||
|
||||
jobs:
|
||||
msys_fail_install:
|
||||
# Default installation does not work due to npm_config_prefix set to C:\npm\prefix
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'MSYS fail prefix nvm install'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Retrieve nvm
|
||||
shell: bash
|
||||
run: |
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD=script bash
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
! nvm install --lts
|
||||
|
||||
msys_matrix:
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'MSYS nvm install'
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
npm-node-version:
|
||||
- '--lts'
|
||||
- '--default 12'
|
||||
- '--no-progress 10'
|
||||
steps:
|
||||
- name: Retrieve nvm
|
||||
shell: bash
|
||||
run: |
|
||||
unset npm_config_prefix
|
||||
if [ "${{ matrix.npm-node-version }}" = "--lts" ]; then
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash
|
||||
else
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD=script bash
|
||||
fi
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
nvm install ${{ matrix.npm-node-version }}
|
||||
|
||||
cygwin_matrix:
|
||||
continue-on-error: true
|
||||
permissions:
|
||||
contents: none
|
||||
name: 'Cygwin nvm install'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Install Cygwin
|
||||
shell: bash
|
||||
run: |
|
||||
export SITE='https://mirror.clarkson.edu/cygwin/' # see https://archlinux.org/mirrors/clarkson.edu/1603/ for uptime status
|
||||
export SITE='https://mirrors.kernel.org/sourceware/cygwin/'
|
||||
export LOCALDIR="$(pwd)"
|
||||
export ROOTDIR="$USERPROFILE\\cygwin"
|
||||
export PACKAGES='bash,git,curl'
|
||||
|
||||
curl -fsSLo setup-x86_64.exe 'https://cygwin.com/setup-x86_64.exe'
|
||||
./setup-x86_64.exe --disable-buggy-antivirus -q -s "$SITE" -l "$LOCALDIR" -R "$ROOTDIR" -P "$PACKAGES"
|
||||
|
||||
cat >~/setup.sh <<EOM
|
||||
unset npm_config_prefix
|
||||
export NVM_INSTALL_GITHUB_REPO="$NVM_INSTALL_GITHUB_REPO"
|
||||
export NVM_INSTALL_VERSION="$NVM_INSTALL_VERSION"
|
||||
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
nvm install --lts
|
||||
|
||||
nvm deactivate
|
||||
rm -rf "$HOME/.nvm/nvm.sh"
|
||||
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD=script bash
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
nvm install 9
|
||||
EOM
|
||||
- name: Retrieve nvm
|
||||
shell: cmd
|
||||
run: |
|
||||
cd %USERPROFILE%\cygwin\bin
|
||||
bash.exe "%USERPROFILE%\setup.sh"
|
||||
|
||||
wsl_matrix:
|
||||
continue-on-error: true
|
||||
name: 'WSL nvm install'
|
||||
defaults:
|
||||
run:
|
||||
shell: wsl-bash {0}
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
WSLENV: NVM_INSTALL_GITHUB_REPO:NVM_INSTALL_VERSION:/p
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
wsl-distrib:
|
||||
- Debian
|
||||
# - Alpine # fails
|
||||
- Ubuntu-20.04
|
||||
- Ubuntu-18.04
|
||||
npm-node-version:
|
||||
- '--lts'
|
||||
- '21'
|
||||
- '18'
|
||||
- '16'
|
||||
- '14'
|
||||
- '12'
|
||||
- '10'
|
||||
exclude:
|
||||
- wsl-distrib: Ubuntu-18.04
|
||||
npm-node-version: '--lts'
|
||||
- wsl-distrib: Ubuntu-18.04
|
||||
npm-node-version: '21'
|
||||
- wsl-distrib: Ubuntu-18.04
|
||||
npm-node-version: '18'
|
||||
method:
|
||||
- ''
|
||||
- 'script'
|
||||
steps:
|
||||
- uses: Vampire/setup-wsl@v3
|
||||
with:
|
||||
distribution: ${{ matrix.wsl-distrib }}
|
||||
additional-packages: bash git curl ca-certificates wget
|
||||
- name: Retrieve nvm on WSL
|
||||
run: |
|
||||
if [ -z "${{ matrix.method }}" ]; then
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash
|
||||
else
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD="${{matrix.method}}" bash
|
||||
fi
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
nvm install ${{ matrix.npm-node-version }}
|
||||
node -v
|
||||
|
||||
wsl_matrix_unofficial:
|
||||
continue-on-error: true
|
||||
name: 'WSL nvm install'
|
||||
defaults:
|
||||
run:
|
||||
shell: wsl-bash {0}
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
WSLENV: NVM_INSTALL_GITHUB_REPO:NVM_INSTALL_VERSION:/p
|
||||
NVM_NODEJS_ORG_MIRROR: https://unofficial-builds.nodejs.org/download/release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
wsl-distrib:
|
||||
- Alpine
|
||||
npm-node-version:
|
||||
- '--lts'
|
||||
- '21'
|
||||
- '18'
|
||||
- '16'
|
||||
- '14'
|
||||
- '12'
|
||||
- '11'
|
||||
- '10'
|
||||
method:
|
||||
- ''
|
||||
- 'script'
|
||||
steps:
|
||||
- uses: Vampire/setup-wsl@v3
|
||||
with:
|
||||
distribution: ${{ matrix.wsl-distrib }}
|
||||
additional-packages: bash git curl ca-certificates wget
|
||||
- name: Retrieve nvm on WSL
|
||||
run: |
|
||||
if [ -z "${{ matrix.method }}" ]; then
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash
|
||||
else
|
||||
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD="${{matrix.method}}" bash
|
||||
fi
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
NVM_NODEJS_ORG_MIRROR=${{ env.NVM_NODEJS_ORG_MIRROR }} nvm install ${{ matrix.npm-node-version }}
|
||||
|
||||
nvm_windows:
|
||||
name: 'tests, on windows'
|
||||
permissions:
|
||||
contents: none
|
||||
needs: [wsl_matrix, wsl_matrix_unofficial, cygwin_matrix, msys_matrix, msys_fail_install]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
81
nvm.sh
81
nvm.sh
@ -3360,6 +3360,10 @@ nvm() {
|
||||
shift
|
||||
;;
|
||||
--save | -w)
|
||||
if [ $NVM_WRITE_TO_NVMRC -eq 1 ]; then
|
||||
nvm_err '--save and -w may only be provided once'
|
||||
return 6
|
||||
fi
|
||||
NVM_WRITE_TO_NVMRC=1
|
||||
shift
|
||||
;;
|
||||
@ -3511,6 +3515,11 @@ nvm() {
|
||||
nvm_ensure_default_set "${provided_version}"
|
||||
fi
|
||||
|
||||
if [ $NVM_WRITE_TO_NVMRC -eq 1 ]; then
|
||||
nvm_write_nvmrc "${VERSION}"
|
||||
EXIT_CODE=$?
|
||||
fi
|
||||
|
||||
if [ $EXIT_CODE -ne 0 ] && [ -n "${ALIAS-}" ]; then
|
||||
nvm alias "${ALIAS}" "${provided_version}"
|
||||
EXIT_CODE=$?
|
||||
@ -3746,6 +3755,8 @@ nvm() {
|
||||
local NVM_LTS
|
||||
local IS_VERSION_FROM_NVMRC
|
||||
IS_VERSION_FROM_NVMRC=0
|
||||
local NVM_WRITE_TO_NVMRC
|
||||
NVM_WRITE_TO_NVMRC=0
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case "$1" in
|
||||
@ -3757,7 +3768,13 @@ nvm() {
|
||||
--) ;;
|
||||
--lts) NVM_LTS='*' ;;
|
||||
--lts=*) NVM_LTS="${1##--lts=}" ;;
|
||||
--save | -w) NVM_WRITE_TO_NVMRC=1 ;;
|
||||
--save | -w)
|
||||
if [ $NVM_WRITE_TO_NVMRC -eq 1 ]; then
|
||||
nvm_err '--save and -w may only be provided once'
|
||||
return 6
|
||||
fi
|
||||
NVM_WRITE_TO_NVMRC=1
|
||||
;;
|
||||
--*) ;;
|
||||
*)
|
||||
if [ -n "${1-}" ]; then
|
||||
@ -3791,8 +3808,8 @@ nvm() {
|
||||
return 127
|
||||
fi
|
||||
|
||||
if [ "${NVM_WRITE_TO_NVMRC:-0}" -eq 1 ]; then
|
||||
nvm_write_nvmrc "$VERSION"
|
||||
if [ $NVM_WRITE_TO_NVMRC -eq 1 ]; then
|
||||
nvm_write_nvmrc "${VERSION}"
|
||||
fi
|
||||
|
||||
if [ "_${VERSION}" = '_system' ]; then
|
||||
@ -4539,31 +4556,41 @@ nvm_supports_xz() {
|
||||
nvm_auto() {
|
||||
local NVM_MODE
|
||||
NVM_MODE="${1-}"
|
||||
local VERSION
|
||||
local NVM_CURRENT
|
||||
if [ "_${NVM_MODE}" = '_install' ]; then
|
||||
VERSION="$(nvm_alias default 2>/dev/null || nvm_echo)"
|
||||
if [ -n "${VERSION}" ] && ! [ "_${VERSION}" = '_N/A' ] && nvm_is_valid_version "${VERSION}"; then
|
||||
nvm install "${VERSION}" >/dev/null
|
||||
elif nvm_rc_version >/dev/null 2>&1; then
|
||||
nvm install >/dev/null
|
||||
fi
|
||||
elif [ "_$NVM_MODE" = '_use' ]; then
|
||||
NVM_CURRENT="$(nvm_ls_current)"
|
||||
if [ "_${NVM_CURRENT}" = '_none' ] || [ "_${NVM_CURRENT}" = '_system' ]; then
|
||||
VERSION="$(nvm_resolve_local_alias default 2>/dev/null || nvm_echo)"
|
||||
if [ -n "${VERSION}" ] && ! [ "_${VERSION}" = '_N/A' ] && nvm_is_valid_version "${VERSION}"; then
|
||||
nvm use --silent "${VERSION}" >/dev/null
|
||||
elif nvm_rc_version >/dev/null 2>&1; then
|
||||
nvm use --silent >/dev/null
|
||||
|
||||
case "${NVM_MODE}" in
|
||||
none) return 0 ;;
|
||||
use | install)
|
||||
local VERSION
|
||||
local NVM_CURRENT
|
||||
NVM_CURRENT="$(nvm_ls_current)"
|
||||
if [ "_${NVM_CURRENT}" = '_none' ] || [ "_${NVM_CURRENT}" = '_system' ]; then
|
||||
VERSION="$(nvm_resolve_local_alias default 2>/dev/null || nvm_echo)"
|
||||
if [ -n "${VERSION}" ]; then
|
||||
if [ "_${VERSION}" != '_N/A' ] && nvm_is_valid_version "${VERSION}"; then
|
||||
if [ "_${NVM_MODE}" = '_install' ]; then
|
||||
nvm install "${VERSION}" >/dev/null
|
||||
else
|
||||
nvm use --silent "${VERSION}" >/dev/null
|
||||
fi
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
elif nvm_rc_version >/dev/null 2>&1; then
|
||||
if [ "_${NVM_MODE}" = '_install' ]; then
|
||||
nvm install >/dev/null
|
||||
else
|
||||
nvm use --silent >/dev/null
|
||||
fi
|
||||
fi
|
||||
else
|
||||
nvm use --silent "${NVM_CURRENT}" >/dev/null
|
||||
fi
|
||||
else
|
||||
nvm use --silent "${NVM_CURRENT}" >/dev/null
|
||||
fi
|
||||
elif [ "_${NVM_MODE}" != '_none' ]; then
|
||||
nvm_err 'Invalid auto mode supplied.'
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
nvm_err 'Invalid auto mode supplied.'
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
nvm_process_parameters() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user