-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (105 loc) · 4.02 KB
/
release.yml
File metadata and controls
124 lines (105 loc) · 4.02 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
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
windows-exe:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install build dependencies
run: python -m pip install --upgrade pip build pyinstaller pytest
- name: Install package
run: python -m pip install .
- name: Run tests
run: python -m pytest -q
- name: Create PyInstaller entry point
shell: pwsh
run: |
@(
'from win_search_aliases.ui.gui import main'
''
'raise SystemExit(main())'
) | Set-Content -LiteralPath pyinstaller_entry.py -Encoding UTF8
- name: Build Windows UI executable
run: >
python -m PyInstaller
--noconfirm
--clean
--onefile
--windowed
--icon assets/app.ico
--name win-search-aliases-ui-${{ github.ref_name }}
--collect-data win_search_aliases
--exclude-module _hashlib
--exclude-module _ssl
--exclude-module ssl
pyinstaller_entry.py
- name: Verify executable exists
shell: pwsh
run: |
$exe = Join-Path $PWD 'dist\win-search-aliases-ui-${{ github.ref_name }}.exe'
if (-not (Test-Path -LiteralPath $exe)) {
throw "Built executable was not found: $exe"
}
Get-Item -LiteralPath $exe | Format-List Name,Length,FullName
- name: Smoke test executable
shell: pwsh
run: |
$exe = Join-Path $PWD 'dist\win-search-aliases-ui-${{ github.ref_name }}.exe'
$process = Start-Process -FilePath $exe -ArgumentList '--smoke-test' -Wait -PassThru -WindowStyle Hidden
if ($process.ExitCode -ne 0) {
throw "Executable smoke test failed with exit code $($process.ExitCode)"
}
- name: Build stable Python install asset
shell: pwsh
run: |
$dist = Join-Path $env:GITHUB_WORKSPACE 'dist'
Push-Location $env:RUNNER_TEMP
try {
python -m build $env:GITHUB_WORKSPACE --sdist --outdir $dist
}
finally {
Pop-Location
}
$sdist = @(Get-ChildItem -LiteralPath $dist -Filter '*.tar.gz')
if ($sdist.Count -ne 1) { throw "Expected 1 sdist, found $($sdist.Count)" }
Move-Item -LiteralPath $sdist[0].FullName -Destination (Join-Path $dist 'win-search-aliases-python.tar.gz') -Force
Get-Item -LiteralPath 'dist\win-search-aliases-python.tar.gz' | Format-List Name,Length,FullName
- name: Verify stable Python install asset
shell: pwsh
run: |
$installHome = Join-Path $env:RUNNER_TEMP 'release-python-asset-smoke'
python -m venv $installHome
$venvPython = Join-Path $installHome 'Scripts\python.exe'
& $venvPython -m pip install --upgrade 'dist\win-search-aliases-python.tar.gz'
$command = Join-Path $installHome 'Scripts\win-search-aliases.exe'
$uiCommand = Join-Path $installHome 'Scripts\win-search-aliases-ui.exe'
if (-not (Test-Path -LiteralPath $command)) {
throw "Installed command was not found: $command"
}
if (-not (Test-Path -LiteralPath $uiCommand)) {
throw "Installed UI command was not found: $uiCommand"
}
& $command --help
- uses: actions/upload-artifact@v4
with:
name: win-search-aliases-ui-${{ github.ref_name }}-windows
path: |
dist/win-search-aliases-ui-${{ github.ref_name }}.exe
dist/win-search-aliases-python.tar.gz
install.ps1
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/win-search-aliases-ui-${{ github.ref_name }}.exe
dist/win-search-aliases-python.tar.gz
install.ps1