Skip to content

Commit

Permalink
test: test minimum stated dependencies on CI with `uv --resolution lo…
Browse files Browse the repository at this point in the history
…west-direct` (#109)

* build: restrict qt a bit more

* pin windows, add back iconify

* ci: use setup-uv

* might as well use uv run

* omit tests from min reqs

* add ignore warning

* only binary for numpy

* more pins

* test: ignore warnings on older versions

* comments

* update min pin for 3.12

* refine pyqt pins

* refine pyside6 pins

* only binary for wx

* update deps

* update lock

* verbose again

* sync0

* nosync

* fix pyproject

* fix usage of numpy

* continue on minreq

* bump ipywidgets min

* fix docs

* add CONTRIB docs

* change min pyside

* try make

* fix cov

* try reduce matrix

* combine coverage

* change name

* go back to separate

* add retries

* merge cov

* add another try

* update lockfile

* skip examples on windows

* omit wxpython from dev

* try to configure curl

* use quotes

* add verbose

* rename

* remove unnecessary cov

* test array libs

* use quotes

* quites

* whoops add back make

* add lavapipe

* remove run_id from covreport name
  • Loading branch information
tlambert03 authored Feb 11, 2025
1 parent 2120fc9 commit 5b404bf
Show file tree
Hide file tree
Showing 8 changed files with 6,860 additions and 103 deletions.
149 changes: 103 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
tags: [v*]
pull_request:
workflow_dispatch:
schedule:
# run every week (for --pre release tests)
- cron: "0 0 * * 0"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -24,6 +21,9 @@ jobs:
test:
name: ${{ matrix.os }} py${{ matrix.python-version }} ${{ matrix.gui }} ${{ matrix.canvas }}
runs-on: ${{ matrix.os }}
env:
UV_PYTHON: ${{ matrix.python-version }}
UV_FROZEN: 1
strategy:
fail-fast: false
matrix:
Expand All @@ -43,6 +43,7 @@ jobs:
- os: macos-latest
gui: wxpython
python-version: "3.10"

include:
# test a couple more python variants, without
# full os/gui/canvas matrix coverage
Expand All @@ -59,6 +60,14 @@ jobs:
python-version: "3.9"
gui: pyqt
canvas: vispy
- os: ubuntu-latest
python-version: "3.11"
gui: pyqt
canvas: vispy
- os: ubuntu-latest
python-version: "3.13"
gui: pyqt
canvas: pygfx
- os: macos-13
gui: wxpython
python-version: "3.9"
Expand All @@ -70,74 +79,109 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
enable-cache: true

- name: 📦 Install dependencies
# https://github.com/pyvista/setup-headless-display-action/pull/26
- name: Configure curl to disable revocation checks and add retries
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[test,${{ matrix.gui }},${{ matrix.canvas }}]'
echo --ssl-no-revoke > C:\Users\runneradmin\_curlrc
echo '--retry 5' >> C:\Users\runneradmin\_curlrc
type C:\Users\runneradmin\_curlrc
- uses: pyvista/setup-headless-display-action@v3
with:
qt: ${{ matrix.gui == 'pyside' || matrix.gui == 'pyqt' }}

- name: Install llvmpipe and lavapipe for offscreen canvas
if: matrix.os == 'ubuntu-latest' && matrix.canvas == 'pygfx'
run: |
sudo apt-get update -y -qq
sudo apt install -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: install pytest-qt
if: matrix.gui == 'pyside' || matrix.gui == 'pyqt'
run: pip install pytest-qt

- name: 🧪 Test
run: |
pytest --cov --cov-report=xml -v --color yes tests
- uses: codecov/codecov-action@v5
- name: 🧪 Test (attempt 1)
id: test1
continue-on-error: true
shell: bash
run: make test extras="${{ matrix.gui }},${{ matrix.canvas }}" cov=1

- name: 🧪 Test (attempt 2)
if: steps.test1.outcome == 'failure'
id: test2
continue-on-error: true
shell: bash
run: make test extras="${{ matrix.gui }},${{ matrix.canvas }}" cov=1 verbose=1

- name: 🧪 Test (attempt 3)
if: steps.test2.outcome == 'failure'
shell: bash
run: make test extras="${{ matrix.gui }},${{ matrix.canvas }}" cov=1 verbose=1

- name: 🧪 Test min dependencies (attempt 1)
id: min1
continue-on-error: true
shell: bash
run: make test extras="${{ matrix.gui }},${{ matrix.canvas }}" min=1

- name: 🧪 Test min dependencies (attempt 2)
if: steps.min1.outcome == 'failure'
id: min2
continue-on-error: true
shell: bash
run: make test extras="${{ matrix.gui }},${{ matrix.canvas }}" min=1 verbose=1

- name: 🧪 Test min dependencies (attempt 3)
if: steps.min2.outcome == 'failure'
shell: bash
run: make test extras="${{ matrix.gui }},${{ matrix.canvas }}" min=1 verbose=1

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: covreport-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.gui }}-${{ matrix.canvas }}
path: ./.coverage*
include-hidden-files: true

test-array-libs:
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v2
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
extras: "test,vispy,third_party_arrays,pyqt"
coverage-upload: artifact
pip-post-installs: "pytest-qt"
qt: pyqt6
runs-on: ubuntu-latest
env:
UV_PYTHON: ${{ matrix.python-version }}
UV_FROZEN: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.12"]

# make sure we can build docs without error
test-docs:
runs-on: macos-latest # nicer screenshots
steps:
- uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.x"
cache: "pip"
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[docs]'
- name: 📚 Build docs
run: mkdocs build --strict
- uses: actions/upload-artifact@v4
enable-cache: true
- uses: pyvista/setup-headless-display-action@v3
with:
name: docs
path: site
qt: true
- name: Install llvmpipe and lavapipe for offscreen canvas
run: sudo apt install -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers

- name: 🧪 Test (attempt 1)
id: test1
continue-on-error: true
run: make test extras="pyqt,pygfx" groups="array-libs" cov=1

- name: 🧪 Test (attempt 2)
if: steps.test1.outcome == 'failure'
id: test2
run: make test extras="pyqt,pygfx" groups="array-libs" cov=1 verbose=1

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: covreport-py${{ matrix.python-version }}-array-libs
path: ./.coverage*
include-hidden-files: true

upload_coverage:
if: always()
Expand All @@ -146,6 +190,19 @@ jobs:
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}

# make sure we can build docs without error
test-docs:
runs-on: macos-latest # nicer screenshots
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: 📚 Build docs
run: uv run --group docs mkdocs build --strict
- uses: actions/upload-artifact@v4
with:
name: docs
path: site

deploy:
name: Deploy
needs: test
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: 3.x

- name: Install mkdocs and mike
run: pip install '.[docs]'
enable-cache: true

- name: Config git
run: |
Expand All @@ -38,17 +35,17 @@ jobs:
if [[ $VERSION == *"rc"* ]] || [[ $VERSION == *"beta"* ]]; then
export DOCS_PRERELEASE=true
echo "Deploying pre-release docs"
mike deploy --push --update-aliases $VERSION rc
uv run --group docs mike deploy --push --update-aliases $VERSION rc
else
echo "Deploying release docs"
mike deploy --push --update-aliases $VERSION latest
uv run --group docs mike deploy --push --update-aliases $VERSION latest
fi
env:
DOCS_DEV: false

- name: Deploy dev docs
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: mike deploy --push --update-aliases dev
run: uv run --group docs mike deploy --push --update-aliases dev
env:
DOCS_DEV: true

Expand Down
Loading

0 comments on commit 5b404bf

Please sign in to comment.