-
Notifications
You must be signed in to change notification settings - Fork 43
313 lines (228 loc) · 8.53 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
name: CI
on: [push, pull_request]
jobs:
frontend_build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./web
strategy:
matrix:
node-version: ["18.x"]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'web/package-lock.json'
- name: Install dependencies
run: npm install
- name: Build the application
run: make
- name: Run check spell
run: npm run cspell
- name: Check types
run: npm run check-types
- name: Run ESLint
run: npm run eslint
- name: Run Stylelint
run: npm run stylelint
- name: Run the tests and generate coverage report
run: npm test -- --coverage
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
base-path: ./web
flag-name: frontend
parallel: true
ruby_tests:
runs-on: ubuntu-latest
env:
COVERAGE: 1
defaults:
run:
working-directory: ./service
strategy:
fail-fast: false
matrix:
distro: [ "tumbleweed" ]
container:
image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby
steps:
- name: Git Checkout
uses: actions/checkout@v3
- name: Configure and refresh repositories
# disable unused repositories to have faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref )
- name: Install Ruby development files
run: zypper --non-interactive install gcc gcc-c++ make openssl-devel ruby-devel npm augeas-devel
- name: Install required packages
run: zypper --non-interactive install yast2-iscsi-client
- name: Install RubyGems dependencies
run: bundle config set --local with 'development' && bundle install
- name: Run the tests and generate coverage report
run: bundle exec rspec
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
base-path: ./service
flag-name: backend
parallel: true
ruby_linter:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./service
strategy:
fail-fast: false
matrix:
distro: [ "leap_latest" ]
container:
image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby
steps:
- name: Git Checkout
uses: actions/checkout@v3
- name: Rubocop
run: /usr/bin/rubocop.*-1.24.1
ruby_doc:
runs-on: ubuntu-latest
env:
COVERAGE: 1
defaults:
run:
working-directory: ./service
strategy:
fail-fast: false
matrix:
distro: [ "tumbleweed" ]
container:
image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby
steps:
- name: Git Checkout
uses: actions/checkout@v3
- name: Configure and refresh repositories
# disable unused repositories to have faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref )
- name: Install Ruby development files and XML tooling
run: zypper --non-interactive install gcc gcc-c++ make openssl-devel ruby-devel npm augeas-devel xmlstarlet
- name: Install RubyGems dependencies
run: bundle config set --local with 'development' && bundle install
- name: Generate doc
run: bundle exec yardoc --fail-on-warning
- name: Check that introspected API and its docs have not diverged
run: make -C ../doc check
rust_ci:
runs-on: ubuntu-latest
env:
COVERAGE: 1
defaults:
run:
working-directory: ./rust
strategy:
fail-fast: false
matrix:
distro: [ "tumbleweed" ]
container:
image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby
options: --security-opt seccomp=unconfined
steps:
- name: Git Checkout
uses: actions/checkout@v3
- name: Configure and refresh repositories
# disable unused repositories to have faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref )
- name: Install Rust development files
run: zypper --non-interactive install rustup
- name: Install required packages
run: zypper --non-interactive install python-langtable-data openssl-3 libopenssl-3-devel jq
- name: Install Rust toolchains
run: rustup toolchain install stable
- name: Install cargo-binstall
uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
- name: Install Tarpaulin (for code coverage)
run: cargo-binstall --no-confirm cargo-tarpaulin
- name: Run the tests
run: cargo tarpaulin --out xml
- name: Lint formatting
run: cargo fmt --all -- --check
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
base-path: ./rust
format: cobertura
flag-name: rust-backend
parallel: true
integration-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# TW is needed because of the Cockpit packages
distro: [ "tumbleweed" ]
steps:
# TODO: Reuse/share building the frontend and backend with the other steps
# TODO: Cache the Ruby gems and node packages
- name: Git Checkout
uses: actions/checkout@v3
- name: Created shared YaST log directory
run: mkdir -p /tmp/log/YaST2
- name: Start container
run: podman run --privileged --detach --name agama --ipc=host -e CI -e GITHUB_ACTIONS -v /dev:/dev -v .:/checkout -v /tmp/log/YaST2:/var/log/YaST2 registry.opensuse.org/yast/head/containers/containers_tumbleweed/opensuse/agama-testing:latest
- name: Environment
run: podman exec agama bash -c "env | sort"
- name: Build the frontend
run: podman exec agama bash -c "cd /checkout/web && npm install && make"
- name: Install the frontend
run: podman exec agama bash -c "ln -snfv /checkout/web/dist /usr/share/cockpit/agama"
# ./setup-service.sh will try setting up cockpit.socket
# which has a login page, so this local-session needs to be first
- name: Start Cockpit service
run: podman exec --detach agama /usr/libexec/cockpit-ws --local-session=/usr/bin/cockpit-bridge
- name: Setup service
run: podman exec agama bash -c "cd /checkout; ./setup-service.sh"
- name: Set a testing Agama configuration
# copy a simplified ALP config file, it skips the product selection at the beginning
run: podman exec agama bash -c "cp /checkout/playwright/config/agama.yaml /checkout/service/etc/agama.yaml"
- name: Show NetworkManager log
run: podman exec agama journalctl -u NetworkManager
- name: Show the D-Bus services log
run: podman exec agama bash -c "journalctl | grep agama"
- name: Check DBus socket
run: podman exec agama ls -l /var/run/dbus/system_bus_socket
- name: Run the Agama smoke test
run: podman exec agama curl http://localhost:9090/cockpit/@localhost/agama/index.html
- name: Check Playwright version
run: podman exec agama playwright --version
- name: Run the Playwright tests
# user authentication is not required when cockpit runs a local session
# run the tests in the Chromium browser
run: podman exec agama bash -c "cd /checkout/playwright && SKIP_LOGIN=true playwright test --trace on --project chromium"
- name: Again show the D-Bus services log
run: podman exec agama bash -c "journalctl | grep agama"
- name: Show the complete journal
# maybe not necessary if the above filtered journalctl calls are enough
run: podman exec agama journalctl -b || echo "journal failed with $?"
- name: Upload the test results
uses: actions/upload-artifact@v3
# run even when the previous step fails
if: always()
with:
name: test-results
retention-days: 30
path: |
playwright/test-results/**/*
/tmp/log/YaST2/y2log
finish:
runs-on: ubuntu-latest
needs: [frontend_build, ruby_tests, rust_ci]
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v1
with:
parallel-finished: true