Add test that GIL stays disabled on free-threaded python (#536) #462
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} | |
| cancel-in-progress: true | |
| on: # yamllint disable-line rule:truthy | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| jobs: | |
| get_commit_message: | |
| name: get commit message | |
| runs-on: ubuntu-slim | |
| outputs: | |
| commit_message: ${{ steps.get_message.outputs.commit_message }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # ensure the correct commit is checked out for PRs or pushes | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| fetch-depth: 1 | |
| - run: echo "commit_message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT | |
| id: get_message | |
| cibuildwheel: | |
| needs: get_commit_message | |
| name: build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - uses: astral-sh/setup-uv@v7 | |
| - uses: pypa/cibuildwheel@v3.4.1 | |
| env: | |
| MNE_LSL_LIBLSL_BUILD_UNITTESTS: ${{ (github.event_name != 'pull_request' || contains(needs.get_commit_message.outputs.commit_message, '[liblsl]')) && '1' || '0' }} | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| path: ./wheelhouse/*.whl | |
| test: | |
| needs: cibuildwheel | |
| name: test wheels on ${{ matrix.os }} - py${{ matrix.python }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest] | |
| python: ["3.11", "3.14"] | |
| include: | |
| - os: ubuntu-latest | |
| python: "3.14t" | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: true | |
| python-version: ${{ matrix.python }} | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: cibw-wheels-${{ matrix.os }}-* | |
| merge-multiple: true | |
| path: dist | |
| - run: ls -alt . && ls -alt dist/ | |
| - run: uv sync -q --locked --no-default-groups --group test --no-install-project | |
| - run: uv pip install mne-lsl -q --only-binary mne-lsl --find-links dist --pre | |
| - run: mne-lsl sys-info | |
| - uses: ./.github/actions/get-testing-dataset | |
| - name: Run pytest | |
| uses: ./.github/actions/retry-step | |
| with: | |
| command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s | |
| retry_error_codes: "3,127,134,139" | |
| env: | |
| MNE_LSL_LOG_LEVEL: DEBUG | |
| - uses: codecov/codecov-action@v6 | |
| if: ${{ github.repository == 'mne-tools/mne-lsl' }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-pip-pre: | |
| needs: cibuildwheel | |
| name: test pip pre-release - py${{ matrix.python }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.13"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: true | |
| python-version: ${{ matrix.python }} | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: cibw-wheels-ubuntu-latest-* | |
| merge-multiple: true | |
| path: dist | |
| - run: ls -alt . && ls -alt dist/ | |
| - run: uv sync -q --locked --no-default-groups --group test --no-install-project | |
| - run: | | |
| uv pip install mne-lsl -q --only-binary mne-lsl --find-links dist --pre | |
| uv pip install git+https://github.com/mne-tools/mne-python -q --upgrade | |
| uv pip install matplotlib -q | |
| uv pip install matplotlib -q --upgrade --prerelease allow --only-binary :all: -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --no-deps | |
| uv pip install numpy scipy -q --upgrade --prerelease allow --only-binary :all: -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple | |
| - run: mne-lsl sys-info | |
| - uses: ./.github/actions/get-testing-dataset | |
| - name: Run pytest | |
| uses: ./.github/actions/retry-step | |
| with: | |
| command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s | |
| retry_error_codes: "3,134,139" | |
| env: | |
| MNE_LSL_LOG_LEVEL: DEBUG | |
| - uses: codecov/codecov-action@v6 | |
| if: ${{ github.repository == 'mne-tools/mne-lsl' }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-editable: | |
| name: test editable install | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: true | |
| python-version: '3.13' | |
| - run: uv sync -q --locked --no-default-groups --group test | |
| - run: mne-lsl sys-info --developer | |
| - name: Run pytest | |
| uses: ./.github/actions/retry-step | |
| with: | |
| command: pytest tests/ --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s | |
| retry_error_codes: "3,134,139" | |
| env: | |
| MNE_LSL_LOG_LEVEL: DEBUG | |
| - uses: codecov/codecov-action@v6 | |
| if: ${{ github.repository == 'mne-tools/mne-lsl' }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| sdist: | |
| name: create sdist | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv build --sdist | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: cibw-wheels-sdist | |
| path: ./dist/*.tar.gz | |
| check: | |
| needs: [cibuildwheel, sdist] | |
| name: run twine check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: cibw-wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - run: ls -alt . && ls -alt dist/ | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uvx twine check --strict dist/* | |
| doc-build: | |
| needs: cibuildwheel | |
| name: build documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: sudo apt update && sudo apt install -y optipng | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: true | |
| python-version: '3.13' | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: cibw-wheels-ubuntu-latest-* | |
| merge-multiple: true | |
| path: dist | |
| - run: ls -alt . && ls -alt dist/ | |
| - run: uv sync -q --locked --no-default-groups --group doc --no-install-project | |
| - run: uv pip install mne-lsl -q --only-binary mne-lsl --find-links dist --pre | |
| - run: mne-lsl sys-info | |
| - uses: ./.github/actions/get-testing-dataset | |
| with: | |
| sample: "true" | |
| testing: "false" | |
| - uses: ./.github/actions/retry-step | |
| with: | |
| command: "make -C doc html" | |
| retry_error_codes: "2" | |
| command_between_retries: "make -C doc clean" | |
| - run: rm -R ./doc/_build/html/.doctrees | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: doc-dev | |
| path: ./doc/_build/html | |
| doc-deploy-dev: | |
| if: ${{ github.event_name == 'push' && github.repository == 'mne-tools/mne-lsl' }} | |
| needs: doc-build | |
| name: deploy development documentation | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: doc-dev | |
| path: ./doc-dev | |
| - uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: ./doc-dev | |
| target-folder: ./dev | |
| git-config-name: 'github-actions[bot]' | |
| git-config-email: 'github-actions[bot]@users.noreply.github.com' | |
| single-commit: true | |
| force: true | |
| doc-deploy-release: | |
| if: ${{ github.event_name == 'release' && github.repository == 'mne-tools/mne-lsl' }} | |
| needs: doc-build | |
| name: deploy stable documentation | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: gh-pages | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: doc-dev | |
| path: ./doc-dev | |
| - name: Get previous release tag | |
| run: | | |
| PREVIOUS_RELEASE_TAG=$(git tag --sort=-creatordate | sed "/^$RELEASE_TAG$/d" | sed -n 1p) | |
| if [ -z "$PREVIOUS_RELEASE_TAG" ]; then | |
| echo "No previous release tag found." | |
| exit 1 | |
| fi | |
| echo "Previous release tag: $PREVIOUS_RELEASE_TAG" | |
| echo "PREVIOUS_RELEASE_TAG=$PREVIOUS_RELEASE_TAG" >> $GITHUB_ENV | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| - name: Move stable to previous release tag | |
| run: | | |
| if [ -d "stable" ]; then | |
| if [ -d "$PREVIOUS_RELEASE_TAG" ]; then | |
| echo "Folder $PREVIOUS_RELEASE_TAG already exists. Exiting." | |
| exit 1 | |
| fi | |
| git mv stable "$PREVIOUS_RELEASE_TAG" | |
| else | |
| echo "No stable folder found." | |
| exit 1 | |
| fi | |
| - run: mv doc-dev stable | |
| - run: rm -rf dev && cp -r stable dev | |
| if: github.event.release.target_commitish == 'main' | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add . | |
| git commit -m "update documentation for release ${{ github.event.release.tag_name }}" | |
| git push origin gh-pages | |
| publish: | |
| if: ${{ github.event_name == 'release' && github.repository == 'mne-tools/mne-lsl' }} | |
| needs: [check, test, test-pip-pre, test-editable, doc-deploy-release] | |
| name: publish to PyPI | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| id-token: write | |
| contents: write | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/mne-lsl | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: cibw-wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: softprops/action-gh-release@v3 | |
| with: | |
| files: dist/* | |
| tag_name: ${{ github.event.release.tag_name }} | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |