|
1 | 1 | # Continuous Integration with GitHub Actions |
2 | 2 |
|
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. |
4 | 14 |
|
5 | 15 | ## Builds |
6 | 16 |
|
| 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 | + |
7 | 41 | Builds will fail if any command has a non-zero exit code. |
8 | 42 | PowerShell scripts continue on non-terminating errors unless the file is prefixed with `$ErrorActionPreference = "Stop";`. |
9 | 43 |
|
10 | | -### Build process |
| 44 | +## Setup requirements |
11 | 45 |
|
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. |
22 | 127 |
|
23 | | -## Testing |
| 128 | +Under events, only subscribe to the Deployments event. |
24 | 129 |
|
25 | | -Before testing we: |
| 130 | +Ensure a secret is set and SSL is enabled. |
26 | 131 |
|
27 | | -* Create directories to store results. |
28 | | -* Install NVDA for system tests |
| 132 | +### VirusTotal scanning |
29 | 133 |
|
30 | | -The tests we perform are: |
| 134 | +NV Access scans tagged builds with VirusTotal. |
31 | 135 |
|
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. |
39 | 137 |
|
40 | | -## Artifacts |
| 138 | +### GitHub Discussions category |
41 | 139 |
|
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". |
0 commit comments