update package lock #144
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: ["develop"] | |
pull_request: | |
branches: ["develop"] | |
env: | |
minCoverage: ${{ vars.COVERAGE_VAR }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Run test | |
run: npm run test:ci | |
- name: Collect code coverage | |
id: collect | |
run: | | |
echo "coverage<<EOF" >> $GITHUB_OUTPUT | |
cat coverage/coverage-summary.json >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Archive code coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: coverage/ | |
- name: Check % | |
id: check | |
run: | | |
echo "Min coverage is $minCoverage%" | |
echo "Current coverage is ${{ fromJSON(steps.collect.outputs.coverage).total.lines.pct }}%" | |
echo "pct=${{ fromJSON(steps.collect.outputs.coverage).total.lines.pct }}" >> $GITHUB_OUTPUT | |
- name: Exit 1 | |
if: ${{ steps.check.outputs.pct < env.minCoverage }} | |
run: | | |
exit 1 |