|
11 | 11 | NODE_VERSION: 22
|
12 | 12 |
|
13 | 13 | permissions:
|
14 |
| - contents: read |
15 |
| - pull-requests: write |
16 |
| - checks: write |
17 |
| - actions: read |
| 14 | + contents: read |
| 15 | + statuses: write |
18 | 16 |
|
| 17 | + |
19 | 18 | jobs:
|
20 | 19 | context:
|
21 | 20 | runs-on: ubuntu-22.04
|
@@ -49,128 +48,94 @@ jobs:
|
49 | 48 | runs-on: windows-latest
|
50 | 49 | if: github.event.workflow_run.conclusion == 'success'
|
51 | 50 | steps:
|
52 |
| - - name: Create Check Run |
53 |
| - id: create-check |
54 |
| - uses: actions/github-script@v7 |
55 |
| - with: |
56 |
| - script: | |
57 |
| - const check = await github.rest.checks.create({ |
58 |
| - owner: context.repo.owner, |
59 |
| - repo: context.repo.repo, |
60 |
| - name: 'TestDriver.ai Run', |
61 |
| - head_sha: '${{ github.event.workflow_run.head_sha }}', |
62 |
| - status: 'in_progress' |
63 |
| - }); |
64 |
| - return check.data.id; |
65 |
| -
|
66 |
| - - uses: testdriverai/action@main |
67 |
| - id: testdriver |
68 |
| - env: |
69 |
| - FORCE_COLOR: "3" |
70 |
| - with: |
71 |
| - key: ${{ secrets.DASHCAM_API }} |
72 |
| - prerun: | |
73 |
| - $headers = @{ |
74 |
| - Authorization = "token ${{ secrets.GITHUB_TOKEN }}" |
75 |
| - } |
76 |
| -
|
77 |
| - $downloadFolder = "./download" |
78 |
| - $artifactFileName = "waveterm.exe" |
79 |
| - $artifactFilePath = "$downloadFolder/$artifactFileName" |
80 |
| -
|
81 |
| - Write-Host "Starting the artifact download process..." |
82 |
| -
|
83 |
| - # Create the download directory if it doesn't exist |
84 |
| - if (-not (Test-Path -Path $downloadFolder)) { |
85 |
| - Write-Host "Creating download folder..." |
86 |
| - mkdir $downloadFolder |
87 |
| - } else { |
88 |
| - Write-Host "Download folder already exists." |
89 |
| - } |
90 |
| -
|
91 |
| - # Fetch the artifact upload URL |
92 |
| - Write-Host "Fetching the artifact upload URL..." |
93 |
| - $artifactUrl = (Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" -Headers $headers).artifacts[0].archive_download_url |
94 |
| -
|
95 |
| - if ($artifactUrl) { |
96 |
| - Write-Host "Artifact URL successfully fetched: $artifactUrl" |
97 |
| - } else { |
98 |
| - Write-Error "Failed to fetch the artifact URL." |
99 |
| - exit 1 |
100 |
| - } |
101 |
| -
|
102 |
| - # Download the artifact (zipped file) |
103 |
| - Write-Host "Starting artifact download..." |
104 |
| - $artifactZipPath = "$env:TEMP\artifact.zip" |
105 |
| - try { |
106 |
| - Invoke-WebRequest -Uri $artifactUrl ` |
107 |
| - -Headers $headers ` |
108 |
| - -OutFile $artifactZipPath ` |
109 |
| - -MaximumRedirection 5 |
110 |
| -
|
111 |
| - Write-Host "Artifact downloaded successfully to $artifactZipPath" |
112 |
| - } catch { |
113 |
| - Write-Error "Error downloading artifact: $_" |
114 |
| - exit 1 |
115 |
| - } |
116 |
| -
|
117 |
| - # Unzip the artifact |
118 |
| - $artifactUnzipPath = "$env:TEMP\artifact" |
119 |
| - Write-Host "Unzipping the artifact to $artifactUnzipPath..." |
120 |
| - try { |
121 |
| - Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force |
122 |
| - Write-Host "Artifact unzipped successfully to $artifactUnzipPath" |
123 |
| - } catch { |
124 |
| - Write-Error "Failed to unzip the artifact: $_" |
125 |
| - exit 1 |
126 |
| - } |
127 |
| -
|
128 |
| - # Find the installer or app executable |
129 |
| - $artifactInstallerPath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1 |
130 |
| -
|
131 |
| - if ($artifactInstallerPath) { |
132 |
| - Write-Host "Executable file found: $($artifactInstallerPath.FullName)" |
133 |
| - } else { |
134 |
| - Write-Error "Executable file not found. Exiting." |
135 |
| - exit 1 |
136 |
| - } |
137 |
| -
|
138 |
| - # Run the installer and log the result |
139 |
| - Write-Host "Running the installer: $($artifactInstallerPath.FullName)..." |
140 |
| - try { |
141 |
| - Start-Process -FilePath $artifactInstallerPath.FullName -Wait |
142 |
| - Write-Host "Installer ran successfully." |
143 |
| - } catch { |
144 |
| - Write-Error "Failed to run the installer: $_" |
145 |
| - exit 1 |
146 |
| - } |
147 |
| -
|
148 |
| - # Optional: If the app executable is different from the installer, find and launch it |
149 |
| - $wavePath = Join-Path $env:USERPROFILE "AppData\Local\Programs\waveterm\Wave.exe" |
150 |
| -
|
151 |
| - Write-Host "Launching the application: $($wavePath)" |
152 |
| - Start-Process -FilePath $wavePath |
153 |
| - Write-Host "Application launched." |
154 |
| -
|
155 |
| - prompt: | |
156 |
| - 1. /run testdriver/onboarding.yml |
157 |
| -
|
158 |
| - - name: Update Check Run |
159 |
| - if: always() |
160 |
| - uses: actions/github-script@v7 |
161 |
| - with: |
162 |
| - script: | |
163 |
| - const checkId = steps['create-check'].outputs.result; |
164 |
| - await github.rest.checks.update({ |
165 |
| - owner: context.repo.owner, |
166 |
| - repo: context.repo.repo, |
167 |
| - check_run_id: checkId, |
168 |
| - status: 'completed', |
169 |
| - conclusion: steps.testdriver.outcome === 'success' ? 'success' : 'failure', |
170 |
| - output: { |
171 |
| - title: 'TestDriver.ai Results', |
172 |
| - summary: steps.testdriver.outcome === 'success' |
173 |
| - ? '✅ All tests passed' |
174 |
| - : '❌ Tests failed' |
175 |
| - } |
176 |
| - }); |
| 51 | + - uses: testdriverai/action@main |
| 52 | + id: testdriver |
| 53 | + env: |
| 54 | + FORCE_COLOR: "3" |
| 55 | + with: |
| 56 | + key: ${{ secrets.DASHCAM_API }} |
| 57 | + prerun: | |
| 58 | + $headers = @{ |
| 59 | + Authorization = "token ${{ secrets.GITHUB_TOKEN }}" |
| 60 | + } |
| 61 | +
|
| 62 | + $downloadFolder = "./download" |
| 63 | + $artifactFileName = "waveterm.exe" |
| 64 | + $artifactFilePath = "$downloadFolder/$artifactFileName" |
| 65 | +
|
| 66 | + Write-Host "Starting the artifact download process..." |
| 67 | +
|
| 68 | + # Create the download directory if it doesn't exist |
| 69 | + if (-not (Test-Path -Path $downloadFolder)) { |
| 70 | + Write-Host "Creating download folder..." |
| 71 | + mkdir $downloadFolder |
| 72 | + } else { |
| 73 | + Write-Host "Download folder already exists." |
| 74 | + } |
| 75 | +
|
| 76 | + # Fetch the artifact upload URL |
| 77 | + Write-Host "Fetching the artifact upload URL..." |
| 78 | + $artifactUrl = (Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" -Headers $headers).artifacts[0].archive_download_url |
| 79 | +
|
| 80 | + if ($artifactUrl) { |
| 81 | + Write-Host "Artifact URL successfully fetched: $artifactUrl" |
| 82 | + } else { |
| 83 | + Write-Error "Failed to fetch the artifact URL." |
| 84 | + exit 1 |
| 85 | + } |
| 86 | +
|
| 87 | + # Download the artifact (zipped file) |
| 88 | + Write-Host "Starting artifact download..." |
| 89 | + $artifactZipPath = "$env:TEMP\artifact.zip" |
| 90 | + try { |
| 91 | + Invoke-WebRequest -Uri $artifactUrl ` |
| 92 | + -Headers $headers ` |
| 93 | + -OutFile $artifactZipPath ` |
| 94 | + -MaximumRedirection 5 |
| 95 | +
|
| 96 | + Write-Host "Artifact downloaded successfully to $artifactZipPath" |
| 97 | + } catch { |
| 98 | + Write-Error "Error downloading artifact: $_" |
| 99 | + exit 1 |
| 100 | + } |
| 101 | +
|
| 102 | + # Unzip the artifact |
| 103 | + $artifactUnzipPath = "$env:TEMP\artifact" |
| 104 | + Write-Host "Unzipping the artifact to $artifactUnzipPath..." |
| 105 | + try { |
| 106 | + Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force |
| 107 | + Write-Host "Artifact unzipped successfully to $artifactUnzipPath" |
| 108 | + } catch { |
| 109 | + Write-Error "Failed to unzip the artifact: $_" |
| 110 | + exit 1 |
| 111 | + } |
| 112 | +
|
| 113 | + # Find the installer or app executable |
| 114 | + $artifactInstallerPath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1 |
| 115 | +
|
| 116 | + if ($artifactInstallerPath) { |
| 117 | + Write-Host "Executable file found: $($artifactInstallerPath.FullName)" |
| 118 | + } else { |
| 119 | + Write-Error "Executable file not found. Exiting." |
| 120 | + exit 1 |
| 121 | + } |
| 122 | +
|
| 123 | + # Run the installer and log the result |
| 124 | + Write-Host "Running the installer: $($artifactInstallerPath.FullName)..." |
| 125 | + try { |
| 126 | + Start-Process -FilePath $artifactInstallerPath.FullName -Wait |
| 127 | + Write-Host "Installer ran successfully." |
| 128 | + } catch { |
| 129 | + Write-Error "Failed to run the installer: $_" |
| 130 | + exit 1 |
| 131 | + } |
| 132 | +
|
| 133 | + # Optional: If the app executable is different from the installer, find and launch it |
| 134 | + $wavePath = Join-Path $env:USERPROFILE "AppData\Local\Programs\waveterm\Wave.exe" |
| 135 | +
|
| 136 | + Write-Host "Launching the application: $($wavePath)" |
| 137 | + Start-Process -FilePath $wavePath |
| 138 | + Write-Host "Application launched." |
| 139 | +
|
| 140 | + prompt: | |
| 141 | + 1. /run testdriver/onboarding.yml |
0 commit comments