name: Test against latest dependencies on: schedule: - cron: '25 5 * * SUN' workflow_dispatch: permissions: contents: read jobs: get_python_versions: name: "Determine Python versions" runs-on: ubuntu-latest permissions: {} outputs: min-python: ${{ steps.nep29.outputs.min-python }} max-python: ${{ steps.nep29.outputs.max-python }} steps: - name: "calculate versions according to SPEC-0" id: nep29 uses: mstimberg/github-calc-nep29@a73481e4e8488a5fa0b3be70a385cc5206a261ba # v0.7 with: include-release-candidates: true include-beta-releases: true # Match SPEC-0 deprecate-python-after: 36 min-python-releases: 0 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-15-intel, triplet: x64-osx}, {image: macos-latest, 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@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: fetch-depth: 0 persist-credentials: false - name: Install GSL uses: johnwason/vcpkg-action@ff71808de10afc0e3160fd079353c69ba0d7dd60 # v7.0.0 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@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: cache: 'pip' python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Install dependencies shell: bash env: PYTHON_BINARY: ${{ steps.python.outputs.python-path }} run: | "$PYTHON_BINARY" -m pip install --upgrade pip setuptools "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy "$PYTHON_BINARY" -m pip install mpmath # install stable version "$PYTHON_BINARY" -m pip install --pre pytest pytest-xdist pytest-cov pytest-timeout cython sympy pyparsing jinja2 sphinx - name: Install Brian2 shell: bash env: PYTHON_BINARY: ${{ steps.python.outputs.python-path }} run: | "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple . - name: Run Tests shell: bash run: | cd "$GITHUB_WORKSPACE"/.. # move out of the workspace to avoid direct import "$PYTHON_BINARY" -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 PYTHON_BINARY: ${{ steps.python.outputs.python-path }} 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@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 with: fetch-depth: 0 persist-credentials: false - name: Install GSL uses: johnwason/vcpkg-action@ff71808de10afc0e3160fd079353c69ba0d7dd60 # v7.0.0 id: vcpkg with: pkgs: gsl triplet: x64-linux cache-key: gsl-x64-linux 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\x64-linux\\include"\" | tr '\\' '/' > ~/.brian/user_preferences cat ~/.brian/user_preferences - name: Install Python id: python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: cache: 'pip' python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Install dependencies env: PYTHON_BINARY: ${{ steps.python.outputs.python-path }} run: | "$PYTHON_BINARY" -m pip install --upgrade pip setuptools "$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy "$PYTHON_BINARY" -m pip install --pre pytest cython sympy pyparsing jinja2 sphinx - name: Install Brian2 env: PYTHON_BINARY: ${{ steps.python.outputs.python-path }} run: | "$PYTHON_BINARY" -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: | cd $GITHUB_WORKSPACE/.. # move out of the workspace to avoid direct import CACHE_DIR=$("$PYTHON_BINARY" -c 'from brian2.codegen.runtime.cython_rt.extension_manager import get_cython_cache_dir; print(get_cython_cache_dir())') echo "Cython cache dir: $CACHE_DIR" echo "cachedir=$CACHE_DIR" >> "$GITHUB_OUTPUT" env: PYTHON_BINARY: ${{ steps.python.outputs.python-path }} - name: restore Cython cache uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 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 "$PYTHON_BINARY" -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 }} PYTHON_BINARY: ${{ steps.python.outputs.python-path }} DO_NOT_RESET_PREFERENCES: true # Make sure that GSL setting is used