Skip to content

codeql workflow github action #89

codeql workflow github action

codeql workflow github action #89

Workflow file for this run

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 ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
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