Skip to content

Commit 0140de7

Browse files
authored
ci: Update CI workflow to include reusable test (#150)
* Update CI workflow to include reusable test configurations * exclude pyside2 on py312 * fix os * update * add for napari too * specify python version * force * skip async * swap quotes * not qt dims 2 * update version * updates
1 parent 668544b commit 0140de7

File tree

1 file changed

+51
-135
lines changed

1 file changed

+51
-135
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -2,171 +2,87 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- main
7-
tags:
8-
- "v*"
9-
pull_request: {}
5+
branches: [main]
6+
tags: [v*]
7+
pull_request:
108
workflow_dispatch:
9+
schedule:
10+
- cron: "0 0 * * *" # run once a day
1111

1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.ref }}
1414
cancel-in-progress: true
1515

1616
jobs:
17-
check-manifest:
18-
name: Check Manifest
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/checkout@v4
22-
- uses: actions/setup-python@v4
23-
with:
24-
python-version: "3.x"
25-
- run: pip install check-manifest && check-manifest
26-
2717
test:
28-
name: ${{ matrix.platform }} (${{ matrix.python-version }})
29-
runs-on: ${{ matrix.platform }}
18+
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v1
19+
with:
20+
os: ${{ matrix.os }}
21+
python-version: ${{ matrix.python-version }}
22+
pip-post-installs: ${{ matrix.pydantic }}
23+
qt: ${{ matrix.qt }}
24+
extras: ${{ matrix.qt == '' && 'test' || 'test,test-qt' }}
25+
pip-install-pre-release: ${{ github.event_name == 'schedule' }}
26+
report-failures: ${{ github.event_name == 'schedule' }}
3027
strategy:
3128
fail-fast: false
3229
matrix:
33-
python-version: ["3.8", "3.10", "3.11"]
34-
platform: [ubuntu-latest, macos-latest, windows-latest]
30+
python-version: ["3.8", "3.10", "3.12"]
31+
os: [ubuntu-latest, macos-latest, windows-latest]
32+
pydantic: [""]
33+
qt: ["", PyQt5, PyQt6, PySide2, PySide6]
3534
include:
35+
- python-version: "3.9"
36+
os: "ubuntu-latest"
37+
- python-version: "3.11"
38+
os: "ubuntu-latest"
3639
- python-version: "3.12"
37-
platform: "ubuntu-latest"
38-
39-
steps:
40-
- uses: actions/checkout@v4
41-
42-
- name: Set up Python ${{ matrix.python-version }}
43-
uses: actions/setup-python@v4
44-
with:
45-
python-version: ${{ matrix.python-version }}
46-
47-
- name: Install dependencies
48-
run: |
49-
python -m pip install -U pip
50-
python -m pip install -e .[test]
51-
52-
- name: Test
53-
run: pytest -s --color=yes
54-
55-
test-pydantic1:
56-
name: pydantic1 (py${{ matrix.python-version }})
57-
runs-on: ubuntu-latest
58-
strategy:
59-
fail-fast: false
60-
matrix:
61-
python-version: ["3.8", "3.10", "3.11"]
62-
63-
steps:
64-
- uses: actions/checkout@v4
65-
66-
- name: Set up Python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v4
68-
with:
69-
python-version: ${{ matrix.python-version }}
70-
71-
- name: Install dependencies
72-
run: |
73-
python -m pip install -U pip
74-
python -m pip install -e .[test]
75-
pip install 'pydantic<2'
76-
77-
- name: Test
78-
run: pytest --color=yes --cov=app_model --cov-report=xml
79-
80-
- name: Coverage
81-
uses: codecov/codecov-action@v3
82-
83-
test-qt:
84-
name: ${{ matrix.platform }} ${{ matrix.qt-backend }} (${{ matrix.python-version }})
85-
runs-on: ${{ matrix.platform }}
86-
strategy:
87-
fail-fast: false
88-
matrix:
89-
python-version: ["3.10"]
90-
platform: [macos-latest, ubuntu-latest, windows-latest]
91-
qt-backend: [PyQt5, PyQt6, PySide2, PySide6]
92-
include:
40+
os: "ubuntu-latest"
41+
pydantic: "'pydantic<2'"
42+
- python-version: "3.8"
43+
os: "ubuntu-latest"
44+
pydantic: "'pydantic<2'"
9345
- python-version: "3.8"
94-
platform: "ubuntu-latest"
46+
os: "ubuntu-latest"
9547
qt-backend: "PyQt5==5.12"
96-
97-
steps:
98-
- uses: actions/checkout@v4
99-
100-
- name: Set up Python ${{ matrix.python-version }}
101-
uses: actions/setup-python@v4
102-
with:
103-
python-version: ${{ matrix.python-version }}
104-
105-
- uses: tlambert03/setup-qt-libs@v1
106-
107-
- name: Install dependencies
108-
run: |
109-
python -m pip install -U pip
110-
python -m pip install -e .[test,test-qt]
111-
python -m pip install ${{ matrix.qt-backend }}
112-
113-
- name: Test
114-
uses: aganders3/headless-gui@v1
115-
with:
116-
run: python -m pytest -s --cov=app_model --cov-report=xml --cov-report=term-missing --color=yes
117-
118-
- name: Coverage
119-
uses: codecov/codecov-action@v3
120-
48+
exclude:
49+
- qt: PySide2
50+
python-version: "3.12"
51+
12152
test_napari:
122-
name: napari (${{ matrix.napari-version }}, ${{ matrix.qt-backend }})
123-
runs-on: ubuntu-latest
53+
uses: pyapp-kit/workflows/.github/workflows/test-dependents.yml@v1
54+
with:
55+
dependency-repo: napari/napari
56+
dependency-ref: ${{ matrix.napari-version }}
57+
dependency-extras: 'testing'
58+
qt: ${{ matrix.qt }}
59+
pytest-args: 'napari/_qt napari/_app_model -k "not async and not qt_dims_2"'
60+
python-version: "3.10"
12461
strategy:
62+
fail-fast: false
12563
matrix:
126-
napari-version: [""] # "" is HEAD
127-
qt-backend: [pyqt5, pyside2]
64+
napari-version: ["", "v0.4.18"]
65+
qt: ["pyqt5", "pyside2"]
12866

67+
check-manifest:
68+
name: Check Manifest
69+
runs-on: ubuntu-latest
12970
steps:
13071
- uses: actions/checkout@v4
131-
with:
132-
path: app-model
133-
134-
- uses: actions/checkout@v4
135-
with:
136-
repository: napari/napari
137-
path: napari
138-
fetch-depth: 0
139-
ref: ${{ matrix.napari-version }}
140-
141-
- name: Set up Python
142-
uses: actions/setup-python@v4
143-
with:
144-
python-version: "3.10"
145-
146-
- uses: tlambert03/setup-qt-libs@v1
147-
148-
- name: Install dependencies
149-
run: |
150-
python -m pip install -U pip
151-
python -m pip install -e app-model
152-
python -m pip install -e napari[testing,${{ matrix.qt-backend }}]
153-
154-
- name: Test
155-
uses: aganders3/headless-gui@v1
156-
with:
157-
working-directory: napari
158-
run: python -m pytest napari/_qt napari/_app_model --color=yes -x
72+
- run: pipx run check-manifest
15973

16074
deploy:
16175
name: Deploy
162-
needs: [check-manifest, test, test-qt, test_napari]
163-
if: "success() && startsWith(github.ref, 'refs/tags/')"
76+
needs: [check-manifest, test, test_napari]
77+
if: success() && startsWith(github.ref, 'refs/tags/')
16478
runs-on: ubuntu-latest
16579
permissions:
16680
id-token: write
16781
contents: write
16882
steps:
16983
- uses: actions/checkout@v4
84+
with:
85+
fetch-depth: 0
17086

17187
- name: Set up Python
17288
uses: actions/setup-python@v4

0 commit comments

Comments
 (0)