From cb56f074f0bb6964b664dc7787bd53dbc4d3314a Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:19:06 +0100 Subject: [PATCH 1/9] Run tests with uv --- .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..496c320 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + paths-ignore: + - 'docs/**' + - 'examples/**' + workflow_call: + +jobs: + style: + name: Check style + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 + - uses: astral-sh/ruff-action@v3 + with: + args: "format --diff" + + test: + needs: style + strategy: + matrix: + os: [ubuntu-24.04, windows-2022, macos-15, macos-13] + python-version: ['3.10', '3.11', '3.12', '3.13'] + name: Run tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Set up Python ${{ matrix.python-version }} + run: uv python install ${{ matrix.python-version }} + - name: Install the project + run: uv sync --all-extras + - name: Run tests + run: uv run pytest --cov tests From 3b12e92455bec232be411275d18acabccfb951d3 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:27:53 +0100 Subject: [PATCH 2/9] Allow older tensorflow for macosx x86_64 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 36b4eec..c419339 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ full = [ # complete package functionality "joblib >= 1.4.2", "matplotlib >= 3.9.2", "numba >= 0.61.0", - "tensorflow >= 2.17.0; python_version < '3.13'", + "tensorflow >= 2.16.2; python_version < '3.13'", "wfdb >= 4.2.0", ] From eb6aa1586bbbaa99fcfbbb652f0b81fcba3c8acf Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:28:08 +0100 Subject: [PATCH 3/9] Remove current test runners --- .github/workflows/cibuildwheel.yml | 151 ----------------------------- 1 file changed, 151 deletions(-) delete mode 100644 .github/workflows/cibuildwheel.yml diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml deleted file mode 100644 index a3a3651..0000000 --- a/.github/workflows/cibuildwheel.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: Test -concurrency: - group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} - cancel-in-progress: true - -on: - pull_request: - paths-ignore: - - 'docs/**' - push: - branches: - - main - release: - types: - - published - -jobs: - style: - name: Check style - runs-on: ubuntu-22.04 - timeout-minutes: 2 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - uses: pre-commit/action@v3.0.1 - - build_wheels: - needs: style - strategy: - matrix: - os: [ubuntu-22.04, windows-2022, macos-15, macos-13] - arch: [native] - include: - - os: ubuntu-22.04 - arch: aarch64 - fail-fast: false - timeout-minutes: 15 # Linux ~1 min, Windows ~4 min, aarch64 emulated ~8 min with tests (~3 min without) - name: cibuildwheel (${{ matrix.os }} ${{ matrix.arch }}) - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - name: Set wheel tests to be skipped on emulated archs on PRs - run: | - if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "${{ matrix.arch }}" == "aarch64" ]]; then - echo "CIBW_TEST_SKIP=*" | tee -a $GITHUB_ENV - fi - shell: bash - # For aarch64 support https://cibuildwheel.pypa.io/en/stable/faq/#emulation - - uses: docker/setup-qemu-action@v3 - with: - platforms: all - if: runner.os == 'Linux' && matrix.arch == 'aarch64' - - name: Build wheels and run tests - uses: pypa/cibuildwheel@v2.22.0 - env: - CIBW_ARCHS: ${{ matrix.arch }} - - uses: actions/upload-artifact@v4 - with: - name: artifact-${{ matrix.os }}-${{ matrix.arch }} - path: ./wheelhouse/*.whl - - test: - needs: build_wheels - strategy: - matrix: - os: [ubuntu-22.04, windows-2022, macos-15, macos-13] - python-version: ['3.12'] - include: - - os: ubuntu-22.04 - python-version: '3.13' - fail-fast: false - name: Test wheels (${{ matrix.os }} py${{ matrix.python-version }}) - runs-on: ${{ matrix.os }} - timeout-minutes: 5 - defaults: - run: - shell: bash -eo pipefail {0} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v4 - with: - pattern: artifact-${{ matrix.os }}-native - merge-multiple: true - path: dist - - run: ls -al dist - - name: Triage dependencies - run: | - echo "PIP_EXTRA=wfdb numba pytest-error-for-skips" | tee -a $GITHUB_ENV - echo "PYTEST_EXTRA=--error-for-skips" | tee -a $GITHUB_ENV - - run: python -m pip install ./dist/*.whl pytest pytest-cov edfio $PIP_EXTRA --only-binary="numpy,numba,edfio" - - run: pytest -rfEXs --cov=sleepecg --cov-report=xml --tb=short --cov-branch --color=yes $PYTEST_EXTRA tests/ - - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - if: success() || failure() - - build_sdist: - needs: style - name: Build source distribution - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: 3.12 - - name: Build sdist - run: | - set -eo pipefail - python -m pip install build numpy - python -m build --sdist - - uses: actions/upload-artifact@v4 - with: - name: artifact-sdist - path: dist/*.tar.gz - - check_wheels: - needs: [build_wheels, build_sdist] - name: Check wheels and source distribution - runs-on: ubuntu-22.04 - steps: - - uses: actions/download-artifact@v4 - with: - pattern: artifact-* - merge-multiple: true - path: dist - - run: ls -al dist - shell: bash - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - run: python -m pip install twine - - run: python -m twine check --strict dist/* - - upload-pypi: - name: Upload to PyPI - needs: [check_wheels, test] - runs-on: ubuntu-latest - if: github.event_name == 'release' - steps: - - uses: actions/download-artifact@v4 - with: - pattern: artifact-* - merge-multiple: true - path: dist - - uses: pypa/gh-action-pypi-publish@v1.12.3 From 5032f1815053dd224cb3eec74a6e7b80ab5b9801 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:31:38 +0100 Subject: [PATCH 4/9] Remove macos-13 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 496c320..167a37d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: needs: style strategy: matrix: - os: [ubuntu-24.04, windows-2022, macos-15, macos-13] + os: [ubuntu-24.04, windows-2022, macos-15] python-version: ['3.10', '3.11', '3.12', '3.13'] name: Run tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) runs-on: ${{ matrix.os }} From daed2de9fbd902c7d54825b6678dc74b3b2f023b Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:36:07 +0100 Subject: [PATCH 5/9] Use cibw extra --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 167a37d..2c21013 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: needs: style strategy: matrix: - os: [ubuntu-24.04, windows-2022, macos-15] + os: [ubuntu-24.04, windows-2022, macos-13, macos-15] python-version: ['3.10', '3.11', '3.12', '3.13'] name: Run tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) runs-on: ${{ matrix.os }} @@ -35,7 +35,5 @@ jobs: uses: astral-sh/setup-uv@v5 - name: Set up Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }} - - name: Install the project - run: uv sync --all-extras - name: Run tests - run: uv run pytest --cov tests + run: uv run --extra cibw pytest --cov tests From 5b364d4db8271045e4a1622089220f76981152be Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:37:31 +0100 Subject: [PATCH 6/9] Add more packages --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c419339..65fc7b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,8 @@ doc = [ # RTD uses this when building the documentation cibw = [ # cibuildwheel uses this for running the test suite "edfio >= 0.4.4", "numba >= 0.61.0", + "pytest >= 6.2.0", + "pytest-cov >= 6.0.0", "wfdb >= 4.2.0", ] From ef3465ca92f3e05930416153b9125bbbfc4cb8b9 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:40:58 +0100 Subject: [PATCH 7/9] Remove macos-13 (really, it's too old) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c21013..519ffb1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: needs: style strategy: matrix: - os: [ubuntu-24.04, windows-2022, macos-13, macos-15] + os: [ubuntu-24.04, windows-2022, macos-15] python-version: ['3.10', '3.11', '3.12', '3.13'] name: Run tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) runs-on: ${{ matrix.os }} From e6b9e2391c67a66ce3599321dd3540172586d17a Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:45:48 +0100 Subject: [PATCH 8/9] Only use oldest and latest supported Python --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 519ffb1..2c61b8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: [ubuntu-24.04, windows-2022, macos-15] - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.13'] name: Run tests (Python ${{ matrix.python-version }} on ${{ matrix.os }}) runs-on: ${{ matrix.os }} steps: From 14cc5c3851436948c7cf42ae227afa86a7153df0 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 22 Jan 2025 16:46:48 +0100 Subject: [PATCH 9/9] Coverage --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c61b8d..6cf15a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,4 +36,4 @@ jobs: - name: Set up Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }} - name: Run tests - run: uv run --extra cibw pytest --cov tests + run: uv run --extra cibw pytest --cov=sleepecg tests