-
Notifications
You must be signed in to change notification settings - Fork 859
179 lines (170 loc) · 5.9 KB
/
cloud.yml
File metadata and controls
179 lines (170 loc) · 5.9 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Cloud
on:
pull_request_target:
types:
- labeled
branches:
- main
- backport/*
permissions:
id-token: write
pull-requests: write
contents: read
packages: write
env:
BUILD_PROFILE: release
RUNNER_PROVIDER: aws
jobs:
info:
if: contains(github.event.pull_request.labels.*.name, 'ci-cloud') || contains(github.event.pull_request.labels.*.name, 'ci-benchmark') || contains(github.event.pull_request.labels.*.name, 'ci-benchmark-cloud') || contains(github.event.pull_request.labels.*.name, 'ci-benchmark-load') || contains(github.event.pull_request.labels.*.name, 'ci-benchmark-local')
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
target: ${{ steps.sha.outputs.target }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Get SHA
shell: bash
id: sha
run: |
echo "sha=$(git rev-parse --verify HEAD)" > $GITHUB_OUTPUT
if ${{ contains(github.event.pull_request.labels.*.name, 'ci-benchmark') }}; then
echo "target=all" >> $GITHUB_OUTPUT
elif ${{ contains(github.event.pull_request.labels.*.name, 'ci-benchmark-cloud') }}; then
echo "target=cloud" >> $GITHUB_OUTPUT
elif ${{ contains(github.event.pull_request.labels.*.name, 'ci-benchmark-load') }}; then
echo "target=load" >> $GITHUB_OUTPUT
elif ${{ contains(github.event.pull_request.labels.*.name, 'ci-benchmark-local') }}; then
echo "target=local" >> $GITHUB_OUTPUT
fi
build:
needs: info
runs-on:
- self-hosted
- "${{ matrix.runner }}"
- Linux
- 8c
- aws
strategy:
matrix:
include:
- { arch: x86_64, runner: X64, opt_level: s }
- { arch: aarch64, runner: ARM64, opt_level: 3 }
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Build Release
uses: ./.github/actions/build_linux
timeout-minutes: 120
env:
DATABEND_ENTERPRISE_LICENSE_PUBLIC_KEY: ${{ secrets.DATABEND_ENTERPRISE_LICENSE_PUBLIC_KEY }}
DATABEND_TELEMETRY_ENDPOINT: ${{ secrets.DATABEND_TELEMETRY_ENDPOINT}}
DATABEND_TELEMETRY_API_KEY: ${{ secrets.DATABEND_TELEMETRY_API_KEY}}
DATABEND_TELEMETRY_SOURCE: "pr-test"
CARGO_PROFILE_RELEASE_OPT_LEVEL: ${{ matrix.opt_level }}
with:
sha: ${{ needs.info.outputs.sha }}
target: ${{ matrix.arch }}-unknown-linux-gnu
artifacts: meta,query
category: docker
features: python-udf
trim_debug: false
docker:
needs: [ info, build ]
timeout-minutes: 10
runs-on:
- self-hosted
- ARM64
- Linux
- 2c
- aws
outputs:
tag: ${{ steps.prepare.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Download artifact for x86_64
uses: ./.github/actions/artifact_download
with:
sha: ${{ needs.info.outputs.sha }}
target: x86_64-unknown-linux-gnu
path: ./distro/linux/amd64/
category: docker
artifacts: query
- name: Download artifact for aarch64
uses: ./.github/actions/artifact_download
with:
sha: ${{ needs.info.outputs.sha }}
target: aarch64-unknown-linux-gnu
path: ./distro/linux/arm64/
category: docker
artifacts: query
- uses: ./.github/actions/setup_docker
id: login
with:
repo: databend-query
ecr_role_arn: ${{ secrets.ECR_ROLE_ARN }}
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare for docker
id: prepare
run: |
short_sha=$(echo "${{ needs.info.outputs.sha }}" | cut -c1-7)
ts=$(date +%s)
echo "tag=pr-${{ github.event.pull_request.number }}-${short_sha}-${ts}" >> $GITHUB_OUTPUT
- name: Get Image Tags
id: tags
uses: actions/github-script@v7
env:
REPO_DOCKERHUB: ${{ steps.login.outputs.dockerhub_repo }}
REPO_ECR: ${{ steps.login.outputs.ecr_repo }}
VERSION: ${{ steps.prepare.outputs.tag }}
with:
script: |
const { VERSION, REPO_DOCKERHUB, REPO_ECR } = process.env;
const repos = [REPO_DOCKERHUB, REPO_ECR];
let tags = [];
for (const repo of repos) {
tags.push(`${repo}:${VERSION}`);
}
core.setOutput('tags', tags.join(','));
- name: push service image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.tags.outputs.tags }}
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/service/query.Dockerfile
- name: Comment on PR
uses: everpcpc/comment-on-pr-action@v1
with:
number: ${{ github.event.pull_request.number }}
token: ${{ github.token }}
body: |
## Docker Image for PR
* **tag**: `${{ steps.prepare.outputs.tag }}`
> note: this image tag is only available for internal use.
explain:
needs: [info, build, docker]
uses: ./.github/workflows/reuse.explain.yml
secrets: inherit
with:
run_id: ${{ github.run_id }}
version: ${{ needs.docker.outputs.tag }}
benchmark:
if: needs.info.outputs.target
needs: [ info, build, docker ]
uses: ./.github/workflows/reuse.benchmark.yml
secrets: inherit
with:
sha: ${{ needs.info.outputs.sha }}
run_id: ${{ github.run_id }}
source: pr
source_id: ${{ github.event.pull_request.number }}
version: ${{ needs.docker.outputs.tag }}
target: ${{ needs.info.outputs.target }}