-
Notifications
You must be signed in to change notification settings - Fork 13
99 lines (96 loc) · 2.9 KB
/
strict-integration.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
name: Integration Tests (Strict)
on:
push:
branches:
- main
- 'release-[0-9]+.[0-9]+'
pull_request:
branches:
- main
- 'release-[0-9]+.[0-9]+'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
strict: ${{ steps.determine.outputs.strict }}
steps:
- name: Determine Strict branch
id: determine
env:
BRANCH: ${{ github.base_ref || github.ref }}
run: |
BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists
if [[ "${BRANCH}" == "main" ]]; then
echo "strict=autoupdate/strict" >> "$GITHUB_OUTPUT"
elif [[ "${BRANCH}" =~ "^release-[0-9]+\.[0-9]+$" ]]; then
echo "strict=${BRANCH}" >> "$GITHUB_OUTPUT"
else
echo "Failed to determine matching strict branch for ${BRANCH}"
echo "strict=" >> $GITHUB_OUTPUT
fi
build:
name: Build
runs-on: ubuntu-20.04
needs: [ prepare ]
if: ${{ needs.prepare.outputs.strict }}
steps:
- name: Checking out repo
uses: actions/checkout@v4
- name: Install lxd
run: |
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 strict patch
run: |
git checkout -b ${{ needs.prepare.outputs.strict }}
git config --global user.email [email protected]
git config --global user.name k8s-bot
git am ./build-scripts/patches/strict/*.patch
- name: Build snap
run: |
sg lxd -c 'snapcraft --use-lxd'
mv k8s_*.snap k8s-strict.snap
- name: Uploading snap
uses: actions/upload-artifact@v4
with:
name: k8s-strict.snap
path: k8s-strict.snap
test-integration:
needs: [ prepare, build ]
if: ${{ needs.prepare.outputs.strict }}
name: Test ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu:20.04"]
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install tox
run: pip install tox
- name: Install lxd
run: |
sudo snap refresh lxd --channel 5.19/stable
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
- name: Download snap
uses: actions/download-artifact@v4
with:
name: k8s-strict.snap
path: build
- name: Run end to end tests
run: |
export TEST_SNAP="$PWD/build/k8s-strict.snap"
export TEST_SUBSTRATE=lxd
export TEST_LXD_IMAGE=${{ matrix.os }}
cd tests/integration && sg lxd -c 'tox -e integration'