Skip to content

Merge pull request #336 from forta-network/breakdown-handleAlert-queries #227

Merge pull request #336 from forta-network/breakdown-handleAlert-queries

Merge pull request #336 from forta-network/breakdown-handleAlert-queries #227

Workflow file for this run

name: Unit-Test
on:
push:
paths:
- cli/**
- sdk/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "14"
- name: Install Dependencies
run: npm install
- name: Run the tests
run: npm run js:coverage
- name: Code coverage
id: coverage
run: |
echo "total=$(sed -n 47p coverage/lcov-report/index.html | awk -F '>' '{print $2}' | awk -F '%' '{print $1}')" >> $GITHUB_OUTPUT
- name: Checkout master branch
uses: actions/checkout@v2
with:
ref: master
path: master
- name: Master branch code coverage
id: master-coverage
run: |
npm install
npm run js:coverage
echo "total=$(sed -n 47p coverage/lcov-report/index.html | awk -F '>' '{print $2}' | awk -F '%' '{print $1}')" >> $GITHUB_OUTPUT
working-directory: ./master
- name: Coverage threshold check
run: |
COVERAGE=${{ steps.coverage.outputs.total }}
MASTER_COVERAGE=${{ steps.master-coverage.outputs.total }}
COVERAGE_THRESHOLD=${{ vars.COVERAGE_THRESHOLD }}
if (( $(echo "$MASTER_COVERAGE - $COVERAGE > $COVERAGE_THRESHOLD" | bc -l) )) ; then
echo "coverage fell by more than $COVERAGE_THRESHOLD%"
exit 1
fi