Merge pull request #56 from byu-oit/node20 #117
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: | |
pull_request: | |
push: | |
branches: | |
- staging | |
- 'v*' | |
env: | |
node_version: "20.x" | |
FORCE_COLOR: 3 | |
jobs: | |
build: # make sure build/ci work properly | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- name: npm ci | |
run: npm ci --prefer-offline | |
- name: npm run package | |
run: npm run package | |
- name: Check for any changed files | |
run: | | |
[[ -z $(git status --untracked-files=no --porcelain) ]] || \ | |
(echo "::error title=npm run package::Files in the /dist directory shouldn't have changed. You forgot to run 'npm run package'." && exit 1) | |
audit: | |
name: Audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
# We don't need to install deps to audit them | |
- name: npm audit | |
run: npm audit --audit-level=critical | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
cache: npm | |
cache-dependency-path: '**/package-lock.json' | |
- name: npm ci | |
run: npm ci --prefer-offline | |
- name: npm lint | |
run: npm run lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
cache: npm | |
cache-dependency-path: '**/package-lock.json' | |
- name: npm ci | |
run: npm ci --prefer-offline | |
- name: npm test | |
run: npm test | |
- name: Report test coverage to Codecov | |
uses: codecov/codecov-action@v3 |