-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (136 loc) · 3.76 KB
/
Copy pathci.yaml
File metadata and controls
161 lines (136 loc) · 3.76 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: ci
on:
push:
branches: [ "main" ]
paths:
- .github/workflows/ci.yml
- cmd/**
- config/**
- internal/**
- test/**
- vendor/**
- .golangci.yml
- Dockerfile
- Makefile
- go.mod
- go.sum
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/ci.yml
- cmd/**
- config/**
- internal/**
- test/**
- vendor/**
- .golangci.yml
- Dockerfile
- Makefile
- go.mod
- go.sum
jobs:
go:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: checkout
uses: actions/checkout@v5
- name: read go version from go.mod
run: |
# prints the go version for use in setup go
echo "GO_VERSION=$(awk 'NR==3 {print $2}' go.mod)" >> $GITHUB_ENV
- name: setup go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: unit test
run: make test
- name: Golangci-lint
uses: golangci/golangci-lint-action@v9.1.0
container:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: checkout
uses: actions/checkout@v5
- name: set up QEMU
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/setup-qemu-action@v3
# needed for build caching
- name: set up docker buildx
uses: docker/setup-buildx-action@v3.11.1
- name: log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and push container image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: ghcr.io/cyclingwithelephants/cloudflare-gateway-controller:latest
platforms: ${{ github.ref == 'refs/heads/main' && 'linux/amd64,linux/arm64' || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max
e2e:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v5
- name: setup kind cluster
uses: helm/kind-action@v1.12.0
with:
cluster_name: kind
- name: e2e test
run: |
make test-e2e
generated-files:
name: generated files
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v5
- run: make manifests
- name: check for diff
run: |
if ! git diff --quiet; then
git diff
exit 1
else
echo "no diff detected."
fi
conformance:
runs-on: ubuntu-latest
env:
WORKING_DIRECTORY: test/conformance
steps:
- name: checkout
uses: actions/checkout@v5
- name: set up docker buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v2.8.0
- name: setup kind cluster
uses: helm/kind-action@v1.12.0
with:
cluster_name: conformance
- name: build app
working-directory: ${{ env.WORKING_DIRECTORY}}
run: |
make build-app
- name: build test runner
working-directory: ${{ env.WORKING_DIRECTORY}}
run: |
make build-test-runner
- name: deploy app
working-directory: ${{ env.WORKING_DIRECTORY}}
run: |
make deploy-app
- name: Run conformance tests
working-directory: ${{ env.WORKING_DIRECTORY}}
continue-on-error: true
run: |
make run-conformance-tests