|
1 | | -name: "Test on DigitalOcean Droplets" |
2 | | - |
| 1 | +# These are end-to-end tests running on ephemeral DigitalOcean "Droplet" virtual machines |
| 2 | +# with the different operating systems that are supported. |
| 3 | +# |
| 4 | +# The main focus of these tests is to ensure that the packaging works on all supported platforms |
| 5 | +# and to ensure the compatibility of dependencies (system and vendored) across these platforms. |
| 6 | +name: "Testing on DigitalOcean Droplets" |
| 7 | + |
| 8 | +# Run automatically on main branches, Pull Request updates and allow manual execution using `workflow_dispatch`. |
3 | 9 | on: |
4 | | - push |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + pull_request: |
| 14 | + types: |
| 15 | + - "opened" |
| 16 | + - "reopened" |
| 17 | + - "synchronize" |
| 18 | + - "ready_for_review" |
| 19 | + workflow_dispatch: |
5 | 20 |
|
6 | 21 | jobs: |
7 | | - tests-python: |
8 | | - name: "Test Python code" |
9 | | - runs-on: ubuntu-22.04 |
10 | | - |
11 | | - steps: |
12 | | - - uses: actions/checkout@v4 |
13 | | - |
14 | | - - name: Workaround github issue https://github.com/actions/runner-images/issues/7192 |
15 | | - run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc |
16 | | - |
17 | | - - name: Install required system packages only for Ubuntu Linux |
18 | | - run: | |
19 | | - sudo apt-get update |
20 | | - sudo apt-get -y upgrade |
21 | | - sudo apt-get install -y python3 python3-pip python3-aiohttp python3-msgpack python3-aiodns python3-alembic python3-sqlalchemy python3-setproctitle redis python3-aioredis python3-psutil sudo acl curl systemd-container squashfs-tools debootstrap python3-packaging python3-cpuinfo python3-nftables python3-jsonschema nftables |
22 | | - pip install --upgrade typing-extensions types-PyYAML |
23 | | -
|
24 | | - - name: Install required Python packages |
25 | | - run: | |
26 | | - python3 -m pip install hatch hatch-vcs coverage |
27 | | -
|
28 | | - - name: Test style wth ruff, black and isort |
29 | | - run: | |
30 | | - hatch run lint:style |
31 | | -
|
32 | | - - name: Test typing with Mypy |
33 | | - run: | |
34 | | - hatch run lint:typing |
35 | | -
|
36 | | - - name: Install required system packages for installing and running tests |
37 | | - run: | |
38 | | - sudo apt-get install libsystemd-dev cmake libdbus-1-dev libglib2.0-dev |
39 | | -
|
40 | | - - name: Download and build required files for running tests. Copied from packaging/Makefile. |
41 | | - run: | |
42 | | - sudo mkdir --parents /opt/firecracker/ |
43 | | - sudo curl -fsSL -o "/opt/firecracker/vmlinux.bin" "https://ipfs.aleph.cloud/ipfs/bafybeiaj2lf6g573jiulzacvkyw4zzav7dwbo5qbeiohoduopwxs2c6vvy" |
44 | | - |
45 | | - rm -fr /tmp/firecracker-release |
46 | | - mkdir --parents /tmp/firecracker-release /opt/firecracker |
47 | | - curl -fsSL https://github.com/firecracker-microvm/firecracker/releases/download/v1.5.0/firecracker-v1.5.0-x86_64.tgz | tar -xz --no-same-owner --directory /tmp/firecracker-release |
48 | | - # Copy binaries: |
49 | | - cp /tmp/firecracker-release/release-v*/firecracker-v*[!.debug] /opt/firecracker/firecracker |
50 | | - cp /tmp/firecracker-release/release-v*/jailer-v*[!.debug] /opt/firecracker/jailer |
51 | | - chmod +x /opt/firecracker/firecracker |
52 | | - chmod +x /opt/firecracker/jailer |
53 | | - |
54 | | - find /opt |
55 | | -
|
56 | | - - name: "Build custom runtime" |
57 | | - run: | |
58 | | - sudo apt update |
59 | | - sudo apt install -y debootstrap ndppd acl cloud-image-utils qemu-utils qemu-system-x86 |
60 | | - cd runtimes/aleph-debian-12-python && sudo ./create_disk_image.sh && cd ../.. |
61 | | -
|
62 | | - - name: "Build example volume" |
63 | | - run: | |
64 | | - cd examples/volumes && bash build_squashfs.sh |
65 | | -
|
66 | | - # Unit tests create and delete network interfaces, and therefore require to run as root |
67 | | - - name: Run unit tests |
68 | | - run: | |
69 | | - sudo python3 -m pip install hatch hatch-vcs coverage |
70 | | - sudo hatch run testing:cov |
71 | | -
|
72 | | - - name: Upload coverage reports to Codecov |
73 | | - |
74 | | - with: |
75 | | - token: ${{ secrets.CODECOV_TOKEN }} |
76 | | - slug: aleph-im/aleph-vm |
77 | | - |
78 | | - code-quality-shell: |
79 | | - runs-on: ubuntu-22.04 |
80 | | - |
81 | | - steps: |
82 | | - - uses: actions/checkout@v4 |
83 | | - |
84 | | - - name: Workaround github issue https://github.com/actions/runner-images/issues/7192 |
85 | | - run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc |
86 | | - |
87 | | - - name: Install required system packages only for Ubuntu Linux |
88 | | - run: | |
89 | | - sudo apt-get update |
90 | | - sudo apt-get install -y shellcheck |
91 | | -
|
92 | | - - name: Run Shellcheck on all shell scripts |
93 | | - run: | |
94 | | - find ./ -type f -name "*.sh" -exec shellcheck {} \; |
95 | | - |
96 | 22 |
|
97 | 23 | run_on_droplet: |
98 | 24 | name: "Test Droplet with ${{ matrix.os_config.os_name }}-${{ matrix.check_vm.alias }}" |
99 | 25 | runs-on: ubuntu-latest |
100 | 26 | concurrency: "${{ matrix.os_config.concurrency_group }}-${{ matrix.check_vm.alias }}" |
101 | 27 | timeout-minutes: 10 |
102 | | - needs: |
103 | | - - tests-python |
104 | | - - code-quality-shell |
105 | 28 |
|
106 | 29 | strategy: |
107 | 30 | matrix: |
@@ -238,6 +161,13 @@ jobs: |
238 | 161 | -d '{"persistent_vms": [], "instances": ["${{ matrix.check_vm.item_hash }}"]}' \ |
239 | 162 | "http://${DROPLET_IPV4}:4020/control/allocations" |
240 | 163 |
|
| 164 | + - name: Fetch system usage endpoint |
| 165 | + run: | |
| 166 | + export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} --output json | ./.github/scripts/extract_droplet_ipv4.py)" |
| 167 | + curl -X GET -H "Content-Type: application/json" \ |
| 168 | + "http://${DROPLET_IPV4}:4020/about/usage/system" |
| 169 | +
|
| 170 | +
|
241 | 171 | - name: Export aleph logs |
242 | 172 | if: always() |
243 | 173 | run: | |
|
0 commit comments