Skip to content

Commit

Permalink
Merge pull request #1528 from brian-team/cache_cython_on_CI
Browse files Browse the repository at this point in the history
Cache cython on CI
  • Loading branch information
mstimberg authored Apr 23, 2024
2 parents 70ec299 + 3317aca commit 222a47b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ jobs:
${{ 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-${{ matrix.os }}-${{ matrix.python-version }}-32bit-${{ matrix.float_dtype_32 }}
path: ${{ steps.cython-cache.outputs.cachedir }}
- name: Run Tests
run: |
cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ jobs:
run: |
conda install --quiet --yes pip gsl
python -m pip install .[test] coverage
- 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-${{ matrix.os }}-${{ matrix.python-version }}-32bit-${{ matrix.float_dtype_32 }}
path: ${{ steps.cython-cache.outputs.cachedir }}

- name: Run Tests
run: |
Expand Down

0 comments on commit 222a47b

Please sign in to comment.