diff --git a/.flake8 b/.flake8 index 7a7d62f..6ba1c66 100644 --- a/.flake8 +++ b/.flake8 @@ -23,9 +23,11 @@ extend-ignore = # E129 visually indented line with same indent as next logical line E129, # Multiple spaces after ',' (E241) - E241 + E241, + # unmatched + E999 max-line-length = 99 max-complexity = 19 ban-relative-imports = true select = B,C,E,F,N,W,I25 -exclude=*env \ No newline at end of file +exclude=*env diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..a4e7e98 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,33 @@ +name: Codecov Report Upload + +on: + push: + branches: + - master + pull_request: + types: [labeled] + +jobs: + pytest: + runs-on: ubuntu-latest + environment: CI Environment + steps: + - uses: actions/checkout@v2 + - name: Bring up Services and Run Tests + run: | + docker-compose -f docker-compose-pipeline.yml build + docker-compose -f docker-compose-pipeline.yml up -d + docker-compose -f docker-compose-pipeline.yml exec -T api pytest tests/ --cov --junit-xml=test-reports/report.xml --cov-report=xml --cov-fail-under=70 + echo "STATUS=$(cat pytest-coverage.txt | grep 'Required test' | awk '{ print $1 }')" >> $GITHUB_ENV + echo "FAILED=$(cat test-reports/report.xml | awk -F'=' '{print $5}' | awk -F' ' '{gsub(/"/, "", $1); print $1}')" >> $GITHUB_ENV + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v3 + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + if: ${{ always() && github.ref != 'refs/heads/master' }} + with: + create-new-comment: true + junitxml-path: ./test-reports/report.xml + - name: Evaluate Coverage + if: ${{ (env.STATUS == 'FAIL') || (env.FAILED > 0) }} + run: exit 1