CI #67
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
# Test and deploy | |
name: CI | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
OS: "linux" | |
PYTHON_VERSION: "3.10" | |
REQUIREMENTS_FILE: "requirements-all-linux-py3.10.txt" | |
jobs: | |
check: | |
name: "CI with ubuntu, py3.10, pip, pyqt5" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: "Install and upgrade" | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install black~=23.0 ruff | |
- name: "Format with black" | |
run: black --check --diff "." | |
- name: "Lint with ruff" | |
run: ruff --output-format=github "." | |
# these libraries enable testing on Qt on linux | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: "Install napari-locan and dependencies" | |
run: | | |
python -m pip install pyqt5 .[test] | |
python -m pip install mypy coverage[toml] pip-tools | |
- name: "Type check with mypy" | |
run: mypy | |
- name: "Run tests" | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: coverage run -m pytest --junitxml=./test-results-${{ env.PYTHON_VERSION }}.xml | |
- name: "Prepare coverage reports" | |
run: coverage xml | |
- name: "Check coverage" | |
run: coverage report --fail-under=80 | |
- name: "Upload coverage to CodeCov" | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
files: coverage.xml | |
flags: unittests | |
name: "CodeCov report" | |
verbose: true | |
- name: "Freeze requirements" | |
run: pip-compile pyproject.toml --extra test --output-file ${{ env.REQUIREMENTS_FILE }} | |
- name: "Upload requirements file" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.REQUIREMENTS_FILE }} | |
path: ${{ env.REQUIREMENTS_FILE }} |