-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (96 loc) · 3.48 KB
/
tests.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
name: Test
on:
push:
branches:
- '**'
pull_request:
branches:
- master
jobs:
build:
name: Go tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out
uses: actions/checkout@v2
- name: ssh key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SLIPWAY_MACHINE_SSH }}" > ~/.ssh/id_rsa
- name: Kubebuilder
run: |
os=$(go env GOOS)
arch=$(go env GOARCH)
curl -L https://go.kubebuilder.io/dl/2.3.0/${os}/${arch} | tar -xz -C /tmp/
sudo mv /tmp/kubebuilder_2.3.0_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Test
run: make test
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GO111MODULE=off go get github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=cover.out -service=github
Minikube:
name: Minikube tests
runs-on: ubuntu-latest
steps:
- uses: azure/docker-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . -t slipway/slipway:$GITHUB_SHA
- name: Push the Docker image
run: docker push slipway/slipway:$GITHUB_SHA
- name: Minikube
run: |
sudo apt-get update -y
sudo apt-get install -y conntrack
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube
sudo mkdir -p /usr/local/bin/
sudo install minikube /usr/local/bin/
CHANGE_MINIKUBE_NONE_USER=true sudo -E minikube start --vm-driver=none --kubernetes-version v1.17.0 --wait=true
- name: get kustomize
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" \
| bash
sudo cp kustomize /usr/local/bin
- name: Build Slipway and deploy
run: |
mkdir base
touch base/kustomization.yaml
cd base
kustomize edit add base ../config/default
kustomize edit set image controller=slipway/slipway:${GITHUB_SHA}
kubectl create ns slipway-system
echo "${{ secrets.SLIPWAY_MACHINE_SSH }}" > id_rsa
kubectl create secret -n slipway-system generic slipwaykey \
--from-file=./id_rsa
kustomize build . | kubectl apply -f -
kubectl set env deployment/slipway-controller-manager \
-n slipway-system -c manager TMPDIR=/home/nonroot
kubectl describe pods -n slipway-system
- name: Deploy sample app
run: |
kubectl apply -k https://github.com/slipway-gitops/slipway-example-gitrepo//
- name: Validate sample app
run: |
kubectl describe deployment -n slipway-system slipway-controller-manager
kubectl wait --for=condition=Available -n slipway-system deployment/slipway-controller-manager --timeout=1000s
kubectl describe gitrepo
kubectl describe hash
NEXT_WAIT_TIME=0
until kubectl wait --for=condition=Available deployment/the-deployment --timeout=60s || [ $NEXT_WAIT_TIME -eq 20 ]; do
sleep $(( NEXT_WAIT_TIME++ ))
done
kubectl get cm the-map
kubectl get svc the-service