Skip to content

Add more information on testing for devs #1610

Add more information on testing for devs

Add more information on testing for devs #1610

name: "Test new runtime and examples"
on:
push
jobs:
run_debian_12:
name: "Test new runtime on Droplet with Debian 12"
runs-on: ubuntu-latest
concurrency: droplet-aleph-vm-runtime
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch the whole history for all tags and branches (required for aleph.__version__)
fetch-depth: 0
- name: Workaround github issue https://github.com/actions/runner-images/issues/7192
run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Setup SSH private key
run: |
mkdir ~/.ssh
echo $DIGITALOCEAN_SSH_PRIVATE_KEY | base64 --decode > ~/.ssh/id_ed25519
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/id_ed25519
env:
DIGITALOCEAN_SSH_PRIVATE_KEY: ${{ secrets.DIGITALOCEAN_SSH_PRIVATE_KEY }}
- name: Create the Droplet
run: |
doctl compute droplet create \
--image debian-12-x64 \
--size c-4 \
--region ams3 \
--vpc-uuid 5976b7bd-4417-49e8-8522-672aaa920c30 \
--enable-ipv6 \
--ssh-keys ab:2b:25:16:46:6f:25:d0:80:63:e5:be:67:04:cb:64 \
aleph-vm-ci-runtime
- name: "Build custom runtime"
run: |
sudo apt update
sudo apt install -y debootstrap
cd runtimes/aleph-debian-12-python && sudo ./create_disk_image.sh && cd ../..
- uses: actions/upload-artifact@v4
with:
name: aleph-debian-12-python.squashfs
path: runtimes/aleph-debian-12-python/rootfs.squashfs
- name: Build Debian Package
run: |
cd packaging && make all-podman-debian-12 && cd ..
ls packaging/target
- name: Wait for the system to setup and boot
run: |
export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-runtime --output json | ./.github/scripts/extract_droplet_ipv4.py)"
until ssh-keyscan -H ${DROPLET_IPV4}; do sleep 1; done
- name: Copy the runtime to the system
run: |
export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-runtime --output json | ./.github/scripts/extract_droplet_ipv4.py)"
ssh-keyscan -H ${DROPLET_IPV4} > ~/.ssh/known_hosts
scp runtimes/aleph-debian-12-python/rootfs.squashfs root@${DROPLET_IPV4}:/opt
- name: Install Aleph-VM on the Droplet
run: |
export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-runtime --output json | ./.github/scripts/extract_droplet_ipv4.py)"
ssh-keyscan -H ${DROPLET_IPV4} > ~/.ssh/known_hosts
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 update"
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 upgrade -y"
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 install -y docker.io apparmor-profiles"
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha"
scp packaging/target/aleph-vm.debian-12.deb root@${DROPLET_IPV4}:/opt
scp -pr ./examples root@${DROPLET_IPV4}:/opt/
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt -o DPkg::Lock::Timeout=60 install -y /opt/aleph-vm.debian-12.deb"
ssh root@${DROPLET_IPV4} "echo ALEPH_VM_SUPERVISOR_HOST=0.0.0.0 >> /etc/aleph-vm/supervisor.env"
ssh root@${DROPLET_IPV4} "echo ALEPH_VM_FAKE_DATA_PROGRAM=/opt/examples/example_fastapi >> /etc/aleph-vm/supervisor.env"
ssh root@${DROPLET_IPV4} "echo ALEPH_VM_FAKE_DATA_RUNTIME=/opt/rootfs.squashfs >> /etc/aleph-vm/supervisor.env"
ssh root@${DROPLET_IPV4} "systemctl restart aleph-vm-supervisor"
- name: Test Aleph-VM on the Droplet
run: |
export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-runtime --output json | ./.github/scripts/extract_droplet_ipv4.py)"
sleep 3
curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/about/usage/system"
curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/status/check/fastapi"
- name: Export aleph logs
if: always()
run: |
export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-runtime --output json | ./.github/scripts/extract_droplet_ipv4.py)"
ssh root@${DROPLET_IPV4} "journalctl -u aleph-vm-supervisor"
- name: Cleanup
if: always()
run: |
doctl compute droplet delete -f aleph-vm-ci-runtime