-
Notifications
You must be signed in to change notification settings - Fork 11
132 lines (113 loc) · 3.58 KB
/
refresh.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
name: Refresh examples
on:
push:
branches:
- 22/main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 22/main
jobs:
Refresh22:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
branch:
- 22/Flutter-demo
- 22/GTK3-adventure
- 22/GTK3-mastermind
- 22/Qt6-example
- 22/SDL2-neverputt
- 22/native-glmark2
- 22/x11-glxgears
review:
- true
include:
- branch: 22/Electron-quick-start
review: false
- branch: 22/Qt5-bomber-first-try
downstream: 22/Qt5-bomber
steps:
- name: Check out code
uses: actions/checkout@v3
with:
# check out the target branch
ref: ${{ matrix.branch }}
# we need all the history to rebase
fetch-depth: 0
- name: Update ${{ matrix.branch }}
env:
GIT_AUTHOR_NAME: "Mir CI Bot"
GIT_AUTHOR_EMAIL: "mir-ci-bot@canonical.com"
GIT_COMMITTER_NAME: "Mir CI Bot"
GIT_COMMITTER_EMAIL: "mir-ci-bot@canonical.com"
run: |
git fetch origin ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}
git rebase FETCH_HEAD
if [ -n "${{ matrix.downstream }}" ]; then
# there's a "second stage" here
git checkout ${{ matrix.downstream }}
git rebase ${{ matrix.branch }}
fi
- name: Build the snap
uses: canonical/actions/build-snap@release
with:
review: ${{ matrix.review }}
- name: Install prerequisites
run: |
sudo apt-get --yes install coreutils xvfb inotify-tools
sudo snap install ubuntu-frame
- name: Install the built snap and set it up
run: |
sudo snap install --dangerous ./iot-example-graphical-snap*.snap
/snap/iot-example-graphical-snap/current/bin/setup.sh
- name: Test that it runs
run: |
wayland_display=${WAYLAND_DISPLAY:-wayland-0}
if [ -O "${XDG_RUNTIME_DIR}/${wayland_display}" ]; then
# Choose a (new) WAYLAND_DISPLAY
port=0
while [ -e "${XDG_RUNTIME_DIR}/wayland-${port}" ]; do
((port+=1))
done
wayland_display=wayland-${port}
fi
WAYLAND_DISPLAY="${wayland_display}" xvfb-run ubuntu-frame&
xvfb_run_pid=$?
wait_for()
{
until
until
inotifywait --event create "$(dirname "$1")"&
inotify_pid=$!
[ -e "$1" ] || sleep 2 && [ -e "$1" ]
do
wait "${inotify_pid}"
done
kill "${inotify_pid}"
[ -O "$1" ]
do
sleep 1
done
}
wait_for "${XDG_RUNTIME_DIR}/${wayland_display}"
RET=0
WAYLAND_DISPLAY="${wayland_display}" timeout --kill-after=5 30 iot-example-graphical-snap || RET=$?
echo ">>>>>>" $RET "<<<<<<"
killall "$(realpath /snap/ubuntu-frame/current/usr/local/bin/frame)"
# `timeout` returns 124 on timeout, and that's what we're expecting
[ "$RET" == 124 ] || exit 1
- if: ${{ failure() && runner.debug }}
name: Debug
uses: lhotari/action-upterm@v1
with:
limit-access-to-actor: true
- name: Push upstream
if: ${{ github.event_name == 'push' }}
run: |
git push --force origin ${{ matrix.branch }}
if [ -n "${{ matrix.downstream }}" ]; then
git push --force origin ${{ matrix.downstream }}
fi