feat: refactor integration pipeline and add poetry-dynamic-versioning support #1
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: Integration Workflow | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
tags: ["*"] | |
workflow_dispatch: | |
inputs: | |
pytest_addopts: | |
description: Extra options for pytest; use -vv for full details; see | |
https://docs.pytest.org/en/latest/example/simple.html#how-to-change-command-line-options-defaults | |
required: false | |
default: "" | |
env: | |
LANG: "en_US.utf-8" | |
LC_ALL: "en_US.utf-8" | |
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip | |
POETRY_CACHE_DIR: ${{ github.workspace }}/.cache/pypoetry | |
POETRY_VIRTUALENVS_IN_PROJECT: "true" | |
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit | |
PYTEST_ADDOPTS: ${{ github.event.inputs.pytest_addopts }} | |
PYTHONIOENCODING: "UTF-8" | |
TARGET_PYTHON_VERSION: "3.9" | |
jobs: | |
quality-test: | |
# This job is used to run pre-commit checks to ensure that all files are | |
# are formatted correctly. | |
name: Run pre-commit checks on changed files | |
# This job doesn't fail fast to ensure that feedback on function is still provided | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo, setup python, and load cache | |
uses: ./.github/actions/setup-env | |
with: | |
python-version: ${{ env.TARGET_PYTHON_VERSION }} | |
fetch-depth: 0 | |
cache-pre-commit: true | |
cache-venv: false | |
setup-poetry: false | |
- name: Run pre-commit checks on all files | |
uses: pre-commit/action@v3.0.0 | |
with: | |
extra_args: --all-files | |
integration-test: | |
name: Run pytest on all supported python versions and operating systems | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout the repo, setup python, and load cache | |
uses: ./.github/actions/setup-env | |
with: | |
python-version: ${{ matrix.python-version }} | |
fetch-depth: 0 | |
- name: Install poetry and dependencies | |
run: | | |
python -m pip install poetry poetry-dynamic-versioning | |
poetry install --with dev,docs --all-extras -v --no-interaction | |
# For the target version and OS, run pytest and generate/upload coverage report | |
- name: Run pytest and generate coverage report | |
if: (matrix.os == 'ubuntu-latest') && (matrix.python-version == env.TARGET_PYTHON_VERSION) | |
run: poetry run pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
continue-on-error: true | |
if: (matrix.os == 'ubuntu-latest') && (matrix.python-version == env.TARGET_PYTHON_VERSION ) | |
uses: codecov/codecov-action@v3 | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
with: | |
file: ./coverage.xml | |
files: ./coverage1.xml,./coverage2.xml | |
directory: ./coverage/reports/ | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true | |
flags: unittests | |
name: pycytominer | |
# For every other version and OS, run only pytest | |
- name: Run pytest | |
if: (matrix.os != 'ubuntu-latest') || (matrix.python-version != env.TARGET_PYTHON_VERSION ) | |
run: poetry run pytest |