nvda-test #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/release-downloader@v1.9 | |
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 |