Switch to unified view

a b/.github/workflows/tests.yml
1
name: 'Tests'
2
concurrency:
3
  group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
  cancel-in-progress: true
5
on:  # yamllint disable-line rule:truthy
6
  push:
7
    branches: ["main", "maint/*"]
8
  pull_request:
9
    branches: ["main", "maint/*"]
10
11
permissions:
12
  contents: read
13
14
jobs:
15
  style:
16
    name: Style
17
    runs-on: ubuntu-latest
18
    timeout-minutes: 3
19
    steps:
20
      - uses: actions/checkout@v4
21
        with:
22
          persist-credentials: false
23
      - uses: actions/setup-python@v5
24
        with:
25
          python-version: '3.12'
26
      - uses: pre-commit/action@v3.0.1
27
      - run: pip install mypy numpy scipy vulture
28
      - run: mypy
29
      - run: vulture
30
31
  bandit:
32
    name: Bandit
33
    needs: style
34
    runs-on: ubuntu-latest
35
    steps:
36
      - uses: davidslusser/actions_python_bandit@v1.0.1
37
        with:
38
          src: "mne"
39
          options: "-c pyproject.toml -ll -r"
40
          pip_install_command: "pip install bandit[toml]"
41
42
  pytest:
43
    name: '${{ matrix.os }} / ${{ matrix.kind }} / ${{ matrix.python }}'
44
    needs: style
45
    timeout-minutes: 80
46
    runs-on: ${{ matrix.os }}
47
    defaults:
48
      run:
49
        shell: bash -el {0}
50
    env:
51
      PYTHON_VERSION: '${{ matrix.python }}'
52
      MKL_NUM_THREADS: '1'
53
      OPENBLAS_NUM_THREADS: '1'
54
      PYTHONUNBUFFERED: '1'
55
      MNE_CI_KIND: '${{ matrix.kind }}'
56
      CI_OS_NAME: '${{ matrix.os }}'
57
    strategy:
58
      fail-fast: false
59
      matrix:
60
        include:
61
          - os: ubuntu-latest
62
            python: '3.13'
63
            kind: pip
64
          - os: ubuntu-latest
65
            python: '3.12'
66
            kind: pip-pre
67
          - os: ubuntu-latest
68
            python: '3.12'
69
            kind: conda
70
          - os: macos-latest  # arm64 (Apple Silicon)
71
            python: '3.12'
72
            kind: mamba
73
          - os: macos-13  # latest Intel release
74
            python: '3.12'
75
            kind: mamba
76
          - os: windows-latest
77
            python: '3.10'
78
            kind: mamba
79
          - os: ubuntu-latest
80
            python: '3.10'
81
            kind: minimal
82
          - os: ubuntu-22.04
83
            python: '3.10'
84
            kind: old
85
    steps:
86
      - uses: actions/checkout@v4
87
        with:
88
          fetch-depth: 0
89
          persist-credentials: false
90
      - run: ./tools/github_actions_env_vars.sh
91
      # Xvfb/OpenGL
92
      - uses: pyvista/setup-headless-display-action@v3
93
        with:
94
          qt: true
95
          pyvista: false
96
          wm: false
97
      # Python (if pip)
98
      - uses: actions/setup-python@v5
99
        with:
100
          python-version: ${{ matrix.python }}
101
        if: startswith(matrix.kind, 'pip')
102
      # Python (if conda)
103
      - name: Fixes for conda
104
        run: |
105
          # For some reason on Linux we get crashes
106
          if [[ "$RUNNER_OS" == "Linux" ]]; then
107
            sed -i "/numba/d" environment.yml
108
          elif [[ "$RUNNER_OS" == "macOS" ]]; then
109
            sed -i "" "s/  - PySide6 .*/  - PySide6 <6.8/g" environment.yml
110
          fi
111
        if: matrix.kind == 'conda' || matrix.kind == 'mamba'
112
      - uses: mamba-org/setup-micromamba@v2
113
        with:
114
          environment-file: ${{ env.CONDA_ENV }}
115
          environment-name: mne
116
          create-args: >-
117
            python=${{ env.PYTHON_VERSION }}
118
        if: ${{ !startswith(matrix.kind, 'pip') }}
119
      - run: bash ./tools/github_actions_dependencies.sh
120
      # Minimal commands on Linux (macOS stalls)
121
      - run: bash ./tools/get_minimal_commands.sh
122
        if: startswith(matrix.os, 'ubuntu') && matrix.kind != 'minimal' && matrix.kind != 'old'
123
      - run: bash ./tools/github_actions_infos.sh
124
      # Check Qt
125
      - run: bash ./tools/check_qt_import.sh $MNE_QT_BACKEND
126
        if: env.MNE_QT_BACKEND != ''
127
      - name: Run tests with no testing data
128
        run: MNE_SKIP_TESTING_DATASET_TESTS=true pytest -m "not (ultraslowtest or pgtest)" --tb=short --cov=mne --cov-report xml -vv -rfE mne/
129
        if: matrix.kind == 'minimal'
130
      - run: ./tools/get_testing_version.sh
131
      - uses: actions/cache@v4
132
        with:
133
          key: ${{ env.TESTING_VERSION }}
134
          path: ~/mne_data
135
      - run: bash ./tools/github_actions_download.sh
136
      - 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
137
      - uses: codecov/codecov-action@v5
138
        with:
139
          token: ${{ secrets.CODECOV_TOKEN }}
140
        if: success() || failure()