Merge pull request #355 from forta-network/release-js-v0.1.44-py-v0.1.24 #168
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: 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 |