-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (169 loc) · 6.89 KB
/
Copy pathpull-request.yml
File metadata and controls
192 lines (169 loc) · 6.89 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Validation for pull requests.
#
# Deliberately does no signing and publishes nothing: anything touching the code-signing
# certificate runs in Azure Pipelines, because this repository is public and so are these
# logs. See docs/decisions.md, decision 3.
#
# Azure Pipelines only builds after a merge, so this is what stops a broken installer or a
# failing build reaching main - where every merge publishes a pre-release.
name: Pull request
on:
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
# A new push to the same pull request supersedes the run already in flight.
concurrency:
group: pull-request-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# The jobs below always run so that they always report a status - required checks that are
# skipped entirely can leave a pull request waiting forever. When nothing they cover has
# changed they finish in seconds instead.
changes:
name: Detect what changed
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
vscode: ${{ steps.filter.outputs.vscode }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: filter
shell: bash
run: |
files=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD")
echo "Changed files:"
echo "$files" | sed 's/^/ /'
if echo "$files" | grep -qE '^vscode/'; then
echo "vscode=true" >> "$GITHUB_OUTPUT"
echo "-> vscode extension changed"
else
echo "vscode=false" >> "$GITHUB_OUTPUT"
fi
if echo "$files" | grep -qvE '^(site/|docs/|vscode/|[^/]*\.md$)'; then
echo "code=true" >> "$GITHUB_OUTPUT"
echo "-> building: something outside site/, docs/, vscode/ and top-level markdown changed"
else
echo "code=false" >> "$GITHUB_OUTPUT"
echo "-> nothing to build: only the site, docs, vscode extension or markdown changed"
fi
# Release notes are written while the change is fresh, in the pull request that bumps the
# version, rather than remembered under pressure once the release is already public. The
# release itself is checked again in publish-site.yml.
notes:
name: Release notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check the version bump brings its notes
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$base = "origin/$env:BASE_REF"
function Get-VersionPrefix([string]$text) {
if ($text -match '<VersionPrefix>(.*?)</VersionPrefix>') { return $Matches[1].Trim() }
return ''
}
$before = Get-VersionPrefix (git show "${base}:Directory.Build.props" | Out-String)
$after = Get-VersionPrefix (Get-Content Directory.Build.props -Raw)
if ($before -eq $after) {
Write-Host "VersionPrefix is unchanged at $after, so no new notes are due."
return
}
Write-Host "VersionPrefix goes $before -> $after."
./scripts/release-notes.ps1 -Mode Verify -Version $after
env:
BASE_REF: ${{ github.base_ref }}
build:
name: Build and test
needs: changes
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
if: needs.changes.outputs.code == 'true'
- uses: actions/setup-dotnet@v5
if: needs.changes.outputs.code == 'true'
with:
dotnet-version: '10.0.x'
- name: Restore
if: needs.changes.outputs.code == 'true'
run: dotnet restore Whiteboard.sln
# TreatWarningsAsErrors is on for every project, so a warning fails here.
- name: Build
if: needs.changes.outputs.code == 'true'
run: dotnet build Whiteboard.sln --configuration Release --no-restore
- name: Core smoke tests
if: needs.changes.outputs.code == 'true'
run: >-
dotnet run
--project tests/SQLBI.Whiteboard.Core.SmokeTests/SQLBI.Whiteboard.Core.SmokeTests.csproj
--configuration Release
# The highlighting adapter runs on AvalonEdit, so its tests need WPF.
- name: Application smoke tests
if: needs.changes.outputs.code == 'true'
run: >-
dotnet run
--project tests/SQLBI.Whiteboard.SmokeTests/SQLBI.Whiteboard.SmokeTests.csproj
--configuration Release
installer:
name: Build installers
needs: changes
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
if: needs.changes.outputs.code == 'true'
- uses: actions/setup-dotnet@v5
if: needs.changes.outputs.code == 'true'
with:
dotnet-version: '10.0.x'
# Catches WiX authoring errors here rather than after a merge, when Azure Pipelines
# would sign and publish. Unsigned, and the output is discarded; the version is a
# placeholder with no meaning.
#
# Deliberately smaller than what ships, because this job is almost entirely CAB
# compression and none of that compression is what needs validating:
#
# -SelfContained false packages the framework-dependent build, a payload of roughly
# 15 MB rather than 252 MB. The same authoring and the same file
# harvesting run over it.
# -Variants builds a diagonal pair. The four variants are not repetition -
# they are four paths through the <?if?> branches in
# installer/wix/SQLBI.Whiteboard.wxs - but this pair still takes
# both sides of every conditional, so a typo in the dev branch or
# a broken per-user directory is still caught.
#
# Azure Pipelines builds all four variants self-contained on every merge to main, so
# what is skipped here is still checked before anything is signed or published.
- name: Build installers
if: needs.changes.outputs.code == 'true'
shell: pwsh
run: >-
./scripts/build-installer.ps1
-Version 0.0.0
-SelfContained false
-Variants stable/perMachine,dev/perUser
vscode:
name: VS Code extension
needs: changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
if: needs.changes.outputs.vscode == 'true'
- uses: actions/setup-node@v5
if: needs.changes.outputs.vscode == 'true'
with:
node-version: '22'
cache: npm
cache-dependency-path: vscode/sqlbi-whiteboard/package-lock.json
- name: Compile and test
if: needs.changes.outputs.vscode == 'true'
working-directory: vscode/sqlbi-whiteboard
run: |
npm ci
npm test