ENH: Build and bundle liblsl in wheels #31
Workflow file for this run
This file contains 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: Wheels | |
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: | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# For some reason doing this in pyproject.toml does not seem to work :( | |
- name: Set Windows compilation env vars | |
shell: bash | |
run: | | |
set -exo pipefail | |
echo "INCLUDE=$GITHUB_WORKSPACE\\liblsl\\include" | tee -a $GITHUB_ENV | |
echo "LIB=$GITHUB_WORKSPACE\\liblsl\\build\\Release" | tee -a $GITHUB_ENV | |
echo "ADD_PATH=$(cygpath -w $GITHUB_WORKSPACE)\\liblsl\\build\\Release" | tee -a $GITHUB_ENV | |
if: runner.os == 'Windows' | |
- uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
test_wheels: | |
name: Test wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: build_wheels | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-wheels-${{ matrix.os }}-* | |
merge-multiple: true | |
path: wheelhouse | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install wheel | |
shell: bash | |
run: | | |
set -eo pipefail | |
python -m pip install --upgrade pip setuptools wheel | |
ls -alR wheelhouse | |
FNAME=($PWD/wheelhouse/*.whl) | |
if type cygpath; then | |
FNAME=$(cygpath -w "$FNAME") | |
fi | |
echo "FNAME=$FNAME" | |
pip install "mne-lsl[test] @ file://$FNAME" | |
if: runner.os != 'Windows' | |
# Need to do separately until resolved: https://github.com/pypa/pip/issues/13062 | |
- name: Install wheel (windows) | |
shell: bash | |
run: | | |
set -eo pipefail | |
python -m pip install --upgrade pip setuptools wheel | |
pip install --dry-run --find-links wheelhouse --pre "mne_lsl[test]" | |
if: runner.os == 'Windows' | |
- run: python -c "import mne_lsl; mne_lsl.sys_info()" | |
env: | |
MNE_LSL_LOG_LEVEL: DEBUG | |
- name: Get installed library location | |
shell: bash | |
run: | | |
set -eo pipefail | |
MODULE_PATH=$(python -c "import pathlib, mne_lsl; print(pathlib.Path(mne_lsl.__file__).parent)") | |
echo "MODULE_PATH=$MODULE_PATH" | tee -a $GITHUB_ENV | |
- uses: actions/checkout@v4 # get pyproject.toml and tests | |
- name: rsync tests not installed with the module | |
shell: bash | |
run: | | |
set -exo pipefail | |
rsync -a --partial --progress mne_lsl/tests $MODULE_PATH/ | |
rm -Rf mne_lsl # remove checked out one to avoid conflicts | |
- name: Run pytest | |
uses: ./.github/actions/retry-step | |
with: | |
command: pytest "$MODULE_PATH" --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@v4 | |
with: | |
files: ./coverage.xml | |
flags: unittests # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: false # optional (default = false) | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true # optional (default = false) | |
if: success() || failure() |