-
Notifications
You must be signed in to change notification settings - Fork 23
132 lines (111 loc) · 3.2 KB
/
testing.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
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
name: "Testing"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Go code
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.1
- name: Run General Linting
uses: docker://ghcr.io/github/super-linter:slim-v4.8.5
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_GO: false
VALIDATE_JSCPD: false
VALIDATE_GITHUB_ACTIONS: false
VALIDATE_NATURAL_LANGUAGE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_KUBERNETES_KUBEVAL: false
FILTER_REGEX_EXCLUDE: ".*/charts/kangal/templates/*"
- name: Get tag
id: get_tag
run: |
VERSION="$(git tag | grep -v kangal | sort -rV | head -n 1)"
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
- name: Lint GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: v1.2.2
args: --skip-publish --snapshot
env:
GORELEASER_CURRENT_TAG: ${{ steps.get_tag.outputs.tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Lint Helm
run: ct lint --config .github/ct.yaml
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: '^1.17'
- name: Run Unit tests
run: |
make test-unit
- name: Setup Kind
uses: engineerd/[email protected]
with:
version: "v0.11.1"
- name: Install Kangal CRD
run: |
make apply-crd
- name: Build Kangal
run: |
go mod vendor
make build
- name: Build dummy gRPC server Docker image
uses: docker/build-push-action@v3
with:
tags: greeter_server:local
context: pkg/controller/testdata/ghz
file: pkg/controller/testdata/ghz/Dockerfile
push: false
- name: Load docker image into kind cluster
run: |
docker images
kind load docker-image greeter_server:local
- name: Run Integration Tests
env:
AWS_ENDPOINT_URL: "localhost:8081"
AWS_BUCKET_NAME: "kangal-test"
run: |
./ci/integration-tests.sh
- name: Print Logs on Failure
if: failure()
run: |
echo "==> Printing Kangal Proxy Logs\n"
cat /tmp/kangal_proxy.log
echo "\n\n==> Printing Kangal Controller Logs\n"
cat /tmp/kangal_controller.log
- name: Upload codecov
uses: codecov/codecov-action@v3
if: success()
with:
file: ./coverage.txt
fail_ci_if_error: false