Skip to content

Commit 28d9587

Browse files
authored
Set testdriver to not run on unnecessary pushes (#1267)
1 parent 3e11450 commit 28d9587

1 file changed

Lines changed: 156 additions & 147 deletions

File tree

.github/workflows/testdriver.yml

Lines changed: 156 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,165 @@
11
name: TestDriver.ai
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- "v[0-9]+.[0-9]+.[0-9]+*"
9-
pull_request:
10-
branches:
11-
- main
12-
schedule:
13-
- cron: 0 21 * * *
14-
workflow_dispatch: null
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v[0-9]+.[0-9]+.[0-9]+*"
9+
pull_request:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- "docs/**"
14+
- ".storybook/**"
15+
- ".vscode/**"
16+
- ".editorconfig"
17+
- ".gitignore"
18+
- ".prettierrc"
19+
- ".eslintrc.js"
20+
- "**/*.md"
21+
schedule:
22+
- cron: 0 21 * * *
23+
workflow_dispatch: null
1524

1625
env:
17-
GO_VERSION: "1.22"
18-
NODE_VERSION: "20"
26+
GO_VERSION: "1.22"
27+
NODE_VERSION: "20"
1928

2029
permissions:
21-
contents: read # To allow the action to read repository contents
22-
pull-requests: write # To allow the action to create/update pull request comments
30+
contents: read # To allow the action to read repository contents
31+
pull-requests: write # To allow the action to create/update pull request comments
2332

2433
jobs:
25-
build_and_upload:
26-
name: Test Onboarding
27-
runs-on: windows-latest
28-
steps:
29-
- uses: actions/checkout@v4
30-
31-
# General build dependencies
32-
- uses: actions/setup-go@v5
33-
with:
34-
go-version: ${{env.GO_VERSION}}
35-
cache-dependency-path: |
36-
go.sum
37-
- uses: actions/setup-node@v4
38-
with:
39-
node-version: ${{env.NODE_VERSION}}
40-
- name: Install Yarn
41-
run: |
42-
corepack enable
43-
yarn install
44-
- name: Install Task
45-
uses: arduino/setup-task@v2
46-
with:
47-
version: 3.x
48-
repo-token: ${{ secrets.GITHUB_TOKEN }}
49-
50-
- name: Build
51-
run: task package
52-
env:
53-
USE_SYSTEM_FPM: true # Ensure that the installed version of FPM is used rather than the bundled one.
54-
CSC_IDENTITY_AUTO_DISCOVERY: false # disable codesign
55-
shell: powershell # electron-builder's Windows code signing package has some compatibility issues with pwsh, so we need to use Windows Powershell
56-
57-
# Upload .exe as an artifact
58-
- name: Upload .exe artifact
59-
id: upload
60-
uses: actions/upload-artifact@v4
61-
with:
62-
name: windows-exe
63-
path: make/*.exe
64-
65-
- uses: testdriverai/action@main
66-
id: testdriver
67-
env:
68-
FORCE_COLOR: "3"
69-
with:
70-
key: ${{ secrets.DASHCAM_API }}
71-
prerun: |
72-
$headers = @{
73-
Authorization = "token ${{ secrets.GITHUB_TOKEN }}"
74-
}
75-
76-
$downloadFolder = "./download"
77-
$artifactFileName = "waveterm.exe"
78-
$artifactFilePath = "$downloadFolder/$artifactFileName"
79-
80-
Write-Host "Starting the artifact download process..."
81-
82-
# Create the download directory if it doesn't exist
83-
if (-not (Test-Path -Path $downloadFolder)) {
84-
Write-Host "Creating download folder..."
85-
mkdir $downloadFolder
86-
} else {
87-
Write-Host "Download folder already exists."
88-
}
89-
90-
# Fetch the artifact upload URL
91-
Write-Host "Fetching the artifact upload URL..."
92-
$artifactUrl = (Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" -Headers $headers).artifacts[0].archive_download_url
93-
94-
if ($artifactUrl) {
95-
Write-Host "Artifact URL successfully fetched: $artifactUrl"
96-
} else {
97-
Write-Error "Failed to fetch the artifact URL."
98-
exit 1
99-
}
100-
101-
# Download the artifact (zipped file)
102-
Write-Host "Starting artifact download..."
103-
$artifactZipPath = "$env:TEMP\artifact.zip"
104-
try {
105-
Invoke-WebRequest -Uri $artifactUrl `
106-
-Headers $headers `
107-
-OutFile $artifactZipPath `
108-
-MaximumRedirection 5
109-
110-
Write-Host "Artifact downloaded successfully to $artifactZipPath"
111-
} catch {
112-
Write-Error "Error downloading artifact: $_"
113-
exit 1
114-
}
115-
116-
# Unzip the artifact
117-
$artifactUnzipPath = "$env:TEMP\artifact"
118-
Write-Host "Unzipping the artifact to $artifactUnzipPath..."
119-
try {
120-
Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force
121-
Write-Host "Artifact unzipped successfully to $artifactUnzipPath"
122-
} catch {
123-
Write-Error "Failed to unzip the artifact: $_"
124-
exit 1
125-
}
126-
127-
# Find the installer or app executable
128-
$artifactInstallerPath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1
129-
130-
if ($artifactInstallerPath) {
131-
Write-Host "Executable file found: $($artifactInstallerPath.FullName)"
132-
} else {
133-
Write-Error "Executable file not found. Exiting."
134-
exit 1
135-
}
136-
137-
# Run the installer and log the result
138-
Write-Host "Running the installer: $($artifactInstallerPath.FullName)..."
139-
try {
140-
Start-Process -FilePath $artifactInstallerPath.FullName -Wait
141-
Write-Host "Installer ran successfully."
142-
} catch {
143-
Write-Error "Failed to run the installer: $_"
144-
exit 1
145-
}
146-
147-
# Optional: If the app executable is different from the installer, find and launch it
148-
$wavePath = Join-Path $env:USERPROFILE "AppData\Local\Programs\waveterm\Wave.exe"
149-
150-
Write-Host "Launching the application: $($wavePath)"
151-
Start-Process -FilePath $wavePath
152-
Write-Host "Application launched."
153-
154-
prompt: |
155-
1. /run testdriver/onboarding.yml
156-
2. /generate desktop 20
34+
build_and_upload:
35+
name: Test Onboarding
36+
runs-on: windows-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
# General build dependencies
41+
- uses: actions/setup-go@v5
42+
with:
43+
go-version: ${{env.GO_VERSION}}
44+
cache-dependency-path: |
45+
go.sum
46+
- uses: actions/setup-node@v4
47+
with:
48+
node-version: ${{env.NODE_VERSION}}
49+
- name: Install Yarn
50+
run: |
51+
corepack enable
52+
yarn install
53+
- name: Install Task
54+
uses: arduino/setup-task@v2
55+
with:
56+
version: 3.x
57+
repo-token: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Build
60+
run: task package
61+
env:
62+
USE_SYSTEM_FPM: true # Ensure that the installed version of FPM is used rather than the bundled one.
63+
CSC_IDENTITY_AUTO_DISCOVERY: false # disable codesign
64+
shell: powershell # electron-builder's Windows code signing package has some compatibility issues with pwsh, so we need to use Windows Powershell
65+
66+
# Upload .exe as an artifact
67+
- name: Upload .exe artifact
68+
id: upload
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: windows-exe
72+
path: make/*.exe
73+
74+
- uses: testdriverai/action@main
75+
id: testdriver
76+
env:
77+
FORCE_COLOR: "3"
78+
with:
79+
key: ${{ secrets.DASHCAM_API }}
80+
prerun: |
81+
$headers = @{
82+
Authorization = "token ${{ secrets.GITHUB_TOKEN }}"
83+
}
84+
85+
$downloadFolder = "./download"
86+
$artifactFileName = "waveterm.exe"
87+
$artifactFilePath = "$downloadFolder/$artifactFileName"
88+
89+
Write-Host "Starting the artifact download process..."
90+
91+
# Create the download directory if it doesn't exist
92+
if (-not (Test-Path -Path $downloadFolder)) {
93+
Write-Host "Creating download folder..."
94+
mkdir $downloadFolder
95+
} else {
96+
Write-Host "Download folder already exists."
97+
}
98+
99+
# Fetch the artifact upload URL
100+
Write-Host "Fetching the artifact upload URL..."
101+
$artifactUrl = (Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" -Headers $headers).artifacts[0].archive_download_url
102+
103+
if ($artifactUrl) {
104+
Write-Host "Artifact URL successfully fetched: $artifactUrl"
105+
} else {
106+
Write-Error "Failed to fetch the artifact URL."
107+
exit 1
108+
}
109+
110+
# Download the artifact (zipped file)
111+
Write-Host "Starting artifact download..."
112+
$artifactZipPath = "$env:TEMP\artifact.zip"
113+
try {
114+
Invoke-WebRequest -Uri $artifactUrl `
115+
-Headers $headers `
116+
-OutFile $artifactZipPath `
117+
-MaximumRedirection 5
118+
119+
Write-Host "Artifact downloaded successfully to $artifactZipPath"
120+
} catch {
121+
Write-Error "Error downloading artifact: $_"
122+
exit 1
123+
}
124+
125+
# Unzip the artifact
126+
$artifactUnzipPath = "$env:TEMP\artifact"
127+
Write-Host "Unzipping the artifact to $artifactUnzipPath..."
128+
try {
129+
Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force
130+
Write-Host "Artifact unzipped successfully to $artifactUnzipPath"
131+
} catch {
132+
Write-Error "Failed to unzip the artifact: $_"
133+
exit 1
134+
}
135+
136+
# Find the installer or app executable
137+
$artifactInstallerPath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1
138+
139+
if ($artifactInstallerPath) {
140+
Write-Host "Executable file found: $($artifactInstallerPath.FullName)"
141+
} else {
142+
Write-Error "Executable file not found. Exiting."
143+
exit 1
144+
}
145+
146+
# Run the installer and log the result
147+
Write-Host "Running the installer: $($artifactInstallerPath.FullName)..."
148+
try {
149+
Start-Process -FilePath $artifactInstallerPath.FullName -Wait
150+
Write-Host "Installer ran successfully."
151+
} catch {
152+
Write-Error "Failed to run the installer: $_"
153+
exit 1
154+
}
155+
156+
# Optional: If the app executable is different from the installer, find and launch it
157+
$wavePath = Join-Path $env:USERPROFILE "AppData\Local\Programs\waveterm\Wave.exe"
158+
159+
Write-Host "Launching the application: $($wavePath)"
160+
Start-Process -FilePath $wavePath
161+
Write-Host "Application launched."
162+
163+
prompt: |
164+
1. /run testdriver/onboarding.yml
165+
2. /generate desktop 20

0 commit comments

Comments
 (0)