-
Notifications
You must be signed in to change notification settings - Fork 222
149 lines (134 loc) · 4.75 KB
/
testsuite.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: TestSuite
on: [push, pull_request]
jobs:
get_python_versions:
name: "Determine Python versions"
runs-on: ubuntu-latest
outputs:
min-python: ${{ steps.nep29.outputs.min-python }}
max-python: ${{ steps.nep29.outputs.max-python }}
steps:
- name: "calculate versions according to NEP29"
id: nep29
uses: mstimberg/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
pre-commit:
name: Run linters with pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: .devcontainer/dev-requirements.txt
- name: Install deps
run: pip3 install -r .devcontainer/dev-requirements.txt
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
testing:
needs: [get_python_versions, pre-commit]
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} (standalone: ${{ matrix.standalone }}, 32bit: ${{ matrix.float_dtype_32 }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macOS-11]
standalone: [false, true]
float_dtype_32: [false, true]
python-version: ["${{ needs.get_python_versions.outputs.max-python }}"]
include:
- os: ubuntu-20.04
standalone: false
python-version: "${{ needs.get_python_versions.outputs.min-python }}"
float_dtype_32: false
- os: ubuntu-20.04
standalone: true
python-version: "${{ needs.get_python_versions.outputs.min-python }}"
float_dtype_32: false
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Conda and Python
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: false
channels: conda-forge,defaults
channel-priority: true
activate-environment: 'test_env'
python-version: ${{ matrix.python-version }}
- name: Install Brian2 and dependencies
run: |
conda install -n test_env --quiet --yes -c conda-forge pip pytest cython sympy future pyparsing numpy jinja2 six scipy sphinx gsl coverage
pip install .
- name: Run Tests
run: |
cd $GITHUB_WORKSPACE/.. # move out of the workspace to avoid direct import
coverage run --rcfile=$GITHUB_WORKSPACE/.coveragerc $GITHUB_WORKSPACE/$SCRIPT_NAME
env:
SCRIPT_NAME: dev/continuous-integration/run_test_suite.py
SPHINX_DIR: ${{ github.workspace }}/docs_sphinx
AGENT_OS: ${{runner.os}}
STANDALONE: ${{ matrix.standalone }}
FLOAT_DTYPE_32: ${{ matrix.float_dtype_32 }}
- name: Upload coverage data to coveralls
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.python-version == needs.get_python_versions.outputs.max-python }}
run: |
cp $GITHUB_WORKSPACE/../.coverage .
python -m pip install --upgrade coveralls
coveralls --service=github --rcfile=$GITHUB_WORKSPACE/.coveragerc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ github.job }}
COVERALLS_PARALLEL: true
coveralls:
name: Indicate completion to coveralls.io
needs: testing
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
python -m pip install --upgrade coveralls
coveralls --service=github --finish --rcfile=$GITHUB_WORKSPACE/.coveragerc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test_doc_build:
needs: get_python_versions
name: Test building the documentation
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Setup Conda and Python
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: false
channels: conda-forge,defaults
channel-priority: true
activate-environment: 'test_env'
python-version: "${{ needs.get_python_versions.outputs.max-python }}"
- name: Install dependencies
run: pip install -r rtd-requirements.txt
- name: Install brian2
run: pip install .
- name: Build HTML documentation
run: |
cd docs_sphinx
sphinx-build -b html . ../docs
env:
READTHEDOCS: True