Skip to content

Commit

Permalink
ci: install signal in desktop vm and take screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsgruk committed Nov 25, 2023
1 parent 7959d0a commit 29c08ce
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/deskrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
export WAYLAND_DISPLAY=wayland-0
export DISPLAY=:0.0

exec "$@"
60 changes: 53 additions & 7 deletions .github/workflows/test-snap-can-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,65 @@ permissions:
contents: read

jobs:
build:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- uses: snapcore/action-build@v1
- name: Build snap
uses: snapcore/action-build@v1
id: build

- uses: diddlesnaps/snapcraft-review-action@v1
- name: Review snap
uses: diddlesnaps/snapcraft-review-action@v1
with:
snap: ${{ steps.build.outputs.snap }}
isClassic: 'false'
# Plugs and Slots declarations to override default denial (requires store assertion to publish)
# plugs: ./plug-declaration.json
# slots: ./slot-declaration.json

- name: Enable KVM on runner
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup LXD
uses: canonical/[email protected]

- name: Setup test VM
run: |
# Start a desktop VM
lxc launch images:ubuntu/22.04/desktop test-vm --vm \
-c limits.cpu=1 -c limits.memory=6GiB -d root,size=12GiB
# Push the snap we just built into the VM and install it
lxc file push "${{ steps.build.outputs.snap }}" test-vm/home/ubuntu/signal.snap
lxc exec test-vm -- snap install /home/ubuntu/signal.snap --dangerous
# Install gnome-screenshot
lxc exec test-vm -- apt-get update
lxc exec test-vm -- apt-get -y gnome-screenshot
# Push the deskrun tool into the VM
lxc file push .github/deskrun test-vm/bin/deskrun
- name: Start Signal Desktop in the VM
run: |
lxc exec test-vm -- sudo -u ubuntu bash -c "/bin/deskrun snap run signal-desktop &>/home/ubuntu/signal.log &"
sleep 10
- name: Take screenshots and pull from VM
run: |
lxc exec test-vm -- sudo -u ubuntu bash -c "/bin/deskrun gnome-screenshot -f /home/ubuntu/screen.png"
lxc exec test-vm -- sudo -u ubuntu bash -c "/bin/deskrun gnome-screenshot -w -f /home/ubuntu/window.png"
lxc file pull test-vm/home/ubuntu/screen.png screen.png
lxc file pull test-vm/home/ubuntu/window.png window.png
- name: Upload screenshots as artifacts
uses: actions/upload-artifact@v3
with:
name: screenshots
path: |
screen.png
window.png

0 comments on commit 29c08ce

Please sign in to comment.