Skip to content

Commit

Permalink
Merge pull request #228 from prjemian/227-CI-workflows
Browse files Browse the repository at this point in the history
update CI
  • Loading branch information
prjemian authored Aug 29, 2023
2 parents 307df8a + 1d0142c commit 5fa04c9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 24 deletions.
68 changes: 45 additions & 23 deletions .github/workflows/unit-tests-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Unit Tests
on: [push, pull_request]

jobs:
build-linux:
test-matrix:
name: CI py${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
# - "3.12" # 2023-08-28: not available now
- "3.11"
- "3.10"
- "3.9"
Expand All @@ -18,55 +18,77 @@ jobs:
max-parallel: 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Create Python ${{ matrix.python-version }} environment
uses: mamba-org/provision-with-micromamba@v12
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 env list
micromamba info
micromamba list
conda config --show-sources
conda config --show
micromamba env list
printenv | sort
- name: Install Python package & test requirements
shell: bash -l {0}
run: |
micromamba install coverage pytest
- name: Install Python coveralls
shell: bash -l {0}
run: |
# as seen: https://github.com/bleachbit/bleachbit/commit/c66b604b2702e51b215a9e768c93b099d1331fc4
pip install coveralls pyyaml
- name: Diagnostic
shell: bash -l {0}
run: |
micromamba list
- name: Run tests with pytest & coverage
shell: bash -l {0}
run: |
coverage run --concurrency=thread --parallel-mode -m pytest -vvv .
coverage run --concurrency=thread --parallel-mode -m pytest -vvv --exitfirst .
coverage combine
- name: Coverage Report
shell: bash -l {0}
run: |
coverage report
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 }}
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Production
Development
***********

:0.3.1: 2023-09-01 -- Test with Py3.8 - Py3.12.
:0.3.1: 2023-09-01 -- Test with Py3.8 - Py3.11.
:0.3.0: 2022-01-01 -- Github API access token no longer needed, ``update`` subcommand is now ``install``
:0.2.7: 2021-12-24 -- publish documentation on GitHub Pages
:0.2.6: 2021-12-22 -- drop support for python<3.6
Expand Down

0 comments on commit 5fa04c9

Please sign in to comment.