Pytest and code Coverage #481
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: Pytest and code Coverage | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# Run every night at 04:00 (GitHub Actions timezone) | |
# in order to catch when unfrozen dependency updates | |
# break the use of the library. | |
- cron: '4 0 * * *' | |
jobs: | |
pytest: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, macos-13, macos-14, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install required system packages for Ubuntu | |
run: sudo apt-get install -y python3-pip libsecp256k1-dev python3-coverage | |
if: startsWith(matrix.os, 'ubuntu-') | |
- name: Install required system packages for macOS | |
if: startsWith(matrix.os, 'macos-') | |
run: | | |
brew update | |
brew tap cuber/homebrew-libsecp256k1 | |
brew install libsecp256k1 | |
brew install automake | |
- run: python3 -m venv /tmp/venv | |
- run: /tmp/venv/bin/python -m pip install --upgrade pip hatch coverage | |
# Only run coverage on one OS | |
- run: /tmp/venv/bin/hatch run testing:test | |
if: matrix.os != 'ubuntu-24.04' | |
- name: Test with coverage | |
if: matrix.os == 'ubuntu-24.04' | |
run: | | |
/tmp/venv/bin/hatch run testing:cov | |
- uses: codecov/[email protected] | |
if: matrix.os == 'ubuntu-24.04' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: aleph-im/aleph-client | |
file: ./coverage.xml | |
directory: /home/runner/work/aleph-client/aleph-client |