Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Apr 25, 2024
1 parent 3f615d7 commit 63a1186
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions .github/workflows/alpine-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,32 @@ jobs:
# Fetch all tags for tools/read-version
fetch-depth: 0

- name: Reset the firewall
run: |
sudo iptables -I DOCKER-USER -j ACCEPT
- name: Make sure the latest version is installed
run: |
sudo snap refresh lxd --channel latest/stable
- name: Init lxd
run: |
sudo lxd admin init --auto
# we shouldn't have to do this, but the link is down and we need it up
sudo ip link set lxdbr0 up
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1
with:
channel: latest/candidate

- name: Create alpine container
# the current shell doesn't have lxd as one of the groups
# so switch groups to run lxd commands
run: sudo sg lxd -c 'lxc launch images:alpine/edge alpine'
run: lxc launch images:alpine/edge alpine

- name: Check networking (for debugging)
run: |
sudo sg lxd -c 'lxc exec alpine -- ping -c 1 google.com || true'
sudo sg lxd -c 'lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true'
sudo sg lxd -c 'lxc exec alpine -- nslookup www.google.com || true'
sudo sg lxd -c 'lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true'
lxc exec alpine -- ping -c 1 google.com || true
lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true
lxc exec alpine -- nslookup www.google.com || true
lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true
- name: Install dependencies
run: sudo sg lxd -c 'lxc exec alpine -- apk add py3-tox git'
run: lxc exec alpine -- apk add py3-tox git

- name: Mount source into container directory
run: sudo sg lxd -c 'lxc config device add alpine gitdir disk source=$(pwd) path=/root/cloud-init-ro'
run: lxc config device add alpine gitdir disk source=$(pwd) path=/root/cloud-init-ro

- name: Create a r/w directory to run tests in
# without this, tox fails during package install
run: sudo sg lxd -c 'lxc exec alpine -- git clone cloud-init-ro/ cloud-init-rw'
run: lxc exec alpine -- git clone cloud-init-ro/ cloud-init-rw

- name: Run unittests
run: sudo sg lxd -c 'lxc exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3"'
run: lxc exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3"

0 comments on commit 63a1186

Please sign in to comment.