Merge pull request #26 from canonical/renovate/configure #58
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: | |
- 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 |