add project dependencies for pip install #439
Workflow file for this run
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: Unit Tests | |
on: [push, pull_request] | |
jobs: | |
test-matrix: | |
name: CI py${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
# - "3.12" # 2023-08-28: not available now | |
- "3.11" | |
- "3.10" | |
- "3.9" | |
- "3.8" | |
# - "3.7" | |
max-parallel: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create Python ${{ matrix.python-version }} environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
environment-name: anaconda-test-env-py-${{ matrix.python-version }} | |
condarc: | | |
channel-priority: flexible | |
init-shell: bash | |
create-args: >- | |
pytest | |
pytest-cov | |
python=${{ matrix.python-version }} | |
pyyaml | |
setuptools-scm | |
cache-environment: true | |
cache-environment-key: env-key-${{ matrix.python-version }} | |
- name: Install code coverage requirements by pip | |
run: | | |
# avoids: ImportError: cannot import name 'Reporter' from 'coverage.report' | |
pip install coverage coveralls | |
- name: Initial diagnostics | |
shell: bash -l {0} | |
run: | | |
micromamba info | |
micromamba list | |
conda config --show-sources | |
conda config --show | |
micromamba env list | |
printenv | sort | |
- name: Run tests with pytest & coverage | |
shell: bash -l {0} | |
run: | | |
coverage run --concurrency=thread --parallel-mode -m pytest -vvv --exitfirst . | |
coverage combine | |
- name: Coverage Report | |
shell: bash -l {0} | |
run: | | |
coverage report --precision 3 | |
- name: Upload to coveralls | |
shell: bash -l {0} | |
# https://github.com/TheKevJames/coveralls-python | |
run: | | |
coveralls debug | |
coveralls --service=github | |
env: | |
COVERALLS_FLAG_NAME: ${{ matrix.python-version }} | |
COVERALLS_PARALLEL: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support | |
coveralls: | |
name: Report unit test coverage to coveralls | |
needs: test-matrix | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Gather coverage and report to Coveralls | |
run: | | |
echo "Finally!" | |
pip3 install --upgrade coveralls | |
# debug mode: output prepared json and reported files list to stdout | |
# https://coveralls-python.readthedocs.io/en/latest/troubleshooting.html | |
coveralls debug | |
coveralls --service=github --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |