Repository navigation
63 lines (53 loc) · 1.71 KB
/
Copy pathpytest.yml
File metadata and controls
63 lines (53 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: pytest
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:
jobs:
test:
name: pytest (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Tk + Xvfb (Ubuntu only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y python3-tk xvfb
- name: Install pytest
run: |
python -m pip install --upgrade pip
python -m pip install pytest
- name: Install project
run: python -m pip install -e .
- name: Run tests
shell: bash
run: |
# Tk tests need a display. On Ubuntu, wrap pytest under xvfb-run so
# the Tk subsystem can create (hidden) windows; on Windows, DISPLAY
# is irrelevant so we just invoke pytest directly.
if [ "$RUNNER_OS" = "Linux" ]; then
xvfb-run -a python -m pytest -v --tb=short --junit-xml=junit.xml
else
python -m pytest -v --tb=short --junit-xml=junit.xml
fi
- name: Upload JUnit test report
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.os }}-py${{ matrix.python-version }}
path: junit.xml
if-no-files-found: ignore