chore(deps): bump pytest-cov from 7.0.0 to 7.1.0 (#507) #445
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
| # This workflow will install Python dependencies, run pre-commit checks, and run tests with a single version of Python | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Unit tests | |
| on: | |
| workflow_call: | |
| inputs: | |
| branch: | |
| required: false | |
| type: string | |
| description: 'Branch to run on' | |
| secrets: | |
| GIST_PAT: | |
| required: true | |
| push: | |
| branches: [ main, 0.x ] | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Push allure reports to gh-pages | |
| statuses: write # Update status on PR | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| ref: ${{ inputs.branch }} | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run unit tests | |
| run: | | |
| pytest --cov=src/ tests/unit --cov-report=xml --alluredir=allure-results | |
| - name: Allure Report | |
| uses: firebolt-db/action-allure-report@8cdc116f65f6eca845a992e347e72b75ca8ccf5f # v2.1.1 | |
| if: always() | |
| with: | |
| github-token: ${{ github.token }} | |
| pages-branch: gh-pages | |
| mapping-json: | | |
| { | |
| "allure-results": "unit" | |
| } | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| continue-on-error: true | |
| with: | |
| name: pytest-coverage-report | |
| path: coverage.xml | |
| - name: Extract coverage percent | |
| id: coverage | |
| if: github.event_name == 'push' | |
| continue-on-error: true | |
| run: | | |
| fraction=$(sed -n 2p coverage.xml | sed 's/.*line-rate=\"\([0-9.]*\)\".*$/\1/') | |
| percentage=$(echo "scale=1; $fraction * 100" | bc -l) | |
| percentage_whole=$(echo "${percentage%.*}") | |
| colour=$(if [ $percentage_whole -ge 80 ]; then echo "green"; else echo "orange"; fi) | |
| echo "colour=$colour" >> $GITHUB_OUTPUT | |
| echo "covered=$percentage_whole" >> $GITHUB_OUTPUT | |
| - name: Create Coverage Badge | |
| uses: schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0 | |
| if: github.event_name == 'push' | |
| continue-on-error: true | |
| with: | |
| auth: ${{ secrets.GIST_PAT }} | |
| gistID: 65d5a42849fd78f4c6e62fad18490d20 | |
| filename: firebolt-sdk-coverage.json | |
| label: Coverage | |
| message: ${{steps.coverage.outputs.covered}}% | |
| color: ${{steps.coverage.outputs.colour}} |