-
Notifications
You must be signed in to change notification settings - Fork 214
122 lines (110 loc) · 3.73 KB
/
tests-labeled.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
# Run integration tests.
# Start when pull request is labeled with 'run/tests' label.
name: Tests
on:
pull_request:
types: [labeled]
jobs:
check:
name: Check and remove label
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.check.outputs.run_tests }}
build_multi_arch: ${{ steps.check.outputs.build_multi_arch }}
steps:
- uses: actions/github-script@v7
id: check
with:
script: |
const RUN_TESTS_LABEL = 'run/tests';
const labelName = context.payload.label.name;
if (labelName !== RUN_TESTS_LABEL) {
return console.log(`Not a 'run tests' label: '${labelName}'. Skip tests.`);
}
console.log(`Detect 'run tests' label '${labelName}'. Remove label and run tests.`);
core.setOutput('run_tests', 'true');
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: labelName,
});
} catch (e) {
console.log(`Error occurred while remove label. Possibly label is already removed. Ignore '${typeof e}' error.`);
}
integration_tests:
name: Integration tests
needs:
- check
if: needs.check.outputs.run_tests == 'true'
strategy:
fail-fast: true
matrix:
include:
- k8s_version: "1.23"
kind_node_image: "kindest/node:v1.23.17"
cluster_name: "kube-1-23"
- k8s_version: "1.24"
kind_node_image: "kindest/node:v1.24.15"
cluster_name: "kube-1-24"
- k8s_version: "1.25"
kind_node_image: "kindest/node:v1.25.11"
cluster_name: "kube-1-25"
- k8s_version: "1.26"
kind_node_image: "kindest/node:v1.26.6"
cluster_name: "kube-1-26"
- k8s_version: "1.27"
kind_node_image: "kindest/node:v1.27.3"
cluster_name: "kube-1-27"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Check out shell-operator code
uses: actions/checkout@v4
- name: Restore Go modules
id: go-modules-cache
uses: actions/[email protected]
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- name: Download Go modules
if: steps.go-modules-cache.outputs.cache-hit != 'true'
run: |
go mod download
echo -n "Go modules unpacked size is: " && du -sh $HOME/go/pkg/mod
- name: Download prebuilt libjq static libraries
run: |
curl -sSfL https://github.com/flant/libjq-go/releases/download/jq-b6be13d5-0/libjq-glibc-amd64.tgz | tar zxf -
- name: Install ginkgo
run: |
go install github.com/onsi/ginkgo/ginkgo
echo $PATH
ls -la $GOPATH/bin
ginkgo version
- name: Start kind cluster
uses: engineerd/[email protected]
with:
version: "v0.20.0"
image: ${{ matrix.kind_node_image }}
name: ${{ matrix.cluster_name }}
- name: Run integration tests
env:
CLUSTER_NAME: ${{ matrix.cluster_name }}
run: |
export CGO_ENABLED=1
export CGO_CFLAGS="-I$GITHUB_WORKSPACE/libjq/include"
export CGO_LDFLAGS="-L$GITHUB_WORKSPACE/libjq/lib"
export GOOS=linux
ginkgo \
--tags 'integration test' \
--vet off \
--race \
-p \
-r test/integration