diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 14c79460e2f..6f2327b2458 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,7 +54,7 @@ jobs: runs-on: ${{ matrix.os }} defaults: run: - shell: bash -el {0} + shell: bash -e {0} env: PYTHON_VERSION: '${{ matrix.python }}' MKL_NUM_THREADS: '1' @@ -81,7 +81,7 @@ jobs: kind: mamba - os: macos-15-intel # intel: Sequoia python: '3.13' - kind: mamba + kind: pixi - os: windows-latest python: '3.11' kind: mamba @@ -123,6 +123,12 @@ jobs: with: python-version: ${{ matrix.python }} if: startswith(matrix.kind, 'pip') + - uses: prefix-dev/setup-pixi@v0.9.4 + with: + activate-environment: false + run-install: false + cache: false # caching depends on existence of a pixi.lock file + if: matrix.kind == 'pixi' # Python (if conda) - name: Fixes for conda run: | @@ -151,15 +157,47 @@ jobs: create-args: >- python=${{ env.PYTHON_VERSION }} -v - if: ${{ !startswith(matrix.kind, 'pip') }} + generate-run-shell: true + init-shell: none + if: ${{ !startswith(matrix.kind, 'pip') && matrix.kind != 'pixi' }} timeout-minutes: 20 + - name: Create pixi.toml + if: matrix.kind == 'pixi' + # environment.yml specifies the same python version as macos-intel CI (3.13) + # but let's expliclty set the version, in case these ever diverge in the future? + run: | + pixi init --import environment.yml + pixi add "python==${{ matrix.python }}" --no-install + - name: Setup pixi environment + if: matrix.kind == 'pixi' + run: pixi install + # Now run setup-pixi again in order to activate the enviroment + - uses: prefix-dev/setup-pixi@v0.9.4 + if: matrix.kind == 'pixi' + with: + run-install: true + activate-environment: true + cache: false + - name: Verify Environment + run: echo $PATH + - name: Debug Qt availability + if: matrix.kind == 'conda' || matrix.kind == 'mamba' || matrix.kind == 'old' || matrix.kind == 'minimal' + run: | + python -c "import sys; print(sys.executable)" + python -c "from importlib.metadata import version; print('pip version', version('pip'))" + python -c "from importlib import util; print('PySide6', util.find_spec('PySide6'))" - run: bash ./tools/github_actions_dependencies.sh + if: ${{ matrix.kind != 'pixi' && !startswith(matrix.kind, 'pip') && runner.os != 'Windows' }} + shell: micromamba-shell {0} - run: python ./tools/github_actions_check_old.py if: matrix.kind == 'old' + shell: micromamba-shell {0} # Minimal commands on Linux (macOS stalls) - run: bash ./tools/get_minimal_commands.sh if: startswith(matrix.os, 'ubuntu') && matrix.kind != 'minimal' && matrix.kind != 'old' - run: bash ./tools/github_actions_infos.sh + if: ${{ matrix.kind != 'pixi' && !startswith(matrix.kind, 'pip') && runner.os != 'Windows' }} + shell: micromamba-shell {0} # Check Qt - run: bash ./tools/check_qt_import.sh $MNE_QT_BACKEND if: env.MNE_QT_BACKEND != '' @@ -172,7 +210,14 @@ jobs: key: ${{ env.TESTING_VERSION }} path: ~/mne_data - run: bash ./tools/github_actions_download.sh + - name: Debug interpreter + Qt + if: matrix.kind == 'pixi' + run: | + pixi run python -c "import sys; print(sys.executable)" + pixi run python -c "import PySide6; print(PySide6.__version__)" - run: bash ./tools/github_actions_test.sh # for some reason on macOS we need to run "bash X" in order for a failed test run to show up + if: ${{ matrix.kind != 'pixi' && !startswith(matrix.kind, 'pip') && runner.os != 'Windows' }} + shell: micromamba-shell {0} - uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/tools/github_actions_dependencies.sh b/tools/github_actions_dependencies.sh index 8835270734b..27a8795d1d7 100755 --- a/tools/github_actions_dependencies.sh +++ b/tools/github_actions_dependencies.sh @@ -25,6 +25,9 @@ if [ ! -z "$CONDA_ENV" ]; then GROUP="test_extra" EXTRAS="[hdf5]" fi +elif [[ "${MNE_CI_KIND}" == "pixi" ]]; then + GROUP="test_extra" + EXTRAS="[hdf5]" elif [[ "${MNE_CI_KIND}" == "pip" ]]; then GROUP="test_extra" EXTRAS="[full-pyside6]" diff --git a/tools/github_actions_env_vars.sh b/tools/github_actions_env_vars.sh index 37875308995..ee568976184 100755 --- a/tools/github_actions_env_vars.sh +++ b/tools/github_actions_env_vars.sh @@ -24,7 +24,14 @@ else # conda-like echo "CONDA_ENV=tools/environment_minimal.yml" | tee -a $GITHUB_ENV echo "MNE_QT_BACKEND=PySide6" | tee -a $GITHUB_ENV else # conda, mamba (use warning level for completeness) - echo "CONDA_ENV=environment.yml" | tee -a $GITHUB_ENV + # Pixi is treated as Conda-like (it uses environment.yaml) but it should not export + # CONDA_ENV because github_actions_dependencies.sh uses the existence of the + # CONDA_ENV environment variable to assume that the conda/mamba command is on + # PATH, which it is not for pixi jobs. + if [[ "$MNE_CI_KIND" != "pixi" ]]; then + echo "CONDA_ENV=environment.yml" | tee -a $GITHUB_ENV + fi + echo "MNE_LOGGING_LEVEL=warning" | tee -a $GITHUB_ENV echo "MNE_QT_BACKEND=PySide6" | tee -a $GITHUB_ENV # TODO: Also need "|unreliable on GitHub Actions conda" on macOS, but omit for now to make sure the failure actually shows up