@@ -196,17 +196,94 @@ jobs:
196
196
run : |
197
197
snapcraft upload *.snap --release ${{ needs.BuildAndTest.outputs.channel }}
198
198
199
+ # Run Linux integration tests for `staging` and `trying` branches
200
+ Linux-CI :
201
+ if : ${{ github.event_name == 'push' && contains('refs/heads/staging refs/heads/trying', github.ref) }}
202
+
203
+ needs :
204
+ - Publish-Snap
205
+
206
+ runs-on : testflinger
207
+
208
+ timeout-minutes : 30
209
+
210
+ strategy :
211
+ matrix :
212
+ driver : [qemu, lxd]
213
+
214
+ steps :
215
+ - name : Write the testflinger job
216
+ uses :
DamianReeves/[email protected]
217
+ with :
218
+ path : testflinger-${{ matrix.driver }}.yaml
219
+ write-mode : overwrite
220
+ contents : |
221
+ job_queue: vmware-fusion
222
+ provision_data:
223
+ vmx: /Users/michal/Virtual Machines.localized/linux.vmwarevm/linux.vmx
224
+ snapshot: Testflinger
225
+ image_url: http://cloud-images.ubuntu.com/releases/groovy/release/ubuntu-20.10-server-cloudimg-amd64.img
226
+ vmx_config:
227
+ memsize: 2048
228
+ vhv.enable: true
229
+ vpmc.enable: true
230
+
231
+ test_data:
232
+ test_cmds: |
233
+ set -xeuo pipefail
234
+
235
+ function _run() {{
236
+ ssh ${{ '${{SSH_OPTS}} "${{DEVICE_USER}}@${{DEVICE_IP}}" -- "${{@}}"' }}
237
+ }}
238
+
239
+ # Retry $1 times, with $2 seconds in between tries
240
+ function _retry() {{
241
+ tries=$1
242
+ interval=$2
243
+ shift 2
244
+ for try in $( seq $tries ); do
245
+ RC=0
246
+ ${{ '"${{@}}"' }} || RC=$?
247
+ [ $RC -eq 0 -o $try -eq $tries ] && return $RC
248
+ sleep $interval;
249
+ done
250
+ }}
251
+
252
+ function _exit() {{
253
+ _run sudo journalctl -u snap.multipass*
254
+ return $1
255
+ }}
256
+
257
+ _retry 5 30 _run sudo snap install multipass --channel ${{ needs.BuildAndTest.outputs.channel }}
258
+
259
+ if [ '${{ matrix.driver }}' == 'lxd' ]; then
260
+ _run sudo snap connect multipass:lxd lxd
261
+ _run sudo lxd init --auto
262
+ _run sudo multipass set local.driver=lxd
263
+ fi
264
+
265
+ _retry 2 30 _run /snap/bin/multipass find || _exit $?
266
+
267
+ _retry 5 10 _run /snap/bin/multipass start || _exit $?
268
+ _run /snap/bin/multipass list || _exit $?
269
+
270
+ - name : Submit and poll the job
271
+ run : |
272
+ JOB_ID=$( testflinger-cli submit --quiet testflinger-${{ matrix.driver }}.yaml )
273
+ testflinger-cli poll ${JOB_ID}
274
+ exit $( testflinger-cli results ${JOB_ID} | jq -r .test_status )
275
+
199
276
# Report result to Bors on `staging` and `trying` branches.
200
277
Linux :
201
278
if : ${{ always() && github.event_name == 'push' && contains('refs/heads/staging refs/heads/trying', github.ref) }}
202
279
needs :
203
- - BuildAndTest
280
+ - Linux-CI
204
281
205
282
runs-on : ubuntu-latest
206
283
207
284
steps :
208
285
- name : Report failure
209
- if : ${{ needs.BuildAndTest .result != 'success' }}
286
+ if : ${{ needs.Linux-CI .result != 'success' }}
210
287
run : exit 1
211
288
212
289
# Dispatch to the private side
0 commit comments