-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (74 loc) · 2.16 KB
/
lint_and_test.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
name: Run tests
on:
schedule:
- cron: '19 3 * * 1-5'
push:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Black
uses: psf/black@stable
with:
options: "--check --verbose"
jupyter: true
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run flake8
uses: py-actions/flake8@v2
- name: Install mypy
run: pip install mypy
- name: Install types
run: mypy --install-types --non-interactive
- name: Run mypy
run: mypy
- name: Install numpydoc
run: pip install numpydoc
- name: Run docstring validation
run: ./run_validate_docstrings
tests:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout swiftgalaxy
uses: actions/checkout@v4
with:
path: swiftgalaxy
- name: Checkout SOAP (dependency)
uses: actions/checkout@v4
with:
repository: SWIFTSIM/SOAP
path: SOAP
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f swiftgalaxy/requirements.txt ]; then pip install -r swiftgalaxy/requirements.txt; fi
if [ -f swiftgalaxy/optional_requirements.txt ]; then pip install -r swiftgalaxy/optional_requirements.txt; fi
pip install -e swiftgalaxy/
- name: Test with pytest
run: |
cd swiftgalaxy
pytest