-
Notifications
You must be signed in to change notification settings - Fork 116
75 lines (65 loc) · 2.08 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
name: Run All Tests
on:
push:
branches:
- develop
pull_request:
types: [opened, reopened, synchronize]
jobs:
test-all:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
k8s-version: [v1.27.0, latest]
steps:
- name: install kind
uses: helm/kind-action@v1
with:
install_only: true
- 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: Create Kind Cluster(k8s version ${{ env.k8s_version }})
run: |
k8s_version=${{ env.k8s_version }}
kind create cluster --image kindest/node:${k8s_version}
- name: Verify kind and k8s version
run: |
kind version
kubectl version
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
path: src/github.com/${{ github.repository }}
fetch-depth: 0
- name: Set up go
uses: actions/setup-go@v5
with:
go-version-file: src/github.com/${{ github.repository }}/go.mod
- name: Verify go version
run: |
go version
- name: Run tests
run: |
set -e -x
export GOPATH=$(pwd)
pushd src/github.com/${{ github.repository }}
# Install ytt for build
mkdir -p /tmp/bin
export PATH=/tmp/bin:$PATH
./hack/verify-no-dirty-files.sh
wget -O- https://carvel.dev/install.sh | K14SIO_INSTALL_BIN_DIR=/tmp/bin bash
# Ensure that there is no existing kapp installed
rm -f /tmp/bin/kapp
./hack/build-binaries.sh
export KAPP_E2E_NAMESPACE=kapp-test
kubectl create ns $KAPP_E2E_NAMESPACE
./hack/test-all.sh