forked from PyProphet/pyprophet
-
Notifications
You must be signed in to change notification settings - Fork 0
312 lines (251 loc) · 10.7 KB
/
Copy pathtest-build.yml
File metadata and controls
312 lines (251 loc) · 10.7 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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Test Build
on:
workflow_dispatch: # Manual trigger
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-build:
name: Test build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
fail-fast: false # Continue testing other platforms even if one fails
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Build executable (Linux)
if: runner.os == 'Linux'
run: bash scripts/build/build_linux.sh
- name: Build executable (Windows)
if: runner.os == 'Windows'
run: scripts/build/build_windows.bat
- name: Build executable (macOS)
if: runner.os == 'macOS'
run: bash scripts/build/build_macos.sh
# Create installers
- name: Create Linux packages (DEB/RPM)
if: runner.os == 'Linux'
run: bash scripts/build/create_linux_packages.sh
- name: Create Windows installer
if: runner.os == 'Windows'
run: pwsh scripts/build/create_windows_installer.ps1
- name: Create macOS DMG
if: runner.os == 'macOS'
run: bash scripts/build/create_macos_dmg.sh
# Test the built executable
- name: Test basic commands (Linux/macOS)
if: runner.os != 'Windows'
run: |
echo "Testing --help and --version..."
dist/pyprophet --help
dist/pyprophet --version
- name: Test basic commands (Windows)
if: runner.os == 'Windows'
run: |
echo "Testing --help and --version..."
dist\pyprophet.exe --help
dist\pyprophet.exe --version
- name: Test score commands (Linux/macOS)
if: runner.os != 'Windows'
run: |
echo "Testing score at ms1ms2 level..."
dist/pyprophet score --in tests/data/test_data.osw --level ms1ms2 --pi0_lambda 0 0 0
echo "Testing score at transition level..."
dist/pyprophet score --in tests/data/test_data.osw --level transition --pi0_lambda 0 0 0
- name: Test score commands (Windows)
if: runner.os == 'Windows'
run: |
echo "Testing score at ms1ms2 level..."
dist\pyprophet.exe score --in tests/data/test_data.osw --level ms1ms2 --pi0_lambda 0 0 0
echo "Testing score at transition level..."
dist\pyprophet.exe score --in tests/data/test_data.osw --level transition --pi0_lambda 0 0 0
- name: Test infer commands (Linux/macOS)
if: runner.os != 'Windows'
run: |
echo "Testing infer peptide..."
dist/pyprophet infer peptide --in tests/data/test_data.osw --context global
echo "Testing infer peptidoform..."
dist/pyprophet infer peptidoform --in tests/data/test_data.osw --no-ipf_ms1_scoring
- name: Test infer commands (Windows)
if: runner.os == 'Windows'
run: |
echo "Testing infer peptide..."
dist\pyprophet.exe infer peptide --in tests/data/test_data.osw --context global
echo "Testing infer peptidoform..."
dist\pyprophet.exe infer peptidoform --in tests/data/test_data.osw --no-ipf_ms1_scoring
- name: Test export commands (Linux/macOS)
if: runner.os != 'Windows'
run: |
echo "Testing export score-report..."
dist/pyprophet export score-report --in tests/data/test_data.osw
echo "Testing export tsv..."
dist/pyprophet export tsv --in tests/data/test_data.osw --out test_data.tsv
# Verify output file was created
if [ ! -f test_data.tsv ]; then
echo "ERROR: test_data.tsv was not created!"
exit 1
fi
echo "Output file created successfully: test_data.tsv"
- name: Test export commands (Windows)
if: runner.os == 'Windows'
run: |
echo "Testing export score-report..."
dist\pyprophet.exe export score-report --in tests/data/test_data.osw
echo "Testing export tsv..."
dist\pyprophet.exe export tsv --in tests/data/test_data.osw --out test_data.tsv
# Verify output file was created
if (-not (Test-Path test_data.tsv)) {
Write-Error "ERROR: test_data.tsv was not created!"
exit 1
}
Write-Output "Output file created successfully: test_data.tsv"
shell: pwsh
# Test DEB package installation
- name: Test DEB package installation
if: runner.os == 'Linux'
run: |
echo "============================================"
echo "Testing DEB Package Installation"
echo "============================================"
DEB_FILE=$(ls pyprophet_*.deb)
echo "Installing: $DEB_FILE"
# Install the package
sudo dpkg -i "$DEB_FILE" || {
echo "Installation failed, attempting to fix dependencies..."
sudo apt-get install -f -y
}
# Verify installation
if ! command -v pyprophet &> /dev/null; then
echo "ERROR: pyprophet command not found after DEB installation!"
exit 1
fi
# Test installed package
echo "Testing installed pyprophet..."
pyprophet --version
pyprophet --help
# Test with actual data
pyprophet score --in tests/data/test_data.osw --level ms1ms2 --pi0_lambda 0 0 0
# Clean up
echo "Uninstalling package..."
sudo dpkg -r pyprophet
echo "✅ DEB package test passed!"
# Test Windows installer
- name: Test Windows installer
if: runner.os == 'Windows'
run: |
Write-Host "============================================"
Write-Host "Testing Windows Installer"
Write-Host "============================================"
$installerFile = Get-ChildItem pyprophet-setup-*.exe | Select-Object -First 1
if (-not $installerFile) {
Write-Error "No installer file found!"
exit 1
}
Write-Host "Installer: $($installerFile.Name)"
# Install silently
Write-Host "Installing silently..."
Start-Process -FilePath $installerFile.FullName -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART", "/DIR=$env:TEMP\PyProphet" -Wait
# Verify installation
$installPath = "$env:TEMP\PyProphet\pyprophet.exe"
if (-not (Test-Path $installPath)) {
Write-Error "pyprophet.exe not found at expected location: $installPath"
exit 1
}
# Test installed executable
Write-Host "Testing installed pyprophet..."
& $installPath --version
& $installPath --help
# Test with actual data
& $installPath score --in tests/data/test_data.osw --level ms1ms2 --pi0_lambda 0 0 0
# Clean up - uninstall silently
Write-Host "Uninstalling..."
$uninstallPath = "$env:TEMP\PyProphet\unins000.exe"
if (Test-Path $uninstallPath) {
Start-Process -FilePath $uninstallPath -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait
}
Write-Host "✅ Windows installer test passed!"
shell: pwsh
# Test macOS DMG
- name: Test macOS DMG
if: runner.os == 'macOS'
run: |
echo "============================================"
echo "Testing macOS DMG"
echo "============================================"
DMG_FILE=$(ls pyprophet-*.dmg)
echo "DMG file: $DMG_FILE"
# Mount the DMG
echo "Mounting DMG..."
hdiutil attach "$DMG_FILE" -mountpoint /Volumes/PyProphet
# Verify PyProphet directory exists
if [ ! -d "/Volumes/PyProphet/PyProphet" ]; then
echo "ERROR: PyProphet directory not found in DMG!"
hdiutil detach /Volumes/PyProphet || true
exit 1
fi
# Verify executable exists
if [ ! -f "/Volumes/PyProphet/PyProphet/pyprophet" ]; then
echo "ERROR: pyprophet executable not found!"
ls -la /Volumes/PyProphet/PyProphet/
hdiutil detach /Volumes/PyProphet || true
exit 1
fi
# Test directly from mounted DMG
echo "Testing pyprophet from DMG..."
/Volumes/PyProphet/PyProphet/pyprophet --version
/Volumes/PyProphet/PyProphet/pyprophet --help
# Test with actual data
echo "Running score test..."
/Volumes/PyProphet/PyProphet/pyprophet score --in tests/data/test_data.osw --level ms1ms2 --pi0_lambda 0 0 0
# Copy to temporary location (simulating installation)
echo "Testing installation by copying to /tmp..."
TEMP_DIR="/tmp/PyProphet-test"
rm -rf "$TEMP_DIR"
cp -r /Volumes/PyProphet/PyProphet "$TEMP_DIR"
# Unmount DMG
echo "Unmounting DMG..."
hdiutil detach /Volumes/PyProphet
# Test from copied location
echo "Testing from installed location..."
"$TEMP_DIR/pyprophet" --version
"$TEMP_DIR/pyprophet" --help
"$TEMP_DIR/pyprophet" score --in tests/data/test_data.osw --level ms1ms2 --pi0_lambda 0 0 0
# Clean up
echo "Cleaning up..."
rm -rf "$TEMP_DIR"
echo "✅ macOS DMG test passed!"
- name: Upload test outputs as artifacts
if: always() # Upload even if tests fail
uses: actions/upload-artifact@v4
with:
name: test-outputs-${{ matrix.os }}
path: |
test_data.tsv
tests/data/test_data.osw
if-no-files-found: ignore
retention-days: 3
- name: Summary
if: success()
run: |
echo "✅ All tests passed on ${{ matrix.os }}!"
echo " - Executable tests: PASSED"
echo " - Installer tests: PASSED"