-
Notifications
You must be signed in to change notification settings - Fork 118
165 lines (143 loc) · 6.49 KB
/
testdriver.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
name: TestDriver.ai
on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
- ".storybook/**"
- ".vscode/**"
- ".editorconfig"
- ".gitignore"
- ".prettierrc"
- ".eslintrc.js"
- "**/*.md"
schedule:
- cron: 0 21 * * *
workflow_dispatch: null
env:
GO_VERSION: "1.22"
NODE_VERSION: 22
permissions:
contents: read # To allow the action to read repository contents
pull-requests: write # To allow the action to create/update pull request comments
jobs:
build_and_upload:
name: Test Onboarding
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# General build dependencies
- uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: |
go.sum
- uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Install Yarn
run: |
corepack enable
yarn install
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: task package
env:
USE_SYSTEM_FPM: true # Ensure that the installed version of FPM is used rather than the bundled one.
CSC_IDENTITY_AUTO_DISCOVERY: false # disable codesign
shell: powershell # electron-builder's Windows code signing package has some compatibility issues with pwsh, so we need to use Windows Powershell
# Upload .exe as an artifact
- name: Upload .exe artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: windows-exe
path: make/*.exe
- uses: testdriverai/action@main
id: testdriver
env:
FORCE_COLOR: "3"
with:
key: ${{ secrets.DASHCAM_API }}
prerun: |
$headers = @{
Authorization = "token ${{ secrets.GITHUB_TOKEN }}"
}
$downloadFolder = "./download"
$artifactFileName = "waveterm.exe"
$artifactFilePath = "$downloadFolder/$artifactFileName"
Write-Host "Starting the artifact download process..."
# Create the download directory if it doesn't exist
if (-not (Test-Path -Path $downloadFolder)) {
Write-Host "Creating download folder..."
mkdir $downloadFolder
} else {
Write-Host "Download folder already exists."
}
# Fetch the artifact upload URL
Write-Host "Fetching the artifact upload URL..."
$artifactUrl = (Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" -Headers $headers).artifacts[0].archive_download_url
if ($artifactUrl) {
Write-Host "Artifact URL successfully fetched: $artifactUrl"
} else {
Write-Error "Failed to fetch the artifact URL."
exit 1
}
# Download the artifact (zipped file)
Write-Host "Starting artifact download..."
$artifactZipPath = "$env:TEMP\artifact.zip"
try {
Invoke-WebRequest -Uri $artifactUrl `
-Headers $headers `
-OutFile $artifactZipPath `
-MaximumRedirection 5
Write-Host "Artifact downloaded successfully to $artifactZipPath"
} catch {
Write-Error "Error downloading artifact: $_"
exit 1
}
# Unzip the artifact
$artifactUnzipPath = "$env:TEMP\artifact"
Write-Host "Unzipping the artifact to $artifactUnzipPath..."
try {
Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force
Write-Host "Artifact unzipped successfully to $artifactUnzipPath"
} catch {
Write-Error "Failed to unzip the artifact: $_"
exit 1
}
# Find the installer or app executable
$artifactInstallerPath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1
if ($artifactInstallerPath) {
Write-Host "Executable file found: $($artifactInstallerPath.FullName)"
} else {
Write-Error "Executable file not found. Exiting."
exit 1
}
# Run the installer and log the result
Write-Host "Running the installer: $($artifactInstallerPath.FullName)..."
try {
Start-Process -FilePath $artifactInstallerPath.FullName -Wait
Write-Host "Installer ran successfully."
} catch {
Write-Error "Failed to run the installer: $_"
exit 1
}
# Optional: If the app executable is different from the installer, find and launch it
$wavePath = Join-Path $env:USERPROFILE "AppData\Local\Programs\waveterm\Wave.exe"
Write-Host "Launching the application: $($wavePath)"
Start-Process -FilePath $wavePath
Write-Host "Application launched."
prompt: |
1. /run testdriver/onboarding.yml
2. /generate desktop 20