-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (136 loc) · 4.88 KB
/
build-and-test.yaml
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
name: Build and test addon
on: [push]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
nvda-release: [2019.2, 2019.2.1, 2019.3, 2019.3.1, 2020.1, 2020.2, 2020.3, 2020.4, 2021.1, 2021.2, 2021.3, 2021.3.1, 2021.3.2, 2021.3.3, 2021.3.4, 2021.3.5, 2022.1, 2022.2, 2022.2.1, 2022.2.2, 2022.2.3, 2022.2.4, 2022.3, 2022.3.1, 2022.3.2, 2022.3.3, 2022.4, 2023.1, 2023.2, 2023.3, 2023.3.1, 2023.3.2, 2023.3.3]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scons
pip install Markdown
pip install flake8
pip install flake8-tabs
- name: Download gettext
run: |
curl -LO https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.22.5a-v1.17-r3/gettext0.22.5a-iconv1.17-shared-64.exe
Start-Process -FilePath .\gettext0.22.5a-iconv1.17-shared-64.exe -ArgumentList "/SILENT", "/DIR=C:\gettext" -Wait
# $env:Path = "$env:Path;C:\gettext\bin"
# Check if msgfmt.exe exists
if (Test-Path "C:\gettext\bin\msgfmt.exe") {
Write-Host "msgfmt.exe exists"
} else {
Write-Host "msgfmt.exe does NOT exist in C:\gettext\bin"
}
# Debug the PATH variable
Write-Host "PATH: $env:Path"
# Update PATH for the current environment
$env:Path = "$env:Path;C:\gettext\bin"
Write-Host "Updated PATH: $env:Path"
# Explicitly call msgfmt with full path
& "C:\gettext\bin\msgfmt.exe" --version
- name: Verify msgfmt installation
run: msgfmt --version
shell: cmd
- name: Lint with flake8
run:
flake8 --config .github/extra_resources/setup.cfg --exit-zero addon
# stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build add-on
run: scons
- name: Copy addon
run: |
move *.nvda-addon addon.zip
expand-archive addon.zip $env:appdata\nvda\addons\addon
- name: Get last release
id: get-last-release
uses: actions/github-script@v7
with:
script: |
const result = await github.request('GET /repos/{owner}/{repo}/releases/latest', {
owner: 'nvaccess',
repo: 'nvda'
})
return result.data.tag_name
result-encoding: string
- name: Cache NVDA
id: cache-nvda
uses: actions/cache@v4
with:
path: download
key: ${{ runner.os }}-nvda_launcher-${{matrix.nvda-release}}
- name: Download NVDA
if: steps.cache-nvda.outputs.cache-hit != 'true'
run: |
curl --location --create-dirs --output download\nvda_launcher.exe https://www.nvaccess.org/download/nvda/releases/${{matrix.nvda-release}}/nvda_${{matrix.nvda-release}}.exe
Copy download nvda_launcher.exe
shell: cmd
- name: Install NVDA
run: download\nvda_launcher.exe --install-silent
shell: cmd
- name: Create a configuration file
run: |
$config = @'
[update]
allowUsageStats = False
askedAllowUsageStats = True
autoCheck = False
[general]
showWelcomeDialogAtStartup = False
[speech]
synth = silence
'@
echo $config > $env:APPDATA\nvda\nvda.ini
- name: Check config
run: |
type %appdata%\nvda\nvda.ini
shell: cmd
- name: start nvda
run: start nvda -m -f %TEMP%\nvda-with-addon.log --debug-logging
shell: cmd
- name: Ensure NVDA fully started
run: ping 127.0.0.1 /n 20
shell: cmd
- name: Quit NVDA
run: start nvda -q
shell: cmd
- name: Ensure NVDA fully exited
run: ping 127.0.0.1 /n 20
shell: cmd
- name: get the log file from temp directory
shell: cmd
run: |
copy %TEMP%\nvda-with-addon.log nvda.log
- name: Upload NVDA's log
uses: actions/upload-artifact@v4
with:
name: nvda-${{matrix.nvda-release}}.log
path: nvda.log
- name: Check NVDA's log
run: |
nErr = 0
noExit = 0
with open('nvda.log') as f:
for line in f:
if line.startswith('ERROR - '):
nErr += 1
if nErr > 0:
print(f'{nErr} errors logged in the log')
if line.strip() != 'NVDA exit':
print(f'NVDA did not exit successfully')
noExit = 1
nExpectedErr = 2 # 2 audio ducking related errors expected in installed version
exit(abs(nErr + noExit - nExpectedErr))
shell: python