Github action update for automated doc generation #340
Workflow file for this run
This file contains hidden or 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 Unit Tests | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| run_tests: | |
| runs-on: [ self-hosted ] | |
| container: python:3.9 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install xmllint | |
| run: | | |
| apt-get update | |
| apt-get install -y libxml2-utils bc | |
| - name: Install package and run unit tests with coverage | |
| id: extract_coverage | |
| shell: bash | |
| run: | | |
| source ./dev-setup.sh | |
| pytest test/unit -s --cov=nodescraper --cov-report=xml --cov-report=term --cov-fail-under=70 --maxfail=1 --disable-warnings -v | |
| - name: Print coverage | |
| run: | | |
| total_coverage=$(xmllint --xpath "string(//coverage/@line-rate)" coverage.xml) | |
| total_coverage_percentage=$(echo "$total_coverage * 100" | bc) | |
| echo "Total Coverage: $total_coverage_percentage%" | |
| echo "coverage_percentage=$total_coverage_percentage" >> $GITHUB_ENV | |
| - name: Display total coverage in Summary | |
| run: | | |
| echo "Total Coverage: ${{ env.coverage_percentage }}" >> $GITHUB_STEP_SUMMARY |