-
Notifications
You must be signed in to change notification settings - Fork 14
108 lines (104 loc) · 3.38 KB
/
integration-informing.yaml
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
name: Informing Integration Tests
on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
- 'release-[0-9]+.[0-9]+'
- 'autoupdate/sync/**'
pull_request:
paths-ignore:
- 'docs/**'
permissions:
contents: read
jobs:
build:
name: Build ${{ matrix.patch }}
runs-on: ubuntu-20.04
strategy:
matrix:
patch: ["strict", "moonray"]
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Checking out repo
uses: actions/checkout@v4
- name: Install lxd
run: |
sudo snap refresh lxd --channel 5.21/stable
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
- name: Install snapcraft
run: |
sudo snap install snapcraft --classic
- name: Apply ${{ matrix.patch }} patch
run: |
./build-scripts/patches/${{ matrix.patch }}/apply
- name: Build snap
run: |
sg lxd -c 'snapcraft --use-lxd'
mv k8s_*.snap k8s-${{ matrix.patch }}.snap
- name: Uploading snap
uses: actions/upload-artifact@v4
with:
name: k8s-${{ matrix.patch }}.snap
path: k8s-${{ matrix.patch }}.snap
test-integration:
needs: [ build ]
name: Test ${{ matrix.patch }} ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu:20.04"]
patch: ["strict", "moonray"]
fail-fast: false
runs-on: ["self-hosted", "Linux", "AMD64", "jammy", "large"]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install tox
run: pip install tox
- name: Install lxd
run: |
sudo snap refresh lxd --channel 5.21/stable
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
- name: Download snap
uses: actions/download-artifact@v4
with:
name: k8s-${{ matrix.patch }}.snap
path: ${{ github.workspace }}/build
- name: Apply ${{ matrix.patch }} patch
run: |
./build-scripts/patches/${{ matrix.patch }}/apply
- name: Run end to end tests
env:
TEST_SNAP: ${{ github.workspace }}/build/k8s-${{ matrix.patch }}.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ${{ matrix.os }}
TEST_FLAVOR: ${{ matrix.patch }}
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
run: |
cd tests/integration && sg lxd -c 'tox -e integration'
- name: Prepare inspection reports
if: failure()
run: |
tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports
echo "artifact_name=inspection-reports-${{ matrix.os }}-${{ matrix.patch }}" | sed 's/:/-/g' >> $GITHUB_ENV
- name: Upload inspection report artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ github.workspace }}/inspection-reports.tar.gz