Skip to content

Commit 4d99360

Browse files
authored
Merge 7b370a0 into ea668ee
2 parents ea668ee + 7b370a0 commit 4d99360

File tree

2 files changed

+152
-48
lines changed

2 files changed

+152
-48
lines changed

.github/workflows/testAndPublish.yml

Lines changed: 151 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ name: CI/CD
33
on:
44
push:
55
branches:
6-
- master
7-
- beta
8-
- rc
9-
- 'try-**'
10-
# Currently disabled while the 2025.1 release is in progress.
11-
# Blocked by #17878
12-
# tags:
13-
# - 'release-**'
6+
- master
7+
- beta
8+
- rc
9+
- 'try-**'
10+
tags:
11+
- 'release-**'
1412

1513
pull_request:
1614
branches:
17-
- master
18-
- beta
19-
- rc
15+
- master
16+
- beta
17+
- rc
2018

2119
workflow_dispatch:
2220

@@ -37,6 +35,11 @@ jobs:
3735
buildNVDA:
3836
name: Build NVDA
3937
runs-on: windows-latest
38+
outputs:
39+
version: ${{ steps.releaseInfo.outputs.VERSION }}
40+
versionType: ${{ steps.releaseInfo.outputs.VERSION_TYPE }}
41+
APIVersion: ${{ steps.releaseInfo.outputs.NVDA_API_VERSION }}
42+
APIBackCompat: ${{ steps.releaseInfo.outputs.NVDA_API_COMPAT_TO }}
4043
steps:
4144
- name: Checkout NVDA
4245
uses: actions/checkout@v4
@@ -74,6 +77,13 @@ jobs:
7477
with:
7578
path: ${{ github.workspace }}
7679
key: ${{ github.ref }}-${{ github.run_id }}
80+
- name: Store release metadata information
81+
id: releaseInfo
82+
run: |
83+
Write-Output VERSION=$env:version >> $env:GITHUB_OUTPUT
84+
Write-Output VERSION_TYPE=$env:versionType >> $env:GITHUB_OUTPUT
85+
Write-Output NVDA_API_VERSION=$(python -c "import sys; sys.path.append('source'); from addonAPIVersion import CURRENT; print('{}.{}.{}'.format(*CURRENT))") >> $env:GITHUB_OUTPUT
86+
Write-Output NVDA_API_COMPAT_TO=$(python -c "import sys; sys.path.append('source'); from addonAPIVersion import BACK_COMPAT_TO; print('{}.{}.{}'.format(*BACK_COMPAT_TO))") >> $env:GITHUB_OUTPUT
7787
7888
checkPot:
7989
name: Check translator comments
@@ -179,6 +189,9 @@ jobs:
179189
name: Create launcher
180190
runs-on: windows-latest
181191
needs: buildNVDA
192+
outputs:
193+
launcherUrl: ${{ steps.uploadLauncher.outputs.artifact-url }}
194+
launcherSha256: ${{ steps.addJobSummary.outputs.SHA256 }}
182195
steps:
183196
- name: Checkout cached build
184197
uses: actions/cache/restore@v4
@@ -206,38 +219,38 @@ jobs:
206219
uses: actions/upload-artifact@v4
207220
with:
208221
name: NVDA launcher
209-
path: output/nvda*.exe
222+
path: |
223+
output/nvda*.exe
224+
output/nvda*controllerClient.zip
210225
- name: Upload documentation artifacts
211226
uses: actions/upload-artifact@v4
212-
id: uploadDocsArtifacts
227+
id: uploadBuildArtifacts
213228
with:
214-
name: Documentation files
229+
name: Documentation files and packaging metadata
215230
path: |
216231
output/devDocs
217232
output/*.html
218233
output/*.css
219-
- name: Upload build artifacts
220-
uses: actions/upload-artifact@v4
221-
id: uploadBuildArtifacts
222-
with:
223-
name: Controller client and packaging metadata
224-
path: |
225-
output/nvda*controllerClient.zip
226234
output/library_modules.txt
227235
output/installed_python_packages.txt
228236
- name: Add job summary
237+
id: addJobSummary
229238
shell: bash
230239
run: |
231-
echo "* [Download the NVDA launcher](${{ steps.uploadLauncher.outputs.artifact-url }}) (${{ steps.uploadLauncher.outputs.artifact-digest }})" >> $GITHUB_STEP_SUMMARY
232-
echo "* [Download the documentation](${{ steps.uploadDocsArtifacts.outputs.artifact-url }})" >> $GITHUB_STEP_SUMMARY
233-
echo "* [Download the other build artifacts](${{ steps.uploadBuildArtifacts.outputs.artifact-url }})" >> $GITHUB_STEP_SUMMARY
234-
echo " * Controller client" >> $GITHUB_STEP_SUMMARY
235-
echo " * Packaging metadata (library modules, installed python packages)" >> $GITHUB_STEP_SUMMARY
240+
NVDA_EXE_NAME=$(ls output/nvda*.exe | head -n 1)
241+
SHA256=$(sha256sum "$NVDA_EXE_NAME" | cut -d ' ' -f 1)
242+
echo SHA256=$SHA256 >> $GITHUB_OUTPUT
243+
echo "* [Download the NVDA launcher](${{ steps.uploadLauncher.outputs.artifact-url }})" >> $GITHUB_STEP_SUMMARY
244+
echo " * SHA256 of launcher exe file: \`$SHA256\`" >> $GITHUB_STEP_SUMMARY
245+
echo "* [Download the documentation and other build artifacts](${{ steps.uploadBuildArtifacts.outputs.artifact-url }})" >> $GITHUB_STEP_SUMMARY
246+
echo " * User guide, change log, developer guide" >> $GITHUB_STEP_SUMMARY
247+
echo " * Packaging metadata: library modules, installed python packages" >> $GITHUB_STEP_SUMMARY
236248
237249
systemTests:
238250
strategy:
239251
fail-fast: false
240252
matrix:
253+
# To skip tests, and just run install, replace with [excluded_from_build]
241254
testSuite: [chrome, installer, startupShutdown]
242255
name: Run system tests
243256
runs-on: windows-latest
@@ -288,6 +301,8 @@ jobs:
288301
name: Create symbols
289302
runs-on: windows-latest
290303
needs: buildNVDA
304+
outputs:
305+
symbolsUrl: ${{ steps.uploadArtifact.outputs.artifact-url }}
291306
steps:
292307
- name: Checkout cached build
293308
uses: actions/cache/restore@v4
@@ -299,7 +314,8 @@ jobs:
299314
env:
300315
symStore: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\symstore.exe
301316
run: ci/scripts/buildSymbolStore.ps1
302-
- name: Upload symbols
317+
- name: Upload symbols artifact
318+
id: uploadArtifact
303319
uses: actions/upload-artifact@v4
304320
with:
305321
name: Symbols
@@ -357,13 +373,67 @@ jobs:
357373
GH_TOKEN: ${{ github.token }}
358374
GH_REPO: ${{ github.repository }}
359375

376+
deploySnapshot:
377+
name: Deploy NVDA snapshot
378+
permissions:
379+
contents: write
380+
deployments: write
381+
runs-on: ubuntu-latest
382+
needs: [buildNVDA, checkPot, licenseCheck, unitTests, createLauncher, systemTests, createSymbols]
383+
if: ${{ github.event_name == 'push' && !startsWith(github.ref_name, 'release-') }}
384+
concurrency:
385+
group: snapshot
386+
cancel-in-progress: true
387+
environment:
388+
name: snapshot
389+
steps:
390+
- name: Get NVDA launcher
391+
uses: actions/download-artifact@v4
392+
with:
393+
name: NVDA launcher
394+
path: output
395+
- name: Deploy snapshot
396+
shell: bash
397+
id: deploySnapshot
398+
env:
399+
GH_TOKEN: ${{ github.token }}
400+
run: |
401+
NVDA_EXE_NAME=$(ls output/nvda*.exe | head -n 1)
402+
NVDA_HASH=$(sha1sum "$NVDA_EXE_NAME" | cut -d ' ' -f 1)
403+
404+
gh api \
405+
--method POST \
406+
-H "Accept: application/vnd.github+json" \
407+
-H "X-GitHub-Api-Version: 2022-11-28" \
408+
/repos/${{ github.repository }}/deployments \
409+
-f "task=release" \
410+
-f "description=Release of $NVDA_EXE_NAME" \
411+
-f "ref=${{ github.ref_name }}" \
412+
-F "auto_merge=true" \
413+
-f "environment=snapshot" \
414+
-f "required_contexts[]" \
415+
-f "payload[NVDA_HASH]=$NVDA_HASH" \
416+
-f "payload[NVDA_DOWNLOAD_URL]=${{ needs.createLauncher.outputs.launcherUrl }}" \
417+
-f "payload[SYMBOLS_DOWNLOAD_URL]=${{ needs.createSymbols.outputs.symbolsUrl }}" \
418+
-f "payload[NVDA_VERSION]=${{ needs.buildNVDA.outputs.version }}" \
419+
-f "payload[NVDA_VERSION_TYPE]=${{ needs.buildNVDA.outputs.versionType }}" \
420+
-f "payload[NVDA_API_VERSION]=${{ needs.buildNVDA.outputs.APIVersion }}" \
421+
-f "payload[NVDA_API_COMPAT_TO]=${{ needs.buildNVDA.outputs.APIBackCompat }}"
422+
360423
release:
361424
name: Release NVDA
362425
permissions:
363426
contents: write
427+
deployments: write
428+
discussions: write
364429
runs-on: ubuntu-latest
365-
needs: [checkPot, licenseCheck, unitTests, systemTests, createSymbols]
430+
needs: [buildNVDA, checkPot, licenseCheck, unitTests, createLauncher, systemTests, createSymbols]
366431
if: startsWith(github.ref_name, 'release-')
432+
concurrency:
433+
group: release
434+
cancel-in-progress: true
435+
environment:
436+
name: production
367437
steps:
368438
- name: Get normalized tag names
369439
id: getReleaseNotes
@@ -388,26 +458,60 @@ jobs:
388458
run: |
389459
vtUrl=$(echo ${{ steps.virusTotal.outputs.analysis }} | sed -E 's/([^=]*)=([^,]*).*/\2/')
390460
echo VT_URL=$vtUrl >> $GITHUB_OUTPUT
461+
- name: Deploy release
462+
shell: bash
463+
id: deployRelease
464+
env:
465+
GH_TOKEN: ${{ github.token }}
466+
run: |
467+
NVDA_EXE_NAME=$(ls output/nvda*.exe | head -n 1)
468+
NVDA_HASH=$(sha1sum "$NVDA_EXE_NAME" | cut -d ' ' -f 1)
469+
470+
gh api \
471+
--method POST \
472+
-H "Accept: application/vnd.github+json" \
473+
-H "X-GitHub-Api-Version: 2022-11-28" \
474+
/repos/${{ github.repository }}/deployments \
475+
-f "task=release" \
476+
-f "description=Release of $NVDA_EXE_NAME" \
477+
-f "ref=${{ github.ref_name }}" \
478+
-F "auto_merge=false" \
479+
-f "environment=production" \
480+
-f "required_contexts[]" \
481+
-f "payload[NVDA_HASH]=$NVDA_HASH" \
482+
-f "payload[NVDA_DOWNLOAD_URL]=${{ needs.createLauncher.outputs.launcherUrl }}" \
483+
-f "payload[NVDA_VERSION]=${{ needs.buildNVDA.outputs.version }}" \
484+
-f "payload[NVDA_VERSION_TYPE]=${{ needs.buildNVDA.outputs.versionType }}" \
485+
-f "payload[NVDA_API_VERSION]=${{ needs.buildNVDA.outputs.APIVersion }}" \
486+
-f "payload[NVDA_API_COMPAT_TO]=${{ needs.buildNVDA.outputs.APIBackCompat }}"
487+
- name: Create release notes
488+
id: createReleaseNotes
489+
shell: bash
490+
run: |
491+
echo "* Highlights can be found in the [release blog post](https://www.nvaccess.org/post/nvda-${{ steps.getReleaseNotes.outputs.NORMALIZED_TAG_NAME }}/)." >> /tmp/releaseNotes.md
492+
echo "* [VirusTotal scan results](${{ steps.getVTUrl.outputs.VT_URL }})" >> /tmp/releaseNotes.md
493+
echo "* SHA256 sum: \`${{ needs.createLauncher.outputs.launcherSha256 }}\`" >> /tmp/releaseNotes.md
391494
- name: Publish pre-release
392495
if: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') }}
393-
uses: softprops/action-gh-release@v2
394-
with:
395-
prerelease: true
396-
make_latest: false
397-
name: ${{ steps.getReleaseNotes.outputs.RELEASE_NAME }}
398-
files: output/nvda*.exe
399-
body: |
400-
* Highlights can be found in the [release blog post](https://www.nvaccess.org/post/nvda-${{ steps.getReleaseNotes.outputs.NORMALIZED_TAG_NAME }}/).
401-
* [VirusTotal scan results](${{ steps.getVTUrl.outputs.VT_URL }}).
496+
shell: bash
497+
env:
498+
GH_TOKEN: ${{ github.token }}
499+
run: |
500+
gh release create ${{github.ref_name }} \
501+
--repo ${{ github.repository }} \
502+
--prerelease \
503+
--title "${{ steps.getReleaseNotes.outputs.RELEASE_NAME }}" \
504+
--notes-file /tmp/releaseNotes.md \
505+
--verify-tag
402506
- name: Publish stable release
403507
if: ${{ !contains(github.ref_name, 'rc') && !contains(github.ref_name, 'beta') }}
404-
uses: softprops/action-gh-release@v2
405-
with:
406-
prerelease: false
407-
make_latest: true
408-
discussion_category_name: Releases
409-
name: ${{ steps.getReleaseNotes.outputs.RELEASE_NAME }}
410-
files: output/nvda*.exe
411-
body: |
412-
* Highlights can be found in the [release blog post](https://www.nvaccess.org/post/nvda-${{ steps.getReleaseNotes.outputs.NORMALIZED_TAG_NAME }}/).
413-
* [VirusTotal scan results](${{ steps.getVTUrl.outputs.VT_URL }}).
508+
shell: bash
509+
env:
510+
GH_TOKEN: ${{ github.token }}
511+
run: |
512+
gh release create ${{github.ref_name }} \
513+
--repo ${{ github.repository }} \
514+
--title "${{ steps.getReleaseNotes.outputs.RELEASE_NAME }}" \
515+
--notes-file /tmp/releaseNotes.md \
516+
--verify-tag \
517+
--discussion-category Releases

ci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Some of these steps run concurrently.
2929
* Build launcher
3030
* Install NVDA
3131
* Run systems tests
32-
* Deploy (not fully active currently):
32+
* Deploy:
3333
* On tagged/snapshot builds, upload symbols to Mozilla
3434
* On beta branch builds, upload translation to Crowdin.
3535
* On snapshot builds, deploy to the server.

0 commit comments

Comments
 (0)