Skip to content

Commit

Permalink
ci: Update CI steps to use Node 20
Browse files Browse the repository at this point in the history
The CI steps need to be updated to use Node 20. While doing so, we
incorporate some additional work:

- Update all actions to use the latest versions that run on Node 20
- Update the test matrix to use our .nvmrc file as one of the Node
  versions to test against
- Check for uncommitted changes after installing dependencies
  • Loading branch information
joshuacurtiss committed Jul 12, 2024
1 parent cd882f4 commit 80d826e
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,40 @@ on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
nvmrc: ${{ steps.makeNodeVersionOutput.outputs.nvmrc }}
steps:
-
uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history
-
uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm i -g npm@8.5.5
- run: npm ci
- run: npm run standards
- name: Put NVM version in output
id: makeNodeVersionOutput
run: echo "nvmrc=$(cat .nvmrc)" >> "$GITHUB_OUTPUT"
- run: npm ci
- name: Check for uncommitted changes # Done after dependency install and build to ensure code isn't compromised
run: if [ -n "$(git status --porcelain)" ]; then echo 'There are uncommitted changes.'; exit 1; fi
- run: npm run check-node-version
- run: npm run standards
test:
needs: [ build ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [ 12, 14, 16, 'lts/*', 'latest' ]
node-version: [ 16, '${{ needs.build.outputs.nvmrc }}', 'lts/*', 'latest' ]
steps:
- uses: actions/checkout@v3
-
name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g npm@8.5.5
- run: npm ci # Reinstall the dependencies to ensure they install with the current version of node
- run: npm test
- name: Coveralls
uses: coverallsapp/github-action@v1
- run: npm ci # Reinstall the dependencies to ensure they install with the current version of node
- run: npm run standards
- run: npm test
- name: Coveralls
uses: coverallsapp/github-action@v2

0 comments on commit 80d826e

Please sign in to comment.