-
Notifications
You must be signed in to change notification settings - Fork 37
251 lines (206 loc) · 7.08 KB
/
test.yml
File metadata and controls
251 lines (206 loc) · 7.08 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: Test
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
permissions:
contents: read
jobs:
# Linting jobs run in parallel
isort:
name: Check import sorting (isort)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run isort
run: pre-commit run -a isort
black:
name: Check code formatting (black)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run black
run: pre-commit run -a black
flake8:
name: Check code style (flake8)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run flake8
run: pre-commit run -a flake8
pyupgrade:
name: Check for Python upgrades (pyupgrade)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pyupgrade
run: pre-commit run -a pyupgrade
pylint:
name: Run comprehensive linting (pylint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pylint
run: pylint --rcfile=.pylintrc cloudsmith_cli
# Test jobs run across Python versions
pytest:
name: Run tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install package
run: pip install -e .
- name: Run pytest
env:
PYTEST_CLOUDSMITH_API_KEY: ${{ secrets.PYTEST_CLOUDSMITH_API_KEY }}
PYTEST_CLOUDSMITH_API_HOST: ${{ vars.PYTEST_CLOUDSMITH_API_HOST }}
PYTEST_CLOUDSMITH_ORGANIZATION: ${{ vars.PYTEST_CLOUDSMITH_ORGANIZATION }}
run: pytest --junitxml=./reports/pytest.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.python-version }}
path: ./reports/pytest.xml
retention-days: 30
# Test zipapp build with pex for cross-platform support
test-zipapp-build:
name: Test zipapp build (pex)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install pex
run: pip install pex
- name: Get version
id: get_version
run: echo "VERSION=$(cat cloudsmith_cli/data/VERSION)" >> $GITHUB_ENV
- name: Create Zipapp with pex (cross-platform)
run: |
pex . \
--output-file cloudsmith-${{ env.VERSION }}.pyz \
--console-script cloudsmith \
--python-shebang "/usr/bin/env python3" \
--venv \
--complete-platform .github/.platforms/linux-x86_64-cp310.json \
--complete-platform .github/.platforms/linux-x86_64-cp311.json \
--complete-platform .github/.platforms/linux-x86_64-cp312.json \
--complete-platform .github/.platforms/linux-x86_64-cp313.json \
--complete-platform .github/.platforms/linux-x86_64-cp314.json \
--complete-platform .github/.platforms/linux-aarch64-cp310.json \
--complete-platform .github/.platforms/linux-x86_64-musl-cp310.json \
--complete-platform .github/.platforms/linux-aarch64-musl-cp310.json \
--complete-platform .github/.platforms/macos-arm64-cp310.json \
--complete-platform .github/.platforms/windows-x86_64-cp310.json
- name: Make executable
run: chmod +x cloudsmith-${{ env.VERSION }}.pyz
- name: Validate zipapp execution
run: |
OUTPUT=$(./cloudsmith-${{ env.VERSION }}.pyz --version)
echo "Zipapp Version: $OUTPUT"
echo "$OUTPUT" | grep "${{ env.VERSION }}"
- name: Upload zipapp artifact
uses: actions/upload-artifact@v4
with:
name: zipapp
path: cloudsmith-${{ env.VERSION }}.pyz
retention-days: 1
# Test zipapp execution across Python versions
test-zipapp-execution:
name: Test zipapp execution (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: test-zipapp-build
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get version
run: echo "VERSION=$(cat cloudsmith_cli/data/VERSION)" >> $GITHUB_ENV
- name: Download zipapp artifact
uses: actions/download-artifact@v4
with:
name: zipapp
- name: Make executable
run: chmod +x cloudsmith-${{ env.VERSION }}.pyz
- name: Validate zipapp execution
run: |
OUTPUT=$(python${{ matrix.python-version }} cloudsmith-${{ env.VERSION }}.pyz --version)
echo "Zipapp Version (Python ${{ matrix.python-version }}): $OUTPUT"
echo "$OUTPUT" | grep "${{ env.VERSION }}"