-
Notifications
You must be signed in to change notification settings - Fork 1
225 lines (214 loc) · 7.51 KB
/
pull-request-master.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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: pull-request-master
on:
merge_group:
pull_request:
branches:
- master
# Only run 1 of this workflow at a time per PR
concurrency:
group: chainlink-feeds-${{ github.ref }}
cancel-in-progress: true
env:
PACKAGES: "median"
jobs:
init:
runs-on: ubuntu-latest
outputs:
matrix_packages: ${{ steps.set-matrix-packages.outputs.matrix_packages }}
lint_args_packages: ${{ steps.set-matrix-packages.outputs.lint_args_packages }}
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Set matrix packages
id: set-matrix-packages
shell: bash
env:
PACKAGES: ${{ env.PACKAGES }}
run: |
matrix_packages=$(echo "${PACKAGES}" | jq -R 'split(",")' | tr -d "\n\t")
echo "matrix_packages=${matrix_packages}" | tee -a "${GITHUB_OUTPUT}"
- name: Set lint args packages
id: set-lint-args-packages
shell: bash
env:
PACKAGES: ${{ env.PACKAGES }}
# Convert "producer,reports_consumer" to "./producer/... ./reports_consumer/..."
run: echo "lint_args_packages=$(echo "./$(echo $PACKAGES | sed 's/,/\/... .\//g;s/$/\/.../')")" | tee -a "${GITHUB_OUTPUT}"
ci-lint:
runs-on: ubuntu-latest
needs: [init]
permissions:
id-token: write
contents: read
actions: read
steps:
- name: ci-lint
uses: smartcontractkit/.github/actions/ci-lint-go@main
with:
# grafana inputs
metrics-job-name: ci-lint
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
# gati inputs
use-gati: "true"
aws-role-arn-gati: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN_GATI }}
aws-lambda-url-gati: ${{ secrets.AWS_LAMBDA_URL_GATI }}
# env inputs
use-env-files: "true"
env-files: ./tools/env/ci.env
# go inputs
use-go-cache: true
go-cache-dep-path: "**/go.sum"
go-version-file: go.work
golangci-lint-version: "v1.53.2"
golangci-lint-args: --out-format checkstyle:golangci-lint-report.xml ${{ needs.init.outputs.lint_args_packages }}
ci-lint-charts:
runs-on: ubuntu-latest
steps:
- name: ci-lint-charts
uses: smartcontractkit/.github/actions/ci-lint-charts@main
with:
# chart testing inputs
chart-testing-extra-args: "--lint-conf=lintconf.yaml"
# grafana inputs
metrics-job-name: ci-lint-charts
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
ci-lint-misc:
runs-on: ubuntu-latest
steps:
- name: ci-lint-misc
uses: smartcontractkit/.github/actions/ci-lint-misc@main
with:
# grafana inputs
metrics-job-name: ci-lint-misc
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
ci-test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: ci-test
uses: smartcontractkit/.github/actions/ci-test-go@main
with:
# grafana inputs
metrics-job-name: ci-test
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
# gati inputs
use-gati: "true"
aws-role-arn-gati: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN_GATI }}
aws-lambda-url-gati: ${{ secrets.AWS_LAMBDA_URL_GATI }}
# docker inputs
use-docker-compose: "true"
docker-compose-workdir: ./tools/docker/setup-postgres
# env inputs
use-env-files: "true"
env-files: ./tools/env/ci.env
# go inputs
use-go-cache: "true"
go-cache-dep-path: "**/go.sum"
go-version-file: go.work
go-test-cmd: make test-ci
ci-build-artifacts-matrix:
needs: [init]
runs-on: ubuntu20.04-16cores-64GB
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.init.outputs.matrix_packages) }}
permissions:
id-token: write
contents: read
actions: read
steps:
- name: ci-build-artifacts-matrix (${{ matrix.package }})
uses: smartcontractkit/.github/actions/cicd-build-publish-artifacts-go@main
with:
# general inputs
app-name: mercury-pipeline-${{ matrix.package }}
publish: "true"
# grafana inputs
metrics-job-name: ci-build-artifacts-matrix (${{ matrix.package }})
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
aws-account-number: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}
# gati inputs
use-gati: "true"
aws-role-arn-gati: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN_GATI }}
aws-lambda-url-gati: ${{ secrets.AWS_LAMBDA_URL_GATI }}
# golang inputs
go-version-file: go.work
# goreleaser inputs
goreleaser-args: "--nightly --config ./${{ matrix.package }}/.goreleaser.ci.yaml"
goreleaser-dist: goreleaser-pro
goreleaser-key: ${{ secrets.GORELEASER_KEY }}
# zig inputs
use-zig: "true"
zig-version: "0.11.0"
# docker inputs
docker-registry: aws
docker-image-tag: devel
- name: Save GoReleaser artifacts/metadata
uses: actions/upload-artifact@v3
with:
name: goreleaser_${{ matrix.package }}
path: |
dist/artifacts.json
dist/metadata.json
ci-build-artifacts:
runs-on: ubuntu-latest
needs: [ci-build-artifacts-matrix]
if: always()
steps:
- name: Check results
if: needs.ci-build-artifacts-matrix.result != 'success'
run: exit 1
- name: Collect metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: ci-build-artifacts
continue-on-error: true
ci-build-charts:
runs-on: ubuntu-latest
steps:
- name: ci-build-charts
uses: smartcontractkit/.github/actions/cicd-build-publish-charts@main
with:
# general inputs
charts-dir: helm
# grafana inputs
metrics-job-name: ci-build-charts
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
ci-sonarqube:
needs: [ci-lint, ci-test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: ci-sonarqube
uses: smartcontractkit/.github/actions/ci-sonarqube@main
with:
# grafana inputs
metrics-job-name: ci-sonarqube
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}
# sonarqube inputs
sonar-token: ${{ secrets.SONAR_TOKEN }}
sonar-host-url: ${{ secrets.SONAR_HOST_URL }}