forked from rancher/rke2
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (159 loc) · 5.11 KB
/
test-suite.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Test Suite
on:
push:
paths-ignore:
- "**.md"
- "channel.yaml"
- "install.sh"
- ".github/**"
- "!.github/workflows/test-suite.yaml"
pull_request:
paths-ignore:
- "**.md"
- "channel.yaml"
- "install.sh"
- ".github/**"
- "!.github/workflows/test-suite.yaml"
workflow_dispatch: {}
permissions:
contents: read
jobs:
build:
name: Build RKE2 Images and Binary
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Find Go Version for Build
id: go-finder
run: |
GOOS=linux GOARCH=amd64 . ./scripts/version.sh
set +x
VERSION_GOLANG=$(echo $VERSION_GOLANG | sed 's/go//')
echo "VERSION_GOLANG=${VERSION_GOLANG}" >> "$GITHUB_OUTPUT"
- name: Install Go
uses: ./.github/actions/setup-go
with:
go-version: ${{ steps.go-finder.outputs.VERSION_GOLANG }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install OS Packages
run: sudo apt-get update && sudo apt-get install -y libarchive-tools g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64
# Can only upload from a single path, so we need to copy the binary to the image directory
# Additionally, we have a rke2-runtime.tar and a rke2-images.linux-amd64.tar.zst which are the same thing
# just compressed. We remove the rke2-runtime.tar as its not used by the install script.
- name: Build RKE2 Binary and Compressed Runtime Image
run: |
GOCOVER=true make package-bundle
make package-image-runtime
cp ./bin/rke2 ./build/images/rke2
cp ./dist/artifacts/rke2.*-amd64.tar.gz ./build/images/
rm ./build/images/rke2-runtime.tar
- name: Upload RKE2 Binary and Runtime Image
uses: actions/upload-artifact@v4
with:
name: rke2-test-artifacts
path: ./build/images/*
itest:
needs: build
name: Integration Tests
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
itest: [etcdsnapshot]
max-parallel: 3
env:
GOCOVERDIR: /tmp/rke2cov
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Setup Build Directories
run: |
mkdir -p ./bin ./build/images
- name: Download RKE2 Binary and Runtime Image
uses: actions/download-artifact@v4
with:
name: rke2-test-artifacts
path: ./build/images
- name: Setup Binary
run: |
mv ./build/images/rke2 ./bin/rke2
chmod +x ./bin/rke2
- name: Run Integration Tests
run: |
mkdir -p $GOCOVERDIR
sudo -E env "PATH=$PATH" go test -v -timeout=45m ./tests/integration/${{ matrix.itest }}/... -run Integration
- name: Generate coverage report
run: go tool covdata textfmt -i $GOCOVERDIR -o ${{ matrix.itest }}.out
- name: Upload Results To Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./${{ matrix.itest }}.out
flags: inttests # optional
verbose: true # optional (default = false)
- name: On Failure, Dump Server Logs
if: ${{ failure() }}
run: cat ./tests/integration/${{ matrix.itest }}/r2log.txt
e2e:
name: "E2E Tests"
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
etest: [dnscache, kine]
max-parallel: 3
steps:
- name: "Checkout"
uses: actions/checkout@v4
with: {fetch-depth: 1}
- name: Set up vagrant and libvirt
uses: ./.github/actions/vagrant-setup
- name: "Vagrant Cache"
uses: actions/cache@v4
with:
path: |
~/.vagrant.d/boxes
key: vagrant-box-ubuntu-2004
- name: "Vagrant Plugin(s)"
run: vagrant plugin install vagrant-rke2 vagrant-reload vagrant-scp
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false
- name: Install Kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Download RKE2 Binary and Runtime Image
uses: actions/download-artifact@v4
with:
name: rke2-test-artifacts
path: ./artifacts
- name: Place the artifacts back and compute sha256sum
run: |
mkdir -p ./dist/artifacts
mkdir -p ./build/images
mkdir -p ./bin
mv ./artifacts/rke2-* ./build/images/
mv ./artifacts/rke2.*-amd64.tar.gz ./dist/artifacts
sha256sum ./dist/artifacts/rke2.linux-amd64.tar.gz > ./dist/artifacts/sha256sum-amd64.txt
- name: Run ${{ matrix.etest }} Test
run: |
cd tests/e2e/${{ matrix.etest }}
go test -v -timeout=45m ./${{ matrix.etest}}_test.go -ci -local