-
Notifications
You must be signed in to change notification settings - Fork 2
217 lines (194 loc) · 8.12 KB
/
nvda-test.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
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: nvda-test
on:
workflow_dispatch:
inputs:
aria_at_ref:
description: |
The sha / ref to checkout for aria-at tests
required: false
type: string
test_pattern:
description: |
The test pattern passed to the aria-at-automation harness.
Uses a default of "{reference/**,test-*-nvda.*}" if not provided
required: false
type: string
work_dir:
description: |
The --plan-workingdir passed to the aria-at-automation harness.
Based from the aria-at repo build folder.
Uses a default of tests/alert if not provided.
required: false
type: string
callback_url:
description: |
The harness will send POST requests to this url using callback_header
header with test results.
required: false
type: string
status_url:
description: |
The harness will send POST requests to this url using callback_header
header with status updates.
required: false
type: string
callback_header:
description: |
The harness will send POST requests to callback_url using this header
with status updates.
required: false
type: string
browser:
description: |
The browser to use for testing, "chrome" or "firefox", default "chrome"
required: false
type: string
nvda_version:
description: |
The specific version of NVDA to use (e.g., '2023.1'). If not provided, the latest version will be used.
required: false
type: string
# seems if push is enabled, I'm not able to trigger via workflow_dispatch?
# push:
# branches:
# - nvda-chrome
env:
ARIA_AT_WORK_DIR: ${{ inputs.work_dir || 'tests/alert' }}
ARIA_AT_TEST_PATTERN: ${{ inputs.test_pattern || '{reference/**,test-*-nvda.*}'}}
ARIA_AT_CALLBACK_URL: ${{ inputs.callback_url }}
ARIA_AT_STATUS_URL: ${{ inputs.status_url }}
ARIA_AT_CALLBACK_HEADER: ${{ inputs.callback_header || 'x-header-param:empty' }}
BROWSER: ${{ inputs.browser || 'chrome' }}
NVDA_VERSION: ${{ inputs.nvda_version }}
jobs:
nvda-test:
runs-on: windows-2022
steps:
- name: Log job state QUEUED
shell: powershell
if: inputs.status_url
run: |
$headerbits = $env:ARIA_AT_CALLBACK_HEADER -split ":\s*", 2
$headers = @{$headerbits[0]=$headerbits[1]; "Content-Type" = "application/json"}
$body = @{'status'='QUEUED'; 'externalLogsUrl'="$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"} | ConvertTo-JSON
Invoke-WebRequest $env:ARIA_AT_STATUS_URL -Headers $headers -Method 'POST' -Body $body
# Checkout all repos first (helps cache purposes)
- uses: actions/checkout@v4
- name: Checkout nvda-at-automation driver
uses: actions/checkout@v4
with:
repository: "Prime-Access-Consulting/nvda-at-automation"
path: "nvda-at-automation"
- name: Checkout aria-at ref ${{ inputs.aria_at_ref || 'master' }}
uses: actions/checkout@v4
with:
repository: "w3c/aria-at"
path: "aria-at"
ref: ${{ inputs.aria_at_ref || 'master' }}
- name: Checkout aria-at-automation-harness
uses: actions/checkout@v4
with:
repository: "w3c/aria-at-automation-harness"
ref: "main"
path: "aria-at-automation-harness"
- name: Download nvda-portable zip
uses: robinraju/[email protected]
id: nvda-portable-download
with:
repository: "bocoup/aria-at-automation-nvda-builds"
tarBall: false
zipBall: false
tag: ${{ inputs.nvda_version }}
latest: ${{ inputs.nvda_version == '' }}
out-file-path: "nvda-portable"
extract: false
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- uses: browser-actions/setup-chrome@v1
if: (inputs.browser || 'chrome') == 'chrome'
with:
chrome-version: stable
- uses: browser-actions/setup-firefox@v1
if: inputs.browser == 'firefox'
# Installing Scream as a virtual audio driver to avoid exceptions later
- name: Install Scream (Virtual Audio Driver)
shell: powershell
run: |
Start-Service audio*
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.6/Scream3.6.zip -OutFile C:\Scream3.6.zip
Expand-Archive -Path C:\Scream3.6.zip -DestinationPath C:\Scream
$cert = (Get-AuthenticodeSignature C:\Scream\Install\driver\Scream.sys).SignerCertificate
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "LocalMachine")
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()
cd C:\Scream\Install\driver
C:\Scream\Install\helpers\devcon install Scream.inf *Scream
- uses: actions/setup-go@v5
with:
cache-dependency-path: nvda-at-automation/Server/go.sum
- name: Compile at-automation driver
shell: powershell
run: |
cd nvda-at-automation\Server
go build main\main.go
- name: "aria-at: npm install"
shell: powershell
run: |
cd aria-at
npm install
- name: "aria-at: npm run build"
shell: powershell
run: |
cd aria-at
npm run build
- name: "automation-harness: npm install"
shell: powershell
run: |
cd aria-at-automation-harness
npm install
- name: Log job state RUNNING
shell: powershell
if: inputs.status_url
run: |
$headerbits = $env:ARIA_AT_CALLBACK_HEADER -split ":\s*", 2
$headers = @{$headerbits[0]=$headerbits[1]; "Content-Type" = "application/json"}
$body = @{'status'='RUNNING'; 'externalLogsUrl'="$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"; 'work_dir'="$env:ARIA_AT_WORK_DIR"} | ConvertTo-JSON
Invoke-WebRequest $env:ARIA_AT_STATUS_URL -Headers $headers -Method 'POST' -Body $body
- name: Run harness
shell: powershell
timeout-minutes: 30
env:
NVDA_PORTABLE_ZIP: ${{ fromJson(steps.nvda-portable-download.outputs.downloaded_files)[0] }}
run: |
& .\run-tester.ps1
- name: Log job state ERROR
shell: powershell
if: failure() && inputs.status_url
run: |
$headerbits = $env:ARIA_AT_CALLBACK_HEADER -split ":\s*", 2
$headers = @{$headerbits[0]=$headerbits[1]; "Content-Type" = "application/json"}
$body = @{'status'='ERROR'; 'externalLogsUrl'="$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"} | ConvertTo-JSON
Invoke-WebRequest $env:ARIA_AT_STATUS_URL -Headers $headers -Method 'POST' -Body $body
- name: Log job state COMPLETED
shell: powershell
if: success() && inputs.status_url
run: |
$headerbits = $env:ARIA_AT_CALLBACK_HEADER -split ":\s*", 2
$headers = @{$headerbits[0]=$headerbits[1]; "Content-Type" = "application/json"}
$body = @{'status'='COMPLETED'; 'externalLogsUrl'="$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"} | ConvertTo-JSON
Invoke-WebRequest $env:ARIA_AT_STATUS_URL -Headers $headers -Method 'POST' -Body $body
- name: upload *.{log,png}
uses: actions/upload-artifact@v4
if: always()
with:
name: logs
path: |
D:\a\aria-at-gh-actions-helper\aria-at-gh-actions-helper\*.log
D:\a\aria-at-gh-actions-helper\aria-at-gh-actions-helper\*.png