🌱 NEW: adopted hatch-pip-compile
which makes requirements lock files
#87
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: test and cover | |
on: | |
push: | |
branches: [ "dev" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
test: | |
runs-on: self-hosted | |
continue-on-error: ${{ matrix.experimental }} | |
# (applies to a single job) If jobs.<job_id>.continue-on-error is true, | |
# other jobs in the matrix will continue running even if the job with | |
# jobs.<job_id>.continue-on-error: true fails. | |
strategy: | |
fail-fast: true | |
# (applies to the entire matrix) If jobs.<job_id>.strategy.fail-fast is | |
# set to true or its expression evaluates to true, GitHub will cancel all | |
# in-progress and queued jobs in the matrix if any job in the matrix | |
# fails. This property defaults to true. | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10" ] | |
experimental: [false] | |
include: | |
- python-version: "3.11" | |
experimental: true | |
- python-version: "3.12" | |
experimental: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install --no-cache-dir --upgrade pip | |
pip install --no-cache-dir -r requirements/requirements-test.txt | |
# - name: Lint with flake8 | |
# run: | | |
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# flake8 . --count --exit-zero --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/test-results-${{ matrix.python-version }}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
cover: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ vars.PYTHON_VERSION }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ vars.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
pip install --no-cache-dir --upgrade pip | |
pip install --no-cache-dir -r requirements/requirements-test.txt | |
- name: Run coverage | |
run: | | |
coverage run -m pytest | |
coverage json | |
coverage report | |
- name: Upload to coveralls [debug] | |
if: ${{ github.run_attempt > 1 }} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
run: | | |
coveralls debug --service=github | |
coveralls --output=cov --service=github | |
xxd < cov | |
- name: Upload to coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
run: | | |
coveralls --service=github |