Debian Codegraph @

.github/workflows/test_latest.yml

raw
1 name: Test against latest dependencies
2
3 on:
4 schedule:
5 - cron: '25 5 * * SUN'
6 workflow_dispatch:
7
8 permissions:
9 contents: read
10
11 jobs:
12 get_python_versions:
13 name: "Determine Python versions"
14 runs-on: ubuntu-latest
15 permissions: {}
16 outputs:
17 min-python: ${{ steps.nep29.outputs.min-python }}
18 max-python: ${{ steps.nep29.outputs.max-python }}
19 steps:
20 - name: "calculate versions according to SPEC-0"
21 id: nep29
22 uses: mstimberg/github-calc-nep29@a73481e4e8488a5fa0b3be70a385cc5206a261ba # v0.7
23 with:
24 include-release-candidates: true
25 include-beta-releases: true
26 # Match SPEC-0
27 deprecate-python-after: 36
28 min-python-releases: 0
29 token: ${{ secrets.GITHUB_TOKEN }}
30
31 testing:
32 needs: [get_python_versions]
33 name: "Python ${{ matrix.python-version }} on ${{ matrix.os.image }} (standalone: ${{ matrix.standalone }}, 32bit: ${{ matrix.float_dtype_32 }})"
34 runs-on: ${{ matrix.os.image }}
35 strategy:
36 fail-fast: false
37 matrix:
38 os: [{image: ubuntu-latest, triplet: x64-linux},
39 {image: windows-latest, triplet: x64-windows},
40 {image: macos-15-intel, triplet: x64-osx},
41 {image: macos-latest, triplet: arm64-osx}]
42 standalone: [false, true]
43 float_dtype_32: [false, true]
44 python-version: ["${{ needs.get_python_versions.outputs.max-python }}"]
45
46 steps:
47 - name: Checkout Repository
48 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
49 with:
50 fetch-depth: 0
51 persist-credentials: false
52 - name: Install GSL
53 uses: johnwason/vcpkg-action@ff71808de10afc0e3160fd079353c69ba0d7dd60 # v7.0.0
54 id: vcpkg
55 with:
56 pkgs: gsl
57 triplet: ${{ matrix.os.triplet }}
58 cache-key: gsl-${{ matrix.os.triplet }}
59 revision: master
60 token: ${{ github.token }}
61 - name: Set GSL preference for vcpkg
62 shell: bash
63 run: |
64 mkdir ~/.brian/
65 # Replaces backslashes with forward slashes
66 echo "GSL.directory=\"${{ github.workspace }}\\vcpkg\\installed\${{ matrix.os.triplet }}\\include"\" | tr '\\' '/' > ~/.brian/user_preferences
67 cat ~/.brian/user_preferences
68 - name: Install Python
69 id: python
70 uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
71 with:
72 cache: 'pip'
73 python-version: ${{ matrix.python-version }}
74 allow-prereleases: true
75 - name: Install dependencies
76 shell: bash
77 env:
78 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
79 run: |
80 "$PYTHON_BINARY" -m pip install --upgrade pip setuptools
81 "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
82 "$PYTHON_BINARY" -m pip install mpmath # install stable version
83 "$PYTHON_BINARY" -m pip install --pre pytest pytest-xdist pytest-cov pytest-timeout cython sympy pyparsing jinja2 sphinx
84 - name: Install Brian2
85 shell: bash
86 env:
87 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
88 run: |
89 "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
90 - name: Run Tests
91 shell: bash
92 run: |
93 cd "$GITHUB_WORKSPACE"/.. # move out of the workspace to avoid direct import
94 "$PYTHON_BINARY" -Wd "$GITHUB_WORKSPACE/dev/continuous-integration/run_test_suite.py"
95 env:
96 AGENT_OS: ${{runner.os}}
97 STANDALONE: ${{ matrix.standalone }}
98 FLOAT_DTYPE_32: ${{ matrix.float_dtype_32 }}
99 DO_NOT_RESET_PREFERENCES: true # Make sure that GSL setting is used
100 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
101
102 test-deprecations:
103 needs: [ get_python_versions ]
104 name: "Python ${{ matrix.python-version }} check for deprecation warnings on (standalone: ${{ matrix.standalone }}"
105 runs-on: ubuntu-latest
106 strategy:
107 fail-fast: false
108 matrix:
109 standalone: [ false, true ]
110 python-version: [ "${{ needs.get_python_versions.outputs.max-python }}" ]
111
112 steps:
113 - name: Checkout Repository
114 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
115 with:
116 fetch-depth: 0
117 persist-credentials: false
118 - name: Install GSL
119 uses: johnwason/vcpkg-action@ff71808de10afc0e3160fd079353c69ba0d7dd60 # v7.0.0
120 id: vcpkg
121 with:
122 pkgs: gsl
123 triplet: x64-linux
124 cache-key: gsl-x64-linux
125 revision: master
126 token: ${{ github.token }}
127 - name: Set GSL preference for vcpkg
128 shell: bash
129 run: |
130 mkdir ~/.brian/
131 # Replaces backslashes with forward slashes
132 echo "GSL.directory=\"${{ github.workspace }}\\vcpkg\\installed\x64-linux\\include"\" | tr '\\' '/' > ~/.brian/user_preferences
133 cat ~/.brian/user_preferences
134 - name: Install Python
135 id: python
136 uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
137 with:
138 cache: 'pip'
139 python-version: ${{ matrix.python-version }}
140 allow-prereleases: true
141 - name: Install dependencies
142 env:
143 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
144 run: |
145 "$PYTHON_BINARY" -m pip install --upgrade pip setuptools
146 "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
147 "$PYTHON_BINARY" -m pip install --pre pytest cython sympy pyparsing jinja2 sphinx
148 - name: Install Brian2
149 env:
150 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
151 run: |
152 "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
153 - name: Determine Cython cache dir
154 id: cython-cache
155 run: |
156 cd $GITHUB_WORKSPACE/.. # move out of the workspace to avoid direct import
157 CACHE_DIR=$("$PYTHON_BINARY" -c 'from brian2.codegen.runtime.cython_rt.extension_manager import get_cython_cache_dir; print(get_cython_cache_dir())')
158 echo "Cython cache dir: $CACHE_DIR"
159 echo "cachedir=$CACHE_DIR" >> "$GITHUB_OUTPUT"
160 env:
161 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
162 - name: restore Cython cache
163 uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
164 if: ${{ ! matrix.standalone }}
165 with:
166 key: cython-extensions-latest-${{ matrix.os }}-${{ matrix.python-version }}-32bit-${{ matrix.float_dtype_32 }}
167 path: ${{ steps.cython-cache.outputs.cachedir }}
168 - name: Run Tests
169 run: |
170 cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
171 "$PYTHON_BINARY" -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py || echo "Tests failed (but not marked as failed on GA)"
172 env:
173 DEPRECATION_ERROR: true
174 AGENT_OS: linux
175 STANDALONE: ${{ matrix.standalone }}
176 PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
177 DO_NOT_RESET_PREFERENCES: true # Make sure that GSL setting is used