-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (126 loc) · 4.03 KB
/
Copy pathci.yaml
File metadata and controls
135 lines (126 loc) · 4.03 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
name: CI
on:
push:
branches: ["**"]
pull_request:
permissions:
contents: read
packages: write
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
- uses: azure/setup-helm@v4
- run: helm lint k8s/charts/wireguard-gateway-operator
codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
# mocks omitted: .mockery.yml has no packages registered yet
- run: make generate manifests crossplane-models
- run: git diff --exit-code
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- run: echo "KUBEBUILDER_ASSETS=$(make -s envtest)" >> "$GITHUB_ENV"
- run: make test-unit
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.out
fail_ci_if_error: false
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- run: make test-integration
e2e:
needs: [lint, unit, integration]
# Skip on forks: e2e needs GCP secrets the fork cannot read.
if: ${{ github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
# kind binary must match the sigs.k8s.io/kind version in go.mod; the
# library's node image uses a containerd config the runner's kind can't load.
- uses: helm/kind-action@v1
with:
version: v0.32.0
install_only: true
- run: sudo modprobe wireguard
- run: printf '%s' "$GCP_SA_KEY" > "$RUNNER_TEMP/gcp-creds.json"
env:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
- run: make test-e2e
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_REGION: ${{ secrets.GCP_REGION }}
GCP_ZONE: ${{ secrets.GCP_ZONE }}
GCP_CREDS_FILE: ${{ runner.temp }}/gcp-creds.json
build-push:
needs: [lint, unit, integration]
# Build on every push; on PRs build only from same-repo branches (fork PRs lack registry write).
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork == false }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: operator
target: operator
- image: link
target: link
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/greg2010/wireguard-gateway-operator/${{ matrix.image }}
tags: |
type=sha,prefix=sha-
type=ref,event=branch
- uses: docker/build-push-action@v6
with:
context: .
file: build/package/Dockerfile
target: ${{ matrix.target }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name == 'push' }}
platforms: ${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
cache-from: type=gha
cache-to: type=gha,mode=max