-
Notifications
You must be signed in to change notification settings - Fork 880
68 lines (52 loc) · 2.11 KB
/
alpine-unittests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Alpine Unittests
on:
pull_request:
branches-ignore:
- 'ubuntu/**'
push:
branches:
- main
concurrency:
group: 'ci-${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true
defaults:
run:
shell: sh -ex {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
# Fetch all tags for tools/read-version
fetch-depth: 0
- name: Install incus
run: curl https://pkgs.zabbly.com/get/incus-stable | sudo sh -x
- name: Reset the firewall
run: |
sudo iptables -I DOCKER-USER -j ACCEPT
- name: Init incus
run: |
sudo incus admin init --auto
# we shouldn't have to do this, but the link is down and we need it up
sudo ip link set incusbr0 up
- name: Create alpine container
# the current shell doesn't have incus-admin as one of the groups
# so switch groups to run incus commands
run: sudo sg incus-admin -c 'incus launch images:alpine/edge alpine'
- name: Check networking (for debugging)
run: |
sudo sg incus-admin -c 'incus exec alpine -- ping -c 1 google.com || true'
sudo sg incus-admin -c 'incus exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true'
sudo sg incus-admin -c 'incus exec alpine -- nslookup www.google.com || true'
sudo sg incus-admin -c 'incus exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true'
- name: Install dependencies
run: sudo sg incus-admin -c 'incus exec alpine -- apk add py3-tox git'
- name: Mount source into container directory
run: sudo sg incus-admin -c 'incus 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 incus-admin -c 'incus exec alpine -- git clone cloud-init-ro/ cloud-init-rw'
- name: Run unittests
run: sudo sg incus-admin -c 'incus exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3"'