ENH: Build and bundle liblsl in wheels #22
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 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install wheel | |
shell: bash | |
run: | | |
set -eo pipefail | |
FNAME=$PWD/wheelhouse/*.whl | |
echo "FNAME=$FNAME" | |
test -f $FNAME | |
pip install "mne-lsl[test] @ file://$FNAME" | |
- run: python -c "import mne_lsl; mne_lsl.sys_info()" | |
- uses: actions/checkout@v4 # to get the pyproject.toml | |
- name: Get installed library location | |
shell: bash | |
run: | | |
set -eo pipefail | |
rm -Rf mne_lsl # remove checked out one to avoid conflicts | |
TEST_PATH=$(python -c "import pathlib, mne_lsl; print(str(pathlib.Path(mne_lsl.__file__).parent))") | |
echo "TEST_PATH=$TEST_PATH" | tee -a $GITHUB_ENV | |
- name: Run pytest | |
uses: ./.github/actions/retry-step | |
with: | |
command: pytest mne_lsl --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s "$TEST_PATH" | |
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() |