Set testdriver to not run on unnecessary pushes (#1267)

This commit is contained in:
Evan Simkowitz 2024-11-11 16:06:16 -08:00 committed by GitHub
parent 3e11450374
commit 28d95878eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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