Skip to content

Commit

Permalink
Use OS-independent Cython cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mstimberg committed Apr 22, 2024
1 parent 6188f4c commit 0e50207
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test_latest.yml
Expand Up @@ -122,12 +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: ~/.cython/brian_extensions
path: ${{ steps.cython-cache.outputs.cachedir }}
- name: Run Tests
run: |
cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/testsuite.yml
Expand Up @@ -74,13 +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: ~/.cython/brian_extensions
path: ${{ steps.cython-cache.outputs.cachedir }}

- name: Run Tests
run: |
Expand Down

0 comments on commit 0e50207

Please sign in to comment.