-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (144 loc) · 4.59 KB
/
Copy pathci.yml
File metadata and controls
166 lines (144 loc) · 4.59 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: CI
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash
env:
FORCE_COLOR: "1"
jobs:
changelog-check:
name: CHANGELOG Check
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev' || github.base_ref == 'dev'
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check CHANGELOG entry
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="origin/${{ github.base_ref }}"
git fetch --no-tags --depth=1 origin "${{ github.base_ref }}:${BASE}" || true
echo "PR detected - checking changelog entries against $BASE"
elif [ "${{ github.event_name }}" = "push" ] && [ -n "${{ github.event.before }}" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
BASE="${{ github.event.before }}"
git fetch --no-tags origin "$BASE" || true
echo "Push detected - checking changelog entries against $BASE"
else
BASE="HEAD~1"
echo "Manual run detected - checking changelog entries against $BASE"
fi
if ! python scripts/changelog_tools.py check --base "$BASE" --head HEAD; then
{
echo "### CHANGELOG gate"
echo
echo "User-facing changes need a curated \`CHANGELOG.md\` entry under \`## Unreleased\`."
echo "This keeps nightly and stable release notes based on product wording instead of PR titles."
} >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Ruff format check
uses: astral-sh/ruff-action@v3
with:
args: format --check
- name: Ruff lint
uses: astral-sh/ruff-action@v3
with:
args: check
tests:
name: Tests (Ubuntu, Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Use prebuilt wx wheels only — never build from source.
# extras.wxpython.org provides Linux wheels for supported Python versions.
pip install \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04 \
--only-binary wxPython \
-e ".[dev]"
- name: Run tests with coverage
env:
PYTHONPATH: src
run: |
mkdir -p reports
pytest tests/ -n auto -v --tb=short -m "not integration" \
--junitxml=reports/junit.xml \
--cov=src/portkeydrop \
--cov-report=xml:reports/coverage.xml \
--cov-report=term-missing
- name: Upload test report
if: always()
uses: actions/upload-artifact@v7
with:
name: junit-${{ matrix.python-version }}
path: reports/junit.xml
retention-days: 7
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.python-version }}
path: reports/coverage.xml
retention-days: 7
coverage-gate:
name: Coverage Gate
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install diff-cover
run: pip install diff-cover>=9.0.0
- name: Download coverage report
uses: actions/download-artifact@v7
with:
name: coverage-3.11
path: reports
- name: Check coverage on changed lines
run: |
diff-cover reports/coverage.xml \
--compare-branch=origin/${{ github.base_ref }} \
--fail-under=80 \
--diff-range-notation='..' \
--exclude \
'*/portkeydrop/ui/*' \
'*/portkeydrop/dialogs/*' \
'*/portkeydrop/importers/winscp.py'
echo "✅ New code meets coverage threshold!"