-
Notifications
You must be signed in to change notification settings - Fork 3
161 lines (153 loc) · 4.88 KB
/
build-and-test.yaml
File metadata and controls
161 lines (153 loc) · 4.88 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: build-and-test
on:
push:
branches-ignore:
- 'renovate/**'
- 'dependabot/**'
pull_request:
workflow_call:
inputs:
mode:
type: string
required: true
default: snapshot
description: |
the mode to use. either `snapshot` or `release`. Will affect effective version, as well
as target-oci-registry.
permissions:
contents: read
pull-requests: write
jobs:
run-tests:
strategy:
matrix:
go-version: [1.26.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Check Go module dependencies
run: |
set -eu
make gotidy
git diff -s --exit-code || ( echo 'Go module dependencies are of date, please run "make gotidy"' && exit 1 )
- name: Check API reference docs
run: |
set -eu
make api-ref-docs
git diff -s --exit-code || ( echo 'Generated API reference docs are of date, please run "make api-ref-docs"' && exit 1 )
- name: Check generate
run: |
set -eu
make generate
git diff -s --exit-code || ( echo 'Generated files are of date, please run "make generate"' && exit 1 )
- name: Check license headers
run: |
set -eu
make checklicense
- name: Check for vulnerabilities
run: |
set -eu
make govulncheck
- name: Run linter
run: |
set -eu
make goimports-reviser lint
- name: Run tests
run: |
set -eu
make test
- name: Build binary
run: |
set -eu
make build
prepare:
if: inputs.mode != ''
uses: gardener/cc-utils/.github/workflows/prepare.yaml@v1
with:
mode: ${{ inputs.mode }}
version-commit-callback-action-path: .github/actions/prepare-release
permissions:
id-token: write
oci-images:
name: Build OCI-Images
if: inputs.mode != ''
needs:
- run-tests
- prepare
permissions:
contents: read
packages: write
id-token: write
secrets: inherit
uses: gardener/cc-utils/.github/workflows/oci-ocm.yaml@v1
with:
name: gardener-extension-shoot-traefik
version: ${{ needs.prepare.outputs.version }}
target: gardener-extension-shoot-traefik
oci-registry: ${{ needs.prepare.outputs.oci-registry }}
oci-repository: gardener/extensions/gardener-extension-shoot-traefik
oci-platforms: linux/amd64,linux/arm64
extra-tags: latest
helmcharts:
name: Build Helmcharts
if: inputs.mode != ''
needs:
- prepare
- oci-images
permissions:
contents: read
packages: write
id-token: write
uses: gardener/cc-utils/.github/workflows/helmchart-ocm.yaml@v1
strategy:
matrix:
args:
- name: gardener-extension-shoot-traefik
dir: charts/gardener-extension-shoot-traefik
oci-repository: charts/gardener/extensions
ocm-mappings:
- ref: ocm-resource:gardener-extension-shoot-traefik.repository
attribute: image.repository
- ref: ocm-resource:gardener-extension-shoot-traefik.tag
attribute: image.tag
- name: admission-shoot-traefik-application
dir: charts/gardener-extension-admission-shoot-traefik/charts/application
oci-repository: charts/gardener/extensions
ocm-mappings:
- ref: ocm-resource:gardener-extension-shoot-traefik.repository
attribute: image.repository
- ref: ocm-resource:gardener-extension-shoot-traefik.tag
attribute: image.tag
- name: admission-shoot-traefik-runtime
dir: charts/gardener-extension-admission-shoot-traefik/charts/runtime
oci-repository: charts/gardener/extensions
ocm-mappings:
- ref: ocm-resource:gardener-extension-shoot-traefik.repository
attribute: image.repository
- ref: ocm-resource:gardener-extension-shoot-traefik.tag
attribute: image.tag
with:
name: ${{ matrix.args.name }}
dir: ${{ matrix.args.dir }}
oci-registry: ${{ needs.prepare.outputs.oci-registry }}
oci-repository: ${{ matrix.args.oci-repository }}
ocm-mappings: ${{ toJSON(matrix.args.ocm-mappings) }}
build-only:
if: inputs.mode == ''
needs:
- run-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build OCI image
uses: docker/build-push-action@v7
with:
push: false
tags: gardener-extension-shoot-traefik:latest