Skip to content

Commit 41fa929

Browse files
authored
Merge 7d5ddb2 into 071247b
2 parents 071247b + 7d5ddb2 commit 41fa929

File tree

3 files changed

+137
-42
lines changed

3 files changed

+137
-42
lines changed

.github/workflows/testAndPublish.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,13 @@ concurrency:
2525
cancel-in-progress: true
2626

2727
env:
28-
START_BUILD_NUMBER: 50000
28+
START_BUILD_NUMBER: ${{ vars.BUILD_NUMBER_OFFSET || 0 }}
2929
pullRequestNumber: ${{ github.event_name == 'pull_request' && github.event.number || 0 }}
30-
scons_publisher: NV Access
30+
scons_publisher: ${{ vars.PUBLISHER_NAME || github.repository_owner }}
3131
# Don't send telemetry to Microsoft when using MSVC tooling, avoiding an unnecessary PowerShell script invocation.
3232
VSCMD_SKIP_SENDTELEMETRY: 1
3333
# Cache details about available MSVC tooling for subsequent SCons invocations to the provided file.
3434
SCONS_CACHE_MSVC_CONFIG: ".scons_msvc_cache.json"
35-
# Comment out any of the feature_* variables to disable the respective build feature.
36-
# They are checked for existence of content, not specific value.
37-
feature_uploadSymbolsToMozilla: configured
38-
feature_crowdinSync: configured
39-
feature_signing: configured
40-
# feature_buildAppx: configured
4135

4236
jobs:
4337
buildNVDA:
@@ -163,17 +157,17 @@ jobs:
163157
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/beta' }}
164158
steps:
165159
- name: Checkout cached build
166-
if: ${{ env.feature_crowdinSync }}
160+
if: ${{ vars.CROWDIN_PROJECT_ID }}
167161
uses: actions/cache/restore@v4
168162
with:
169163
path: ${{ github.workspace }}
170164
key: ${{ github.ref }}-${{ github.run_id }}
171165
fail-on-cache-miss: true
172166
- name: Install the latest version of uv
173-
if: ${{ env.feature_crowdinSync }}
167+
if: ${{ vars.CROWDIN_PROJECT_ID }}
174168
uses: astral-sh/setup-uv@v6
175169
- name: Upload translations to Crowdin
176-
if: ${{ env.feature_crowdinSync }}
170+
if: ${{ vars.CROWDIN_PROJECT_ID }}
177171
env:
178172
crowdinProjectID: ${{ vars.CROWDIN_PROJECT_ID }}
179173
crowdinAuthToken: ${{ secrets.CROWDIN_AUTH_TOKEN }}
@@ -197,7 +191,7 @@ jobs:
197191
- name: Set scons args
198192
run: ci/scripts/setSconsArgs.ps1
199193
env:
200-
apiSigningToken: ${{ (github.event_name == 'push' && env.feature_signing) && secrets.API_SIGNING_TOKEN || '' }}
194+
apiSigningToken: ${{ github.event_name == 'push' && secrets.API_SIGNING_TOKEN }}
201195
- name: Create launcher
202196
shell: cmd
203197
run: |
@@ -309,15 +303,15 @@ jobs:
309303
name: Symbols
310304
path: output/symbols.zip
311305
- name: Install the latest version of uv
312-
if: ${{ github.event_name == 'push' && env.feature_uploadSymbolsToMozilla }}
306+
if: ${{ github.event_name == 'push' && vars.feature_uploadSymbolsToMozilla }}
313307
uses: astral-sh/setup-uv@v6
314308
- name: Upload symbols to Mozilla
315-
if: ${{ github.event_name == 'push' && env.feature_uploadSymbolsToMozilla }}
309+
if: ${{ github.event_name == 'push' && vars.feature_uploadSymbolsToMozilla }}
316310
continue-on-error: true
317311
# TODO: this script should be moved to ci/scripts
318312
run: uv run --with requests --directory appveyor mozillaSyms.py
319313
env:
320-
mozillaSymsAuthToken: ${{ secrets.MOZILLA_SYMS_AUTH_TOKEN }}
314+
mozillaSymsAuthToken: ${{ secrets.MOZILLA_SYMS_TOKEN }}
321315
- name: Warn on failure
322316
if: ${{ failure() }}
323317
shell: bash

ci/README.md

Lines changed: 127 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,143 @@
11
# Continuous Integration with GitHub Actions
22

3-
[Documentation about GitHub Actions](https://docs.github.com/en/actions)
3+
## Background
4+
5+
GitHub Actions builds the following types of NVDA installers through a CI/CD pipeline:
6+
7+
* Pull Request builds: Generated from the pull requests.
8+
Pull requests initiated from `nvaccess/nvda` rather than a fork have extra permissions than standard PRs.
9+
* Snapshot builds: Generated from pushes to master/beta/rc or branch names prefixed with `try-`.
10+
These are signed and deployed to the NV Access server.
11+
* Tagged builds: Generated from pushes to tags prefixed with `release-`.
12+
Official beta, rc and stable releases.
13+
These are signed and deployed to the NV Access server.
414

515
## Builds
616

17+
### Build process
18+
19+
The build process is non-linear.
20+
Some of these steps run concurrently.
21+
22+
1. Prepare source code and cache:
23+
1. Checkout NVDA repository with submodules.
24+
1. Install dependencies (or use cache).
25+
1. Set version and scons variables.
26+
1. Build NVDA source.
27+
1. Build and test:
28+
1. Run static tests
29+
1. Build launcher
30+
1. Install NVDA
31+
1. Run systems tests
32+
1. Deploy (not fully active currently):
33+
1. On tagged/snapshot builds, upload symbols to Mozilla
34+
1. On beta branch builds, upload translation to Crowdin.
35+
1. On snapshot builds, deploy to the server.
36+
1. On release builds, publish the release in GitHub and deploy to the server.
37+
1. Clean up build cache.
38+
39+
### Build behaviours
40+
741
Builds will fail if any command has a non-zero exit code.
842
PowerShell scripts continue on non-terminating errors unless the file is prefixed with `$ErrorActionPreference = "Stop";`.
943

10-
### Build process
44+
## Setup requirements
1145

12-
1. Checkout NVDA repository with submodules.
13-
1. Install dependencies (or use cache).
14-
1. Set version and scons variables.
15-
1. Prepare source code.
16-
1. Build launcher.
17-
1. Install NVDA.
18-
1. Prepare for tests.
19-
1. Run tests.
20-
1. Clean up build cache.
21-
1. Release NVDA if this is a tagged release.
46+
The repository hosting GitHub Actions must be configured correctly for different parts of the build process.
47+
48+
### Publisher name
49+
50+
Our releases are packaged with a publisher name.
51+
To customise this, set:
52+
53+
* `PUBLISHER_NAME` as a variable.
54+
It currently defaults to the repository owner (e.g. `nvaccess`).
55+
56+
### Build number offset
57+
58+
To offset from our previous build system, we start the sequential build count at a higher number than 0.
59+
This means our first build will be numbered something like 100,001 not 1.
60+
61+
To offset build numbers, set;
62+
63+
* `BUILD_NUMBER_OFFSET` as a variable.
64+
It currently defaults to 0.
65+
66+
### Crowdin
67+
68+
NVDA translations are synced with Crowdin on the beta branch.
69+
70+
To enable, set:
71+
72+
* `CROWDIN_PROJECT_ID` as a variable.
73+
* `CROWDIN_AUTH_TOKEN` as a secret.
74+
75+
### Code signing
76+
77+
NV Access signs snapshot/tagged builds with SignPath.
78+
79+
To enable, set:
80+
81+
* `API_SIGNING_TOKEN` as a secret with your SignPath token.
82+
83+
### Uploading symbols
84+
85+
NVDA uploads its build symbols to Mozilla to help them with debugging on snapshot/tagged builds.
86+
87+
To enable, set:
88+
89+
* `MOZILLA_SYMS_TOKEN` as a secret.
90+
* `feature_uploadSymbolsToMozilla` as a variable with any non-empty string.
91+
92+
Generating this requires direct co-ordination with Mozilla.
93+
94+
### GitHub Environments
95+
96+
GitHub Environments are used to protect deployments of snapshot/tagged builds.
97+
98+
Create two GitHub Environments, one called `production`, the other `snapshot`.
99+
100+
#### production
101+
102+
Used for tagged releases of NVDA.
103+
It's recommended to enable deployment protection rules so that a human can confirm the deployment of a built tagged release staged for deployment.
104+
This is so any desired testing can get manually confirmed, and communications for the release can be prepared.
105+
106+
Configuration:
107+
108+
* Name: `production`
109+
* Enable required reviewers: this ensures a human must confirm deployment of a staged release
110+
* Under "Deployment branches and tags", create a tag rule: `release-*`
111+
112+
#### snapshot
113+
114+
Configuration:
115+
116+
* Name: `snapshot`
117+
* Do not enable required reviewers: this is not needed for snapshots.
118+
* Under "Deployment branches and tags", create these branch rules:
119+
* `master`
120+
* `beta`
121+
* `rc`
122+
* `try-**`
123+
124+
### Deployment webhook
125+
126+
Create a GitHub webhook to subscribe to snapshot/tagged builds of NVDA, and use it to deploy to a server.
22127

23-
## Testing
128+
Under events, only subscribe to the Deployments event.
24129

25-
Before testing we:
130+
Ensure a secret is set and SSL is enabled.
26131

27-
* Create directories to store results.
28-
* Install NVDA for system tests
132+
### VirusTotal scanning
29133

30-
The tests we perform are:
134+
NV Access scans tagged builds with VirusTotal.
31135

32-
* check translation comments
33-
* license checks
34-
* unit tests
35-
* system tests
36-
* each test suite (i.e. .robot file) must be manually included by:
37-
* adding a tag to `Force Tags` in the suite
38-
* adding the tag to `systemTests.strategy.matrix.testSuite` in the [CI script](../.github/workflows/testAndPublish.yml)
136+
Set `VT_API_KEY` as a secret to perform tagged builds.
39137

40-
## Artifacts
138+
### GitHub Discussions category
41139

42-
* NVDA launcher.
43-
* Test results.
140+
This is only used when building tagged builds.
141+
GitHub Discussions created for stable releases must go into a "Releases" category.
142+
Discussions must be enabled in the repository.
143+
Create a new discussion category with an "Announcement" type, and a category name of "Releases".

ci/scripts/setSconsArgs.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
$ErrorActionPreference = "Stop";
22
$sconsOutTargets = "launcher developerGuide changes userGuide keyCommands client moduleList"
3+
# AppX is currently unmaintained and not built by default.
34
if ($env:GITHUB_EVENT_NAME -eq "push" -and $env:feature_buildAppx) {
45
$sconsOutTargets += " appx"
56
}

0 commit comments

Comments
 (0)