Merge commit from fork #163
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- master | |
- '1.0' | |
paths-ignore: | |
- '*.md' | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
name: | |
- Node.js 18.x | |
- Node.js 20.x | |
- Node.js 22.x | |
include: | |
- name: Node.js 18.x | |
node-version: "18" | |
- name: Node.js 20.x | |
node-version: "20" | |
- name: Node.js 22.x | |
node-version: "22" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node.js ${{ matrix.node-version }} | |
shell: bash -eo pipefail -l {0} | |
run: | | |
nvm install --default ${{ matrix.node-version }} | |
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" | |
- name: Configure npm | |
run: | | |
npm config set package-lock false | |
- name: Install Node.js dependencies | |
run: npm install | |
- name: List environment | |
id: list_env | |
shell: bash | |
run: | | |
echo "node@$(node -v)" | |
echo "npm@$(npm -v)" | |
npm -s ls ||: | |
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }' | |
- name: Run tests | |
shell: bash | |
run: | | |
if npm -ps ls nyc | grep -q nyc; then | |
npm run test-ci | |
else | |
npm test | |
fi | |
- name: Lint code | |
if: steps.list_env.outputs.eslint != '' | |
run: npm run lint | |
- name: Collect code coverage | |
uses: coverallsapp/github-action@master | |
if: steps.list_env.outputs.nyc != '' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
flag-name: run-${{ matrix.test_number }} | |
parallel: true | |
coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload code coverage | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true |