Repository navigation
90 lines (79 loc) · 2.14 KB
/
Copy pathpython-tests.yml
File metadata and controls
90 lines (79 loc) · 2.14 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Python
on:
push:
branches:
- main
paths:
- 'gnome/**'
- '.github/workflows/python-tests.yml'
pull_request:
branches:
- main
paths:
- 'gnome/**'
- '.github/workflows/python-tests.yml'
jobs:
check:
name: ${{ matrix.check }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version:
- '3.13'
check:
- ruff-format
- ruff-lint
- pytest
steps:
- uses: actions/checkout@v6
- name: Install Gtk4 dependencies
if: matrix.check == 'pytest' && false # disable temporarily
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-4-1 \
libgtk-4-dev \
gobject-introspection \
libgirepository1.0-dev \
python3-gi \
python3-gi-cairo \
gir1.2-gtk-4.0
- name: Install development tools (just)
uses: taiki-e/install-action@v2
with:
tool: just
- name: Install uv and set python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python dependencies
uses: actions/cache@v5
with:
path: |
~/.cache/uv
key: ${{ runner.os }}-uv-${{ matrix.check }}-${{ hashFiles('gnome/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.check }}-
${{ runner.os }}-uv-
- name: Check for issues in Python code
if: matrix.check == 'ruff-lint'
run: just ${{ matrix.check }}
- name: Verify Python code formatting
if: matrix.check == 'ruff-format'
working-directory: gnome
run: just ${{ matrix.check }} --diff
- name: Run pytest with coverage
if: matrix.check == 'pytest'
working-directory: gnome
run: |
just ${{ matrix.check }} -v
uvx coverage lcov -o coverage.lcov
- name: Upload coverage to Codecov
if: matrix.check == 'pytest'
uses: codecov/codecov-action@v5
with:
files: gnome/coverage.lcov
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}