-
Notifications
You must be signed in to change notification settings - Fork 221
154 lines (148 loc) · 6.61 KB
/
test_latest.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
150
151
152
153
154
name: Test against latest dependencies
on:
schedule:
- cron: '25 5 * * SUN'
workflow_dispatch:
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:
include-release-candidates: true
include-beta-releases: true
token: ${{ secrets.GITHUB_TOKEN }}
testing:
needs: [get_python_versions]
name: "Python ${{ matrix.python-version }} on ${{ matrix.os.image }} (standalone: ${{ matrix.standalone }}, 32bit: ${{ matrix.float_dtype_32 }})"
runs-on: ${{ matrix.os.image }}
strategy:
fail-fast: false
matrix:
os: [{image: ubuntu-latest, triplet: x64-linux},
{image: windows-latest, triplet: x64-windows},
{image: macOS-12, triplet: x64-osx},
{image: macOS-14, triplet: arm64-osx}]
standalone: [false, true]
float_dtype_32: [false, true]
python-version: ["${{ needs.get_python_versions.outputs.max-python }}"]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GSL
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: gsl
triplet: ${{ matrix.os.triplet }}
cache-key: gsl-${{ matrix.os.triplet }}
revision: master
token: ${{ github.token }}
- name: Set GSL preference for vcpkg
shell: bash
run: |
mkdir ~/.brian/
# Replaces backslashes with forward slashes
echo "GSL.directory=\"${{ github.workspace }}\\vcpkg\\installed\${{ matrix.os.triplet }}\\include"\" | tr '\\' '/' > ~/.brian/user_preferences
cat ~/.brian/user_preferences
- name: Install Python
id: python
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install scipy build dependencies (Linux)
run: sudo apt install -y gcc g++ gfortran libopenblas-dev liblapack-dev pkg-config python3-pip python3-dev
if: matrix.os.image == 'ubuntu-latest'
- name: Install scipy build dependencies (mac OS)
run: |
sudo ln -s $(which gfortran-13) /usr/local/bin/gfortran
brew install openblas pkg-config
# Export PKG_CONFIG_PATH to GitHub Actions environment
echo "export PKG_CONFIG_PATH=/opt/homebrew/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV
if: matrix.os.image == 'macOS-12' || matrix.os.image == 'macOS-14'
- name: Install dependencies
run: |
${{ steps.python.outputs.python-path }} -m pip install --upgrade pip setuptools
${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple numpy scipy
${{ steps.python.outputs.python-path }} -m pip install mpmath # install stable version
${{ steps.python.outputs.python-path }} -m pip install --pre pytest cython sympy pyparsing jinja2 sphinx
- name: Install Brian2
run: |
cp numpy2.pyproject.toml pyproject.toml
${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
- name: Run Tests
run: |
cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
${{ steps.python.outputs.python-path }} -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py
env:
AGENT_OS: ${{runner.os}}
STANDALONE: ${{ matrix.standalone }}
FLOAT_DTYPE_32: ${{ matrix.float_dtype_32 }}
DO_NOT_RESET_PREFERENCES: true # Make sure that GSL setting is used
test-deprecations:
needs: [ get_python_versions ]
name: "Python ${{ matrix.python-version }} check for deprecation warnings on (standalone: ${{ matrix.standalone }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
standalone: [ false, true ]
python-version: [ "${{ needs.get_python_versions.outputs.max-python }}" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GSL
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: gsl
triplet: x64-linux
cache-key: gsl-x64-linux
revision: master
token: ${{ github.token }}
- name: Install Python
id: python
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
${{ steps.python.outputs.python-path }} -m pip install --upgrade pip setuptools
${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
${{ steps.python.outputs.python-path }} -m pip install --pre pytest cython sympy pyparsing jinja2 sphinx
- name: Install Brian2
run: ${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
- name: Determine Cython cache dir
id: cython-cache
run: |
CACHE_DIR=$(python -c 'import os; from Cython.Utils import get_cython_cache_dir; print(os.path.join(get_cython_cache_dir(), "brian_extensions"))')
echo "Cython cache dir: $CACHE_DIR"
echo "cachedir=$CACHE_DIR" >> "$GITHUB_OUTPUT"
- name: restore Cython cache
uses: actions/cache@v4
if: ${{ ! matrix.standalone }}
with:
key: cython-extensions-latest-ubuntu-latest-${{ matrix.python-version }}-32bit-False
path: ${{ steps.cython-cache.outputs.cachedir }}
- name: Run Tests
run: |
cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
${{ steps.python.outputs.python-path }} -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py || echo "Tests failed (but not marked as failed on GA)"
env:
DEPRECATION_ERROR: true
AGENT_OS: linux
STANDALONE: ${{ matrix.standalone }}