chore(deps): lock file maintenance (#17) #73
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: [ dev, main ] | |
pull_request: | |
branches: [ dev, main ] | |
jobs: | |
lint-and-test: | |
name: Lint and test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [20, 22] | |
steps: | |
- name: Set git to use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: npm | |
- name: Install dependencies | |
run: npm i | |
env: | |
CI: true | |
- name: Lint JavaScript and JSON files | |
run: npm run lint | |
env: | |
CI: true | |
- name: Run tests | |
if: matrix.node != 20 | |
run: npm run coverage | |
env: | |
CI: true | |
- name: Run tests with coverage | |
if: matrix.node == 20 | |
run: npm run coverage | |
env: | |
CI: true | |
- name: Save code coverage to artifact | |
if: matrix.node == 20 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: "coverage/lcov.info" | |
retention-days: 5 | |
coverage: | |
runs-on: ubuntu-latest | |
needs: | |
- lint-and-test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch code coverage artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: code-coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |