Skip to content

Commit 9af3de6

Browse files
authored
Try #2033:
2 parents 9afd6ee + cb1d9a5 commit 9af3de6

File tree

4 files changed

+221
-3
lines changed

4 files changed

+221
-3
lines changed

.github/workflows/linux.yml

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,94 @@ jobs:
196196
run: |
197197
snapcraft upload *.snap --release ${{ needs.BuildAndTest.outputs.channel }}
198198
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+
199276
# Report result to Bors on `staging` and `trying` branches.
200277
Linux:
201278
if: ${{ always() && github.event_name == 'push' && contains('refs/heads/staging refs/heads/trying', github.ref) }}
202279
needs:
203-
- BuildAndTest
280+
- Linux-CI
204281

205282
runs-on: ubuntu-latest
206283

207284
steps:
208285
- name: Report failure
209-
if: ${{ needs.BuildAndTest.result != 'success' }}
286+
if: ${{ needs.Linux-CI.result != 'success' }}
210287
run: exit 1
211288

212289
# Dispatch to the private side

.github/workflows/macos.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: macOS-CI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
package:
7+
description: URL of the macOS package to test
8+
9+
jobs:
10+
macOS-CI:
11+
runs-on: testflinger
12+
13+
timeout-minutes: 30
14+
15+
steps:
16+
- name: Write the testflinger job
17+
uses: DamianReeves/[email protected]
18+
with:
19+
path: testflinger.yaml
20+
write-mode: overwrite
21+
contents: |
22+
job_queue: vmware-fusion
23+
provision_data:
24+
vmx: /Users/michal/Virtual Machines.localized/macos-11.vmwarevm/macos-11.vmx
25+
snapshot: Testflinger
26+
vmx_config:
27+
vhv.enable: true
28+
29+
test_data:
30+
test_cmds: |
31+
set -xeuo pipefail
32+
33+
function _run() {{
34+
ssh ${{ '${{SSH_OPTS}} "${{DEVICE_USER}}@${{DEVICE_IP}}" -- "${{@}}"' }}
35+
}}
36+
37+
# Retry $1 times, with $2 seconds in between tries
38+
function _retry() {{
39+
tries=$1
40+
interval=$2
41+
shift 2
42+
for try in $( seq $tries ); do
43+
RC=0
44+
${{ '"${{@}}"' }} || RC=$?
45+
[ $RC -eq 0 -o $try -eq $tries ] && return $RC
46+
sleep $interval;
47+
done
48+
}}
49+
50+
function _exit() {{
51+
_run sudo cat /Library/Logs/Multipass/multipassd.log
52+
return $1
53+
}}
54+
55+
_run curl --location --output multipass.pkg ${{ github.event.inputs.package }}
56+
_run sudo installer -dumplog -target / -pkg multipass.pkg
57+
58+
_retry 3 10 _run /usr/local/bin/multipass find || _exit $?
59+
_retry 3 10 _run /usr/local/bin/multipass start || _exit $?
60+
_run /usr/local/bin/multipass list || _exit $?
61+
62+
- name: Submit and poll the job
63+
run: |
64+
JOB_ID=$( testflinger-cli submit --quiet testflinger.yaml )
65+
testflinger-cli poll ${JOB_ID}
66+
exit $( testflinger-cli results ${JOB_ID} | jq -r .test_status )

.github/workflows/windows.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Windows-CI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
package:
7+
description: URL of the Windows package to test
8+
9+
jobs:
10+
Windows-CI:
11+
runs-on: testflinger
12+
13+
timeout-minutes: 30
14+
15+
steps:
16+
- name: Write the testflinger job
17+
uses: DamianReeves/[email protected]
18+
with:
19+
path: testflinger.yaml
20+
write-mode: overwrite
21+
contents: |
22+
job_queue: vmware-fusion
23+
provision_data:
24+
vmx: /Users/michal/Virtual Machines.localized/windows-10.vmwarevm/windows-10.vmx
25+
snapshot: Testflinger
26+
vmx_config:
27+
vhv.enable: true
28+
29+
test_data:
30+
test_cmds: |
31+
set -xeuo pipefail
32+
33+
function _run() {{
34+
ssh ${{ '${{SSH_OPTS}} "${{DEVICE_USER}}@${{DEVICE_IP}}" -- "${{@}}"' }}
35+
}}
36+
37+
# Retry $1 times, with $2 seconds in between tries
38+
function _retry() {{
39+
tries=$1
40+
interval=$2
41+
shift 2
42+
for try in $( seq $tries ); do
43+
RC=0
44+
${{ '"${{@}}"' }} || RC=$?
45+
[ $RC -eq 0 -o $try -eq $tries ] && return $RC
46+
sleep $interval;
47+
done
48+
}}
49+
50+
function _ps() {{
51+
_run powershell -noprofile -noninteractive -command "${{@}}"
52+
}}
53+
54+
function _exit() {{
55+
return $1
56+
}}
57+
58+
_ps "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart"
59+
_ps "Restart-Computer -Force"
60+
sleep 30
61+
62+
_retry 12 5 _ps "(New-Object System.Net.WebClient).DownloadFile('${{ github.event.inputs.package }}', 'multipass-installer.exe')"
63+
_run .\\multipass-installer.exe /S || _exit $?
64+
_retry 12 5 _run multipass find || _exit $?
65+
66+
_retry 3 60 _run multipass start || _exit $?
67+
_run multipass list || _exit $?
68+
_retry 5 60 _run multipass exec primary -- uname -a
69+
_run multipass exec primary -- ip address show
70+
71+
- name: Submit and poll the job
72+
run: |
73+
JOB_ID=$( testflinger-cli submit --quiet testflinger.yaml )
74+
testflinger-cli poll ${JOB_ID}
75+
exit $( testflinger-cli results ${JOB_ID} | jq -r .test_status )

bors.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
status = [ "Linux", "Windows", "macOS" ]
1+
status = [ "Linux", "Windows-CI", "macOS-CI" ]
22
block-labels = [ "no-merge" ]
33
timeout-sec = 12000
44
delete-merged-branches = true

0 commit comments

Comments
 (0)