Update refresh.yml #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Refresh examples | |
on: | |
push: | |
branches: | |
- 20/main | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
Refresh20: | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
branch: | |
- 20/Flutter-demo | |
- 20/GTK3-adventure | |
- 20/GTK3-mastermind | |
- 20/Qt6-example | |
- 20/SDL2-neverputt | |
- 20/native-glmark2 | |
- 20/x11-glxgears | |
review: | |
- true | |
include: | |
- branch: 20/Electron-quick-start | |
review: false | |
- branch: 20/Qt5-bomber-first-try | |
downstream: 20/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 | |
sudo snap install --classic frame-it | |
- 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 |