Skip to content

ci: install signal in desktop vm and take screenshots #84

ci: install signal in desktop vm and take screenshots

ci: install signal in desktop vm and take screenshots #84

name: 🧪 Test snap can be built on x86_64
on:
pull_request:
branches: [ "**" ]
# Permissions for GITHUB_TOKEN
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build snap
uses: snapcore/action-build@v1
id: build
- name: Review snap
uses: diddlesnaps/snapcraft-review-action@v1
with:
snap: ${{ steps.build.outputs.snap }}
isClassic: 'false'
- 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
# Wait for the VM agent to be running
while ! lxc exec test-vm -- cat /etc/hostname &>/dev/null; do
sleep 2
done
# 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