-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: install signal in desktop vm and take screenshots
- Loading branch information
Showing
2 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
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
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 "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |