Skip to content

Merge pull request #348 from forta-network/release-js-v0.1.42-py-v0.1.22 #161

Merge pull request #348 from forta-network/release-js-v0.1.42-py-v0.1.22

Merge pull request #348 from forta-network/release-js-v0.1.42-py-v0.1.22 #161

name: Python Sdk Unit Test
on:
push:
paths:
- python-sdk/**
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: npm run python:install
- name: Publish Local
run: npm run python:publish:local
- name: Run the tests
run: npm run python:coverage
- name: Code coverage
id: coverage
run: |
echo "total=$(sed -n 21p python-sdk/coverage/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 run python:install
npm run python:publish:local
npm run python:coverage
echo "total=$(sed -n 21p python-sdk/coverage/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