-
Notifications
You must be signed in to change notification settings - Fork 17
122 lines (106 loc) · 3.02 KB
/
tests.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Tests
on:
- push
- pull_request
jobs:
lint:
name: lint
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt install shellcheck
- name: Lint
run: |
make check-lint
build:
name: build
needs:
- lint
runs-on: ubuntu-22.04
env:
MICROOVN_SNAP: microovn.snap
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Clear FORWARD firewall rules
run: |
# Docker can inject rules causing firewall conflicts
sudo iptables -P FORWARD ACCEPT || true
sudo ip6tables -P FORWARD ACCEPT || true
sudo iptables -F FORWARD || true
sudo ip6tables -F FORWARD || true
- name: Install dependencies
run: |
sudo snap refresh
sudo snap set lxd daemon.group=adm
sudo lxd init --auto
sudo snap install snapcraft --classic
- name: Build snap
run: make $MICROOVN_SNAP
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: snaps
path: ${{ env.MICROOVN_SNAP }}
retention-days: 5
metadata:
name: Generate matrix
needs:
- build
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate matrix
id: generate-matrix
run: |
MATRIX_JSON="{\"test-file\": ["
TEST_FILES=( $(cd tests; ls -1 *.bats) )
for (( i=0 ; i < "${#TEST_FILES[@]}"; i++ )); do
if [ $i -gt 0 ]; then
MATRIX_JSON+=","
fi
MATRIX_JSON+="\"${TEST_FILES[$i]}\""
done
MATRIX_JSON+="]}"
echo matrix=${MATRIX_JSON} | tee -a ${GITHUB_OUTPUT}
system-tests:
name: System tests
needs:
- metadata
runs-on: ubuntu-22.04
env:
MICROOVN_SNAP_PATH: ${{ github.workspace }}/microovn.snap
MICROOVN_SNAP_CHANNEL: 22.03/stable
strategy:
matrix: ${{ fromJson(needs.metadata.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download built snap
uses: actions/download-artifact@v3
with:
name: snaps
- name: Clear FORWARD firewall rules
run: |
# Docker can inject rules causing firewall conflicts
sudo iptables -P FORWARD ACCEPT || true
sudo ip6tables -P FORWARD ACCEPT || true
sudo iptables -F FORWARD || true
sudo ip6tables -F FORWARD || true
- name: Install dependencies
run: |
sudo snap refresh
sudo snap set lxd daemon.group=adm
sudo lxd init --auto
snap list
- name: Run system tests
run: .bats/bats-core/bin/bats tests/${{ matrix.test-file }}