-
Notifications
You must be signed in to change notification settings - Fork 6
220 lines (208 loc) · 7.65 KB
/
qa.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: QA
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: QA-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
flutter-version: 3.13.x
jobs:
quality-go:
name: "Go Quality checks"
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
subproject: [
"agentapi",
"contractsapi",
"mocks",
"storeapi/go-wrapper/microsoftstore",
"windows-agent",
"wsl-pro-service",
"end-to-end",
"common",
]
exclude:
- os: windows
subproject: wsl-pro-service
- os: ubuntu
subproject: end-to-end
include:
- subproject: agentapi
needs-flutter: true
runs-on: ${{ matrix.os }}-latest
steps:
- name: Set up git
# This step needs to be done before checkout so that the checkout respects clrf
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out repository
uses: actions/checkout@v4
- name: Set up flutter
uses: subosito/flutter-action@v2
if: matrix.needs-flutter != ''
with:
channel: 'stable'
flutter-version: ${{ env.flutter-version }}
- name: Install Dart protoc plugin
if: matrix.needs-flutter != ''
shell: bash
working-directory: ${{ matrix.subproject }}
run: |
dart pub global activate protoc_plugin
- name: Quality check
uses: EduardGomezEscandell/desktop-engineering/gh-actions/go/code-sanity@dont-use-sudo
with:
working-directory: ${{ matrix.subproject }}
go-tags: gowslmock
tools-directory: ${{ github.workspace }}/tools
golangci-lint-configfile: ${{ github.workspace }}/.golangci.yaml
- name: Gettext validation
shell: bash
working-directory: ${{ matrix.subproject }}
run: |
set -eu
tmp=`mktemp`
grep -nr --include="*.go" 'i18n.G([^"]' ./* | grep -Pv '_test.go:' > "${tmp}/log" || true
[ -z "$(cat "${tmp}/log")" ] && exit 0
echo 'Bad i18n.G calls. Gettext will only detect calls of type G("text"), with double quotes.'
cat "${tmp}/log"
exit 1
quality-flutter:
name: "Flutter Quality checks"
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
package: ["gui/packages/p4w_ms_store", "gui/packages/ubuntupro"]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Set up git
# This step needs to be done before checkout so that the checkout respects clrf
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure dependencies on Ubuntu
if: ${{ matrix.os == 'ubuntu' }}
run: |
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev unzip xvfb
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Go
# We need to set up Go so that the agent can be built for the end-to-end tests
if: matrix.package == 'gui/packages/ubuntupro'
uses: actions/setup-go@v4
with:
go-version-file: windows-agent/go.mod
- name: Flutter QA
uses: ./.github/actions/flutter-qa/
with:
flutter-version: ${{ env.flutter-version }}
package-dir: '${{ matrix.package }}'
run-build-runner: ${{ contains(matrix.package, 'ubuntupro') }}
- name: Ensure module files are up to date
uses: EduardGomezEscandell/desktop-engineering/gh-actions/common/has-diff@dont-use-sudo
with:
working-directory: ${{ matrix.package }}
paths-to-ignore: '*/pubspec.lock'
fail-on-diff: true
flutter-integration:
name: "Flutter integration tests"
strategy:
fail-fast: false
# For now we don't have a way to run integration test on ubuntu.
# It looks silly to keep this matrix, but we'll be able to run this on Linux eventually and there are gotchas already solved here
# such as the dependency on xvfb since ubuntu runners on GH don't have graphical capabilities.
matrix:
os: [windows]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Set up git
# This step needs to be done before checkout so that the checkout respects clrf
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure dependencies on Ubuntu
if: ${{ matrix.os == 'ubuntu' }}
run: |
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev unzip xvfb
- name: Check out repository
uses: actions/checkout@v4
- name: Flutter QA
uses: ./.github/actions/flutter-integration-test/
with:
flutter-version: ${{ env.flutter-version }}
go-version-file: windows-agent/go.mod
# Only the app entry point is expected to have integration tests
package-dir: 'gui/packages/ubuntupro'
quality-cpp:
name: "C++ Quality Checks"
runs-on: windows-latest
steps:
- name: Set up git
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out repository
uses: actions/checkout@v4
- name: C++ QA
uses: ./.github/actions/cpp-qa/
with:
subproject-dir: 'storeapi/test'
tests-go-with-mocks:
name: "Run Go tests with mocks"
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
subproject: ["storeapi/go-wrapper/microsoftstore", "windows-agent", "wsl-pro-service", "common"]
exclude:
- os: windows
subproject: wsl-pro-service
# Excluded because common/i18n depends on gettext
- os: ubuntu
subproject: "common"
# Excluded because microsoftstore_test needs msbuild
- os: ubuntu
subproject: "storeapi/go-wrapper/microsoftstore"
runs-on: ${{ matrix.os }}-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: ${{ matrix.subproject }}/go.mod
- name: Set up git
uses: ./.github/actions/setup-git
with:
token: ${{ secrets.GITHUB_TOKEN }}
# The Windows Store needs to be built. The tests do it automatically, but they need
# msbuild in the path.
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v1
if: matrix.subproject == 'storeapi/go-wrapper/microsoftstore'
- name: Run tests
shell: bash
if: always() && !cancelled()
working-directory: ${{ matrix.subproject }}
run: |
go test -shuffle=on -coverpkg=./... -coverprofile=/tmp/coverage.out -covermode=count ./... -tags=gowslmock
- name: Run tests (with race detector)
shell: bash
# -race not supported on Windows
if: matrix.os != 'windows'
working-directory: ${{ matrix.subproject }}
run: |
go test -shuffle=on ./... -race -tags=gowslmock
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# file: /tmp/coverage.out