-
Notifications
You must be signed in to change notification settings - Fork 111
84 lines (76 loc) · 2.4 KB
/
test-gh.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
name: test-gh
"on":
push:
branches:
- develop
paths-ignore:
- 'docs/**'
- '*.md'
- 'cli/**'
pull_request:
types: [opened, reopened, synchronize]
paths-ignore:
- 'docs/**'
- '*.md'
- 'cli/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-all:
name: Run all tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
k8s-version: [v1.27.0, latest]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Resolve Kubernetes version
id: resolve-k8s-version
run: |
k8s_version=${{ matrix.k8s-version }}
if [ "${k8s_version}" = "latest" ]; then
k8s_version=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/kubernetes/kubernetes/releases/latest | grep -oE 'tag/v[0-9]+\.[0-9]+\.[0-9]+' | cut -d'/' -f2)
echo "Resolved latest k8s version to: $k8s_version"
fi
echo "k8s_version=$k8s_version" >> $GITHUB_ENV
- name: start minikube(k8s version ${{ env.k8s_version }})
uses: medyagh/setup-minikube@latest
with:
kubernetes-version: ${{ env.k8s_version }}
driver: docker
start: true
cpus: 3
memory: 8192m
- name: Verify env
run: |
kind version
kubectl version
go version
- name: Install Carvel Tools
run: ./hack/install-deps.sh
- name: Run Tests
run: |
set -e -x
mkdir /tmp/bin
export PATH=/tmp/bin:$PATH
# Need to install protoc to run generators used in ./hack/verify-no-dirty-files.sh
curl -sLO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
echo "b9ff821d2a4f9e9943dc2a13e6a76d99c7472dac46ddd3718a3a4c3b877c044a protoc-3.15.8-linux-x86_64.zip" | sha256sum -c -
unzip protoc-3.15.8-linux-x86_64.zip -d /tmp
./hack/verify-no-dirty-files.sh
eval $(minikube docker-env --shell=bash)
export KAPPCTRL_E2E_SECRETGEN_CONTROLLER=true
./hack/deploy-test.sh
export KAPPCTRL_E2E_NAMESPACE=kappctrl-test
kubectl create ns $KAPPCTRL_E2E_NAMESPACE
./hack/test-all.sh