-
Notifications
You must be signed in to change notification settings - Fork 17
95 lines (80 loc) · 2.5 KB
/
Copy pathtest-type-lint.yaml
File metadata and controls
95 lines (80 loc) · 2.5 KB
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
name: Build & run pytest-mypy-linters
env:
IN_GITHUB_ACTION: 1
on: [push]
permissions:
contents: read
jobs:
run-on-ubuntu:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Building/caching the environment
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA
echo $CONDA/bin >> $GITHUB_PATH
echo $CONDA_PREFIX
- name: Cache conda env
id: cache-conda
uses: actions/cache@v4
env:
# change name here (only) to invalidate cache
cache-name: cache-conda-env-v1
with:
key: ${{ env.cache-name }}-${{ hashFiles('pyproject.toml') }}
path: ./ci_env
- name: Create conda env
run: |
# creates the env if it does not exist (not loaded from cache)
sudo apt-get update
if [ ! -d "./ci_env" ]; then \
conda create -p ./ci_env python=3.11 ipython -y
fi
- name: Install dependencies
run: |
source activate ./ci_env
pip install -e .[dev]
- name: Print installed packages
run: |
source activate ./ci_env
pip freeze
# start checks
- name: Run type hint checks with mypy
run: |
source activate ./ci_env
pip show mypy
mypy exca
- name: Test with pytest
run: |
source activate ./ci_env
pip show pytest
pytest exca --durations=10
python -m exca.test_safeguard # checks no unneeded imports
# TODO: re-enable once docs/steps/ pseudocode blocks are fixed or excluded
- name: Test README code blocks
if: false
run: |
source activate ./ci_env
# update readmes to avoid running on slurm:
sed -i 's/cluster: slurm/cluster: null/g' docs/infra/*.md
sed -i 's/\"auto\"/None/g' README.md
# on Mac: sed -i '' 's/cluster: slurm/cluster: null/g' docs/infra/*.md
# check readmes (only README.md and docs/ folder, not internal specs)
pytest --markdown-docs -m markdown-docs README.md docs/
# keep ruff version in sync with .pre-commit-config.yaml
- uses: astral-sh/ruff-action@v3
with:
version: "0.15.8"
args: "check"
- uses: astral-sh/ruff-action@v3
with:
version: "0.15.8"
args: "format --check"