diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b598df23035..81b481fb6d7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -104,8 +104,11 @@ jobs: python-version: ${{ matrix.python }} if: startswith(matrix.kind, 'pip') || matrix.kind == 'minimal' id: setup-python - # Workaround macOS path behavior with login shells (which puts system Python first) - - run: echo "export PATH=\"$(dirname ${{ steps.setup-python.outputs.python-path }}):$PATH\"" | tee -a ~/.bash_profile # zizmor: ignore[template-injection] + # Workaround macOS path behavior with login shells (which puts system Python first). + # \$PATH must stay escaped so that it is expanded when each login shell sources + # ~/.bash_profile: writing the expanded value would freeze PATH as of this step and + # silently discard anything a later step adds to $GITHUB_PATH. + - run: echo "export PATH=\"$(dirname ${{ steps.setup-python.outputs.python-path }}):\$PATH\"" | tee -a ~/.bash_profile # zizmor: ignore[template-injection] if: startswith(matrix.kind, 'pip') && startswith(matrix.os, 'macos') # Python (if conda) - uses: mamba-org/setup-micromamba@v3 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2e365dd744f..7b4fd72b4c1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,7 +56,7 @@ stages: displayName: Setup up Xvfb - task: Cache@2 inputs: - key: minimal-cmds-1 + key: '"minimal-cmds" | "$(Agent.OS)" | $(MNE_TOOLS_DIR)/tools/get_minimal_commands.sh' path: /home/vsts/minimal_cmds displayName: Cache minimal commands - bash: $(MNE_TOOLS_DIR)/tools/get_minimal_commands.sh @@ -166,6 +166,7 @@ stages: pool: vmImage: 'windows-latest' variables: + MNE_TOOLS_DIR: '$(Pipeline.Workspace)/mne-tools' MNE_LOGGING_LEVEL: 'warning' MNE_FORCE_SERIAL: 'true' PYTEST_XDIST_N: '2' # Microsoft-hosted agents have 2 cores @@ -181,17 +182,33 @@ stages: 3.14 pip: TEST_MODE: 'pip' PYTHON_VERSION: '3.14' - MNE_TEST_ALLOW_SKIP: "^.*(Requires (spm|brainstorm) dataset|Requires MNE-C|Requires FreeSurfer|CUDA not|on Windows|MNE_FORCE_SERIAL|PySide6 causes segfaults|SCIPY_ARRAY_API).*$" + MNE_TEST_ALLOW_SKIP: "^.*(Requires (spm|brainstorm) dataset|Requires FreeSurfer|CUDA not|on Windows|MNE_FORCE_SERIAL|PySide6 causes segfaults|SCIPY_ARRAY_API).*$" 3.14 pip pre: TEST_MODE: 'pip-pre' PYTHON_VERSION: '3.14' - MNE_TEST_ALLOW_SKIP: "^.*(Requires (spm|brainstorm) dataset|Requires MNE-C|Requires FreeSurfer|CUDA not|Numba not|on Windows|MNE_FORCE_SERIAL|PySide6 causes segfaults|SCIPY_ARRAY_API).*$" + MNE_TEST_ALLOW_SKIP: "^.*(Requires (spm|brainstorm) dataset|Requires FreeSurfer|CUDA not|Numba not|on Windows|MNE_FORCE_SERIAL|PySide6 causes segfaults|SCIPY_ARRAY_API).*$" steps: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) architecture: 'x64' addToPath: true + - bash: | + set -xeo pipefail + git clone --depth 1 https://github.com/mne-tools/mne-tools.git "$MNE_TOOLS_DIR" + displayName: Clone mne-tools + - task: Cache@2 + inputs: + key: '"minimal-cmds" | "$(Agent.OS)" | $(MNE_TOOLS_DIR)/tools/get_minimal_commands.sh' + path: C:\Users\VssAdministrator\minimal_cmds + displayName: Cache minimal commands + # MNE_TOOLS_DIR is a Windows path and these steps run under Git Bash, hence + # cygpath; backticks rather than $(...) so Azure does not read it as a macro + - bash: | + set -eo pipefail + MNE_TOOLS_UNIX=`cygpath -u "$MNE_TOOLS_DIR"` + bash "$MNE_TOOLS_UNIX/tools/get_minimal_commands.sh" + displayName: Get minimal commands - bash: | set -xeo pipefail git clone --depth 1 https://github.com/pyvista/setup-headless-display-action.git @@ -216,6 +233,11 @@ stages: displayName: Cache testing data - bash: ./tools/github_actions_download.sh displayName: Download testing data + # Windows does not define HOME, and MNE-C dereferences it unconditionally: + # mne_forward_solution crashes with 0xC0000005 without it. Set after the + # steps above so that Git Bash keeps deriving its own MSYS-style HOME. + - script: 'echo ##vso[task.setvariable variable=HOME]%USERPROFILE%' + displayName: Set HOME for MNE-C - script: pytest -m "not (slowtest or pgtest)" -n $(PYTEST_XDIST_N) --dist loadscope --timeout=120 --timeout-method=thread -o faulthandler_timeout=110 --tb=short --cov=mne --cov-report=xml -vv mne displayName: Run tests - bash: bash <(curl -s https://codecov.io/bash) diff --git a/tools/github_actions_env_vars.sh b/tools/github_actions_env_vars.sh index a687363cd6f..f02ec36d90c 100755 --- a/tools/github_actions_env_vars.sh +++ b/tools/github_actions_env_vars.sh @@ -38,7 +38,7 @@ if [[ "$MNE_CI_KIND" == "pip"* ]]; then echo "MNE_QT_BACKEND=PySide6" | tee -a $GITHUB_ENV elif [[ "$MNE_CI_KIND" == "pip" ]]; then if [[ "${RUNNER_OS}" == "macOS" ]]; then - echo "MNE_TEST_ALLOW_SKIP=.*(Requires (spm|brainstorm|misc) dataset|SCIPY_ARRAY_API|FreeSurfer|MNE-C|CUDA not|macOS|PySide6 causes segfaults).*" | tee -a $GITHUB_ENV + echo "MNE_TEST_ALLOW_SKIP=.*(Requires (spm|brainstorm|misc) dataset|SCIPY_ARRAY_API|FreeSurfer|CUDA not|macOS|PySide6 causes segfaults).*" | tee -a $GITHUB_ENV else echo "MNE_TEST_ALLOW_SKIP=.*(Requires (spm|brainstorm|misc) dataset|SCIPY_ARRAY_API|CUDA not|PySide6 causes segfaults).*" | tee -a $GITHUB_ENV fi diff --git a/tools/github_actions_test.sh b/tools/github_actions_test.sh index 94fee65b89e..a906960b538 100755 --- a/tools/github_actions_test.sh +++ b/tools/github_actions_test.sh @@ -16,8 +16,7 @@ elif [[ "${CI_OS_NAME}" == "macos"* ]]; then if [[ "$(uname -m)" == "arm64" ]]; then CONDITION="not (ultraslowtest or pgtest)" else - # TODO: the MNE-C tools are on PATH during setup but not once the tests run (gh-14230) - CONDITION="not (slowtest or pgtest or mne_c)" + CONDITION="not (slowtest or pgtest)" fi elif [[ "${CI_OS_NAME}" == "windows"* ]]; then CONDITION="not (slowtest or pgtest)"