-
Notifications
You must be signed in to change notification settings - Fork 6
114 lines (103 loc) · 3.91 KB
/
build_env_run_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# 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_pip_pyproject: # checks only for building env using pip and pyproject.toml
name: Build env using pip and pyproject.toml
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@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Create venv and install dependencies
run: |
python -m venv .venv
if [ ${{ matrix.os }} = 'windows-latest' ]; then
.venv\Scripts\activate
else
source .venv/bin/activate
fi
pip install -e .[dev]
pip list
.venv/bin/python -c "import aeon"
build_env_run_tests: # checks for building env using mamba and runs codebase checks and tests
name: Build env and run tests 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}
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: set up conda env (Linux, Windows)
if: ${{ matrix.os != 'macos-latest' }}
uses: conda-incubator/setup-miniconda@v2
with:
use-mamba: true
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
environment-file: ./env_config/env.yml
activate-environment: aeon
- name: Install datajoint on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
pip install --use-pep517 datajoint
- name: set up conda env for macOS
if: ${{ matrix.os == 'macos-latest' }}
uses: conda-incubator/setup-miniconda@v2
with:
use-mamba: true
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
environment-file: ./env_config/env.yml
activate-environment: aeon
architecture: arm64
miniconda-version: "latest"
- name: Update conda env with dev reqs
run: mamba env update -f ./env_config/env_dev.yml
# Only run codebase checks and tests for ubuntu.
- name: ruff
if: ${{ matrix.os == 'ubuntu-latest' }}
run: python -m ruff check --config ./pyproject.toml .
- 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/
- name: generate test coverage report
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python -m pytest --cov=aeon ./tests/ --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