build_env_run_tests #180
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
# Builds the aeon environment; lints formatting and smells via ruff; checks type annotations via pyright; | |
# tests via pytest; reports test coverage via pytest-cov and codecov. | |
name: build_env_run_tests | |
on: | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: # allows running manually from Github's 'Actions' tab | |
jobs: | |
build_env_run_tests: # checks for building env using pyproject.toml and runs codebase checks and tests | |
name: Build env using pip and pyproject.toml on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: [3.11] | |
fail-fast: false | |
defaults: | |
run: | |
shell: ${{ matrix.os == 'windows-latest' && 'cmd' || 'bash' }} -l {0} # Adjust shell based on OS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Create venv and install dependencies | |
run: | | |
python -m venv .venv | |
.venv/Scripts/activate || source .venv/bin/activate | |
pip install -e .[dev] | |
pip list | |
python -c "import aeon" | |
- name: Activate venv for later steps | |
run: | | |
echo "::set-env name=VIRTUAL_ENV::$(pwd)/.venv" | |
echo "::add-path::$(pwd)/.venv/bin" | |
# Only run codebase checks and tests for Linux (ubuntu). | |
- name: ruff | |
if: matrix.os == 'ubuntu-latest' | |
run: ruff check . | |
- name: pyright | |
if: matrix.os == 'ubuntu-latest' | |
run: python -m pyright --level error --project ./pyproject.toml . | |
- name: pytest | |
if: matrix.os == 'ubuntu-latest' | |
run: python -m pytest tests/ --ignore=tests/dj_pipeline | |
- name: generate test coverage report | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
python -m pytest --cov=aeon tests/ --ignore=tests/dj_pipeline --cov-report=xml:tests/test_coverage/test_coverage_report.xml | |
- name: upload test coverage report to codecov | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: tests/test_coverage/ | |
files: test_coverage_report.xml | |
fail_ci_if_error: true | |
verbose: true |