-
Notifications
You must be signed in to change notification settings - Fork 19
259 lines (217 loc) · 8.76 KB
/
ci-win.yml
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
name: CI-Win
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- "v*"
# Cancel in-progress CI jobs if there is a new push
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pyinstaller_electron_app:
name: PyInstaller JamAIBase Electron App Compilation
runs-on: windows-11-desktop
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install Git
run: |
$installer_url = "https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/Git-2.45.2-64-bit.exe"
Invoke-WebRequest -Uri $installer_url -OutFile "GitInstaller.exe"
Start-Process -FilePath "GitInstaller.exe" -Args "/VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /COMPONENTS='icons,ext\reg\shellhere,assoc,assoc_sh'" -Wait
Remove-Item "GitInstaller.exe"
# Add Git to PATH
$gitPath = "C:\Program Files\Git\cmd"
$env:PATH = "$gitPath;$env:PATH"
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::Machine)
# Output the new PATH to a step output
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
# Verify Git installation
git --version
shell: powershell
- name: Verify Git in PATH
run: |
Write-Host "Current PATH: $env:PATH"
$gitPath = (Get-Command git -ErrorAction SilentlyContinue).Path
if ($gitPath) {
Write-Host "Git found at: $gitPath"
} else {
Write-Host "Git not found in PATH"
exit 1
}
shell: powershell
- name: Inspect git version
run: |
git --version
- name: Remove cloud-only modules and start compiling JamAIBase Electron App
run: |
mv .env.example .env
$ErrorActionPreference = "Stop"
.\scripts\compile_jamaibase_app.ps1
shell: powershell
- name: Validate jamaibase.exe is healthy
run: |
cd services\app\build-electron\make\zip\win32\x64\
Expand-Archive -Path 'jamaibase-app-win32-x64-0.2.0.zip' -DestinationPath 'jamaibase-app-win32-x64-0.2.0'
$process = Start-Process -NoNewWindow -FilePath ".\jamaibase-app-win32-x64-0.2.0\jamaibase-app.exe" -PassThru
$processId = $process.Id
Write-Output "Process ID: $processId"
# Wait for 5 seconds
Start-Sleep -Seconds 10
# Check if the process is still running
if (Get-Process -Id $processId -ErrorAction SilentlyContinue) {
Write-Output "The process is still running."
} else {
Write-Output "The process has exited."
}
shell: powershell
pyinstaller_api:
name: PyInstaller API Service Compilation
runs-on: windows-11-desktop
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Inspect Python version
run: python --version
- name: Install Git
run: |
$installer_url = "https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/Git-2.45.2-64-bit.exe"
Invoke-WebRequest -Uri $installer_url -OutFile "GitInstaller.exe"
Start-Process -FilePath "GitInstaller.exe" -Args "/VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /COMPONENTS='icons,ext\reg\shellhere,assoc,assoc_sh'" -Wait
Remove-Item "GitInstaller.exe"
# Add Git to PATH
$gitPath = "C:\Program Files\Git\cmd"
$env:PATH = "$gitPath;$env:PATH"
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::Machine)
# Output the new PATH to a step output
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
# Verify Git installation
git --version
shell: powershell
- name: Verify Git in PATH
run: |
Write-Host "Current PATH: $env:PATH"
$gitPath = (Get-Command git -ErrorAction SilentlyContinue).Path
if ($gitPath) {
Write-Host "Git found at: $gitPath"
} else {
Write-Host "Git not found in PATH"
exit 1
}
shell: powershell
- name: Inspect git version
run: |
git --version
- name: Remove cloud-only modules and start compiling API service
run: |
mv .env.example .env
$ErrorActionPreference = "Stop"
.\scripts\compile_api_exe.ps1
shell: powershell
- name: Validate api.exe is healthy
run: |
$env:OWL_WORKERS=1
$process = Start-Process -NoNewWindow -FilePath ".\services\api\dist\api\api.exe" -PassThru
Start-Sleep -Seconds 60
Write-Output "API process ID: $($process.Id)"
Get-Process
Test-NetConnection -ComputerName localhost -Port 6969
$response = Invoke-WebRequest -Uri http://localhost:6969/api/health -UseBasicParsing
if ($response.StatusCode -eq 200) {
Write-Output "API is healthy"
} else {
throw "API is not healthy"
}
$processId = (Get-Process -Name api -ErrorAction SilentlyContinue).Id
if ($null -ne $processId) {
Stop-Process -Id $processId -Force
} else {
Write-Output "API process not found."
}
shell: powershell
pyinstaller_docio:
name: PyInstaller DocIO Service Compilation
runs-on: windows-11-desktop
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Display Python version
run: python --version
- name: Install Microsoft Visual C++ Redistributable
run: |
Invoke-WebRequest -Uri "https://aka.ms/vs/16/release/vc_redist.x64.exe" -OutFile "vc_redist.x64.exe"
Start-Process -FilePath "./vc_redist.x64.exe" -ArgumentList "/quiet", "/install" -NoNewWindow -Wait
- name: Install Git
run: |
$installer_url = "https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/Git-2.45.2-64-bit.exe"
Invoke-WebRequest -Uri $installer_url -OutFile "GitInstaller.exe"
Start-Process -FilePath "GitInstaller.exe" -Args "/VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /COMPONENTS='icons,ext\reg\shellhere,assoc,assoc_sh'" -Wait
Remove-Item "GitInstaller.exe"
# Add Git to PATH
$gitPath = "C:\Program Files\Git\cmd"
$env:PATH = "$gitPath;$env:PATH"
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::Machine)
# Output the new PATH to a step output
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
# Verify Git installation
git --version
shell: powershell
- name: Verify Git in PATH
run: |
Write-Host "Current PATH: $env:PATH"
$gitPath = (Get-Command git -ErrorAction SilentlyContinue).Path
if ($gitPath) {
Write-Host "Git found at: $gitPath"
} else {
Write-Host "Git not found in PATH"
exit 1
}
shell: powershell
- name: Remove cloud-only modules and start compiling DocIO service
run: |
mv .env.example .env
$ErrorActionPreference = "Stop"
.\scripts\compile_docio_exe.ps1
shell: powershell
- name: Validate docio.exe is healthy
run: |
$env:DOCIO_WORKERS=1
$process = Start-Process -NoNewWindow -FilePath ".\services\docio\dist\docio\docio.exe" -PassThru
Start-Sleep -Seconds 10
Write-Output "DocIO process ID: $($process.Id)"
Get-Process
Test-NetConnection -ComputerName localhost -Port 6979
$response = Invoke-WebRequest -Uri http://localhost:6979/health -UseBasicParsing
if ($response.StatusCode -eq 200) {
Write-Output "DocIO is healthy"
} else {
throw "DocIO is not healthy"
}
$processId = (Get-Process -Name docio -ErrorAction SilentlyContinue).Id
if ($null -ne $processId) {
Stop-Process -Id $processId -Force
} else {
Write-Output "DocIO process not found."
}
shell: powershell