forked from Dynatrace/dynatrace-operator
-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (172 loc) · 5.82 KB
/
ci.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: CI
on:
push:
branches:
- master
- release-*
pull_request:
branches:
- "*"
permissions:
contents: read
env:
DOCKER_REGISTRY: "quay.io"
DOCKER_REPOSITORY: "dynatrace/dynatrace-operator"
jobs:
helm-test:
name: Run helm unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Set up Helm
uses: azure/setup-helm@b5b231a831f96336bbfeccc1329990f0005c5bb1 # v3.3
- name: Download dependencies
id: helm-unittest-download
run: |
make prerequisites/helm
- name: Run Unit tests
id: helm-unittest
run: |
make test/helm/unit
helm-lint:
name: Run helm linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Set up Helm
uses: azure/setup-helm@b5b231a831f96336bbfeccc1329990f0005c5bb1 # v3.3
- name: Run Linting
id: helm-linting
run: |
make test/helm/lint
tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Setup Golang
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # v3.3.0
with:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Download dependencies
id: depdownload
run: |
hack/build/ci/install-cgo-dependencies.sh
- name: Run Unit tests
id: unittest
run: |
make go/test-all
linting:
name: Run linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # v3.3.0
with:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Download dependencies
id: depdownload
run: |
hack/build/ci/install-cgo-dependencies.sh
- name: golangci-lint
uses: golangci/golangci-lint-action@537aa1903e5d359d0b27dbc19ddd22c5087f3fbc # v3.2.0
with:
version: v1.49
args: --build-tags containers_image_storage_stub,e2e --timeout 300s
prepare:
name: Prepare properties
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Prepare build parameters
id: prep
run: |
hack/build/ci/prepare-build-variables.sh
- name: Prepare build parameters
id: prepenv
run: |
# Set output parameters.
# Reason: global envs do not work in workflow calls
# More info: https://github.com/actions/runner/issues/480#issuecomment-1021278915
echo ::set-output name=registry::${{ env.DOCKER_REGISTRY }}
echo ::set-output name=repository::${{ env.DOCKER_REPOSITORY }}
outputs:
labels: ${{ steps.prep.outputs.docker_image_labels }}
version: ${{ steps.prep.outputs.docker_image_tag }}
registry: ${{ steps.prepenv.outputs.registry }}
repository: ${{ steps.prepenv.outputs.repository }}
build:
name: Build images
runs-on: ubuntu-latest
needs: [prepare, tests, linting]
strategy:
matrix:
platform: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Login to Registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build image
if: matrix.platform != 'arm64' || github.ref_protected
uses: ./.github/actions/build-image
with:
platform: ${{ matrix.platform }}
labels: ${{ needs.prepare.outputs.labels }}
image-tag: ${{ needs.prepare.outputs.version }}
push:
name: Push images
runs-on: ubuntu-latest
needs: [prepare, build]
strategy:
matrix:
platform: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Login to Registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Upload Image
if: matrix.platform != 'arm64' || github.ref_protected
uses: ./.github/actions/upload-image
with:
platform: ${{ matrix.platform }}
labels: ${{ needs.prepare.outputs.labels }}
version: ${{ needs.prepare.outputs.version }}
registry: ${{ needs.prepare.outputs.registry }}
repository: ${{ needs.prepare.outputs.repository }}
manifest:
name: Create manifest
needs: [prepare, push]
runs-on: ubuntu-latest
env:
COMBINED: ${{ github.ref_protected }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Login to Registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Create Manifests
uses: ./.github/actions/create-manifests
with:
version: ${{ needs.prepare.outputs.version }}
registry: ${{ needs.prepare.outputs.registry }}
repository: ${{ needs.prepare.outputs.repository }}
combined: ${{ env.COMBINED }}