Skip to content

Commit 3e33adf

Browse files
Merge pull request #38 from UIUCLibrary/ci
Ci
2 parents 216f80d + 0d2e56d commit 3e33adf

7 files changed

Lines changed: 188 additions & 39 deletions

File tree

Jenkinsfile

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,11 @@ pipeline {
379379
venv/bin/uv build --build-constraints=requirements-dev.txt
380380
'''
381381
)
382+
stash includes: 'dist/*.whl,dist/*.tar.gz,dist/*.zip', name: 'PYTHON_PACKAGES'
382383
}
383384
post{
384385
always{
385386
archiveArtifacts artifacts: 'dist/*.whl,dist/*.tar.gz,dist/*.zip', fingerprint: true
386-
stash includes: 'dist/*.whl,dist/*.tar.gz,dist/*.zip', name: 'PYTHON_PACKAGES'
387387
}
388388
cleanup{
389389
cleanWs(patterns: [
@@ -557,11 +557,11 @@ pipeline {
557557
}
558558
steps{
559559
sh './contrib/create_mac_distrib.sh'
560+
stash includes: 'dist/*.tar.gz', name: 'APPLE_APPLICATION_X86_64'
560561
}
561562
post{
562563
success{
563564
archiveArtifacts artifacts: 'dist/*.tar.gz', fingerprint: true
564-
stash includes: 'dist/*.tar.gz', name: 'APPLE_APPLICATION_X86_64'
565565
}
566566
cleanup{
567567
sh "${tool(name: 'Default', type: 'git')} clean -dfx"
@@ -618,11 +618,11 @@ pipeline {
618618
}
619619
steps{
620620
sh './contrib/create_mac_distrib.sh'
621+
stash includes: 'dist/*.tar.gz', name: 'APPLE_APPLICATION_ARM64'
621622
}
622623
post{
623624
success{
624625
archiveArtifacts artifacts: 'dist/*.tar.gz', fingerprint: true
625-
stash includes: 'dist/*.tar.gz', name: 'APPLE_APPLICATION_ARM64'
626626
}
627627
cleanup{
628628
sh "${tool(name: 'Default', type: 'git')} clean -dfx"
@@ -685,12 +685,14 @@ pipeline {
685685
}
686686
}
687687
steps{
688-
bat(script: 'contrib/create_windows_distrib.bat')
688+
timeout(5){
689+
bat(script: 'powershell contrib/create_windows_distrib.ps1')
690+
}
691+
stash includes: 'dist/*.zip', name: 'WINDOWS_APPLICATION_X86_64'
689692
}
690693
post{
691694
success{
692695
archiveArtifacts artifacts: 'dist/*.zip', fingerprint: true
693-
stash includes: 'dist/*.zip', name: 'WINDOWS_APPLICATION_X86_64'
694696
}
695697
cleanup{
696698
cleanWs(
@@ -829,7 +831,6 @@ pipeline {
829831
beforeAgent true
830832
beforeOptions true
831833
allOf{
832-
equals expected: true, actual: params.BUILD_PACKAGES
833834
equals expected: true, actual: params.CREATE_GITHUB_RELEASE
834835
tag '*'
835836
}
@@ -873,20 +874,22 @@ pipeline {
873874
requestBody: requestBody,
874875
validResponseCodes: '201' // Expect a 201 Created status code
875876
)
876-
unstash 'PYTHON_PACKAGES'
877-
def releaseData = readJSON text: createReleaseResponse.content
878-
findFiles(glob: 'dist/*').each{
879-
def uploadResponse = httpRequest(
880-
url: "${releaseData.upload_url.replace('{?name,label}', '')}?name=${it.name}",
881-
httpMode: 'POST',
882-
uploadFile: it.path,
883-
customHeaders: [[name: 'Authorization', value: "token ${GITHUB_TOKEN}"]],
884-
wrapAsMultipart: false
885-
)
886-
if (uploadResponse.status >= 200 && uploadResponse.status < 300) {
887-
echo "File uploaded successfully to GitHub release."
888-
} else {
889-
error "Failed to upload file: ${uploadResponse.status} - ${uploadResponse.content}"
877+
if (params.BUILD_PACKAGES){
878+
unstash 'PYTHON_PACKAGES'
879+
def releaseData = readJSON text: createReleaseResponse.content
880+
findFiles(glob: 'dist/*').each{
881+
def uploadResponse = httpRequest(
882+
url: "${releaseData.upload_url.replace('{?name,label}', '')}?name=${it.name}",
883+
httpMode: 'POST',
884+
uploadFile: it.path,
885+
customHeaders: [[name: 'Authorization', value: "token ${GITHUB_TOKEN}"]],
886+
wrapAsMultipart: false
887+
)
888+
if (uploadResponse.status >= 200 && uploadResponse.status < 300) {
889+
echo "File uploaded successfully to GitHub release."
890+
} else {
891+
error "Failed to upload file: ${uploadResponse.status} - ${uploadResponse.content}"
892+
}
890893
}
891894
}
892895
}

contrib/create_mac_distrib.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FREEZE_SCRIPT=$(dirname "$0")/create_standalone.py
77
DEFAULT_BUILD_VENV=$(mktemp -d)
88

99
default_python_path=$(which python3)
10-
10+
PYTHON_VERSION='3.13'
1111

1212
create_standalone(){
1313
uv_path=$1
@@ -16,10 +16,8 @@ create_standalone(){
1616

1717
# Generates the .egg-info needed for the version metadata
1818
temp_dir=$(mktemp -d)
19-
REQUIREMENTS_FILE="${temp_dir}/requirements.txt"
2019
$uv_path build --wheel
21-
$uv_path export --format requirements-txt --no-dev --no-emit-project > $REQUIREMENTS_FILE
22-
$uv_path run --with-requirements $REQUIREMENTS_FILE $FREEZE_SCRIPT --include-tab-completions tripwire ./contrib/bootstrap_standalone.py
20+
$uv_path run --python=$PYTHON_VERSION --isolated --group standalone-packaging --no-dev $FREEZE_SCRIPT --include-tab-completions tripwire ./contrib/bootstrap_standalone.py
2321
}
2422

2523

contrib/create_standalone.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
on the user's machine.
55
"""
66

7-
# /// script
8-
# requires-python = ">=3.11"
9-
# dependencies = [
10-
# 'PyInstaller', 'cmake'
11-
# ]
12-
# ///
13-
147
import abc
158
import argparse
169
import functools

contrib/create_windows_distrib.bat

Lines changed: 0 additions & 8 deletions
This file was deleted.

contrib/create_windows_distrib.ps1

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[CmdletBinding()]
2+
param (
3+
[ValidateNotNullOrEmpty()]
4+
[string]$PythonVersion = "3.13"
5+
)
6+
7+
function Get-Uv{
8+
[CmdletBinding()]
9+
param (
10+
[string]$FallThroughPath
11+
)
12+
try{
13+
$uv = (Get-Command "uv.exe" -ErrorAction Stop).path
14+
Write-Host "Using system uv"
15+
return $uv
16+
} catch {
17+
py -m venv $FallThroughPath
18+
& $FallThroughPath\Scripts\pip install --disable-pip-version-check uv | Out-Null
19+
return Join-Path $FallThroughPath 'Scripts\uv'
20+
}
21+
22+
}
23+
24+
try{
25+
$tempPath = [System.IO.Path]::GetTempPath()
26+
$tempDirName = (New-Guid).ToString("N")
27+
$fullTempDirPath = Join-Path $tempPath $tempDirName
28+
New-Item -ItemType Directory -Path $fullTempDirPath | Out-Null
29+
$uv = Get-Uv -FallThroughPath $fullTempDirPath
30+
Write-Host "using $uv"
31+
& $uv build --python=${PythonVersion} --wheel
32+
if ($LASTEXITCODE -ne 0)
33+
{
34+
Write-Host "uv build failed with exit code: $LASTEXITCODE"
35+
exit $LASTEXITCODE # Exit the PowerShell script with the failure code
36+
}
37+
& $uv run --python=$PythonVersion --isolated --group standalone-packaging --no-dev contrib/create_standalone.py --include-tab-completions tripwire contrib/bootstrap_standalone.py
38+
if ($LASTEXITCODE -ne 0)
39+
{
40+
Write-Host "contrib/create_standalone.py failed with exit code: $LASTEXITCODE"
41+
exit $LASTEXITCODE # Exit the PowerShell script with the failure code
42+
}
43+
} finally {
44+
if (Test-Path $fullTempDirPath){
45+
Write-Host "Removing $fullTempDirPath"
46+
Remove-Item -Path $tempPath -Recurse -Force
47+
}
48+
}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dev = [
4343
]
4444
deploy = ["twine"]
4545
ci = ["pysonar", {include-group = "dev"}]
46+
standalone-packaging = ['PyInstaller', 'cmake']
4647

4748
[build-system]
4849
requires = ["setuptools>=77.0.0"]

0 commit comments

Comments
 (0)