forked from canonical/ubuntu-desktop-provision
-
Notifications
You must be signed in to change notification settings - Fork 1
245 lines (225 loc) · 6.86 KB
/
ci.yml
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
flutter-analyze:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- run: melos analyze
bootstrap:
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- ubuntu_bootstrap_test.dart
- screenshot_test.dart
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- run: |
sudo apt update
sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip
sudo apt install -y dbus-x11 network-manager upower
make install_deps
- run: |
sudo loginctl enable-linger $USER
sudo systemctl start user@$UID.service
echo "XDG_RUNTIME_DIR=/run/user/$UID" >> $GITHUB_ENV
# write any setting to force-start dconf.service (via xvfb because dbus-launch needs a display)
xvfb-run -a gsettings set org.gnome.desktop.interface color-scheme "'default'"
- run: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test/${{matrix.target}}
working-directory: packages/ubuntu_bootstrap
env:
SUBIQUITY_REPLAY_TIMESCALE: 100
flutter-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- run: melos format
init-e2e:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip
sudo apt install -y gnome-initial-setup network-manager
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "./provd/go.mod"
- name: Build provd
run: go build ./cmd/provd
working-directory: provd
- name: Run provd
run: |
set -ux
set +e
mv provd/example.config.yaml provd/provd.yaml
sudo mkdir -p /run/provd
sudo chown $USER /run/provd
sudo provd/provd &
until [ -S /run/provd/provd.sock ]; do
sleep 1
done
sudo chmod go+rw /run/provd/provd.sock
- run: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test/e2e_test.dart
working-directory: packages/ubuntu_init
init:
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- ubuntu_init_test.dart
- screenshot_test.dart
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- run: sudo apt update
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip
- run: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test/${{matrix.target}}
working-directory: packages/ubuntu_init
flutter-mocks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- run: melos generate
- name: Check for outdated mocks
if: github.event_name == 'pull_request'
run: ./.github/scripts/check-outdated-files.sh
- name: Create PR
if: github.event_name == 'push'
uses: peter-evans/create-pull-request@v6
with:
add-paths: '**/*.mocks.dart'
title: 'chore: regenerate mocks'
commit-message: 'chore: regenerate mocks'
branch: create-pull-request/mocks
delete-branch: true
l10n:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- run: melos gen-l10n
- name: Check for outdated l10n
if: github.event_name == 'pull_request'
run: ./.github/scripts/check-outdated-files.sh
- name: Create PR
if: github.event_name == 'push'
uses: peter-evans/create-pull-request@v6
with:
add-paths: '**/l10n/*.dart'
title: 'chore: regenerate l10n'
commit-message: 'chore: regenerate l10n'
branch: create-pull-request/l10n
delete-branch: true
flutter-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: asdf-vm/actions/install@v3
- uses: bluefireteam/melos-action@v2
- name: Install dependencies
run: |
sudo apt update && sudo apt install lcov
make install_deps
- name: Setup environment
run: |
sudo loginctl enable-linger $USER
sudo systemctl start user@$UID.service
echo "XDG_RUNTIME_DIR=/run/user/$UID" >> $GITHUB_ENV
- run: melos coverage
- uses: codecov/codecov-action@v4
with:
flags: UI
token: ${{secrets.CODECOV_TOKEN}}
go-sanity:
name: "Go: Code sanity"
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y libgtk-3-dev
- uses: actions/checkout@v4
- name: Go code sanity check
uses: canonical/desktop-engineering/gh-actions/go/code-sanity@main
with:
golangci-lint-configfile: ".golangci.yaml"
tools-directory: "./provd/tools"
working-directory: "./provd"
- name: Build cmd/provd
run: |
set -eu
cd provd
go build ./cmd/provd
go-tests:
name: "Go: Tests"
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y libgtk-3-dev
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "./provd/go.mod"
- name: Run tests
run: |
set -eu
cd provd
go test -coverpkg=./... -coverprofile=/tmp/coverage.out -covermode=set ./... -shuffle=on
- name: Run tests (with race detector)
run: |
cd provd
go test -race ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: /tmp/coverage.out
flags: provd
token: ${{secrets.CODECOV_TOKEN}}