Fix leakpro package #293
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
# This workflow will install Python dependencies, run tests and lint 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: Running tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
code-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Ruff Linting | |
uses: chartboost/ruff-action@v1 | |
with: | |
args: check leakpro --exclude examples,leakpro/tests | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: write # Ensure write permission for contents | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install micromamba | |
run: | | |
curl -L https://micromamba.snakepit.net/api/micromamba/linux-64/latest | tar -xvj -C /usr/local/bin/ --strip-components=1 bin/micromamba | |
- name: Install dependencies with micromamba | |
run: | | |
micromamba create --file environment.yml --name leakpro --root-prefix /home/runner/micromamba-root | |
- name: Set PYTHONPATH | |
run: echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV | |
- name: Install pytest and pytest-cov | |
shell: bash -l {0} | |
run: | | |
micromamba activate leakpro | |
micromamba install pytest pytest-cov | |
- name: Run tests with pytest | |
shell: bash -l {0} | |
run: | | |
micromamba activate leakpro | |
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=leakpro leakpro/tests/ | tee pytest-coverage.txt | |
cat ./pytest-coverage.txt | |
- name: Upload test coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-coverage.txt | |
path: pytest-coverage.txt |