-
Notifications
You must be signed in to change notification settings - Fork 750
136 lines (128 loc) · 4.62 KB
/
cloud.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
name: Cloud
on:
pull_request_target:
types:
- labeled
branches:
- main
permissions:
id-token: write
pull-requests: write
contents: read
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, 16c32g, aws]
strategy:
matrix:
include:
- { arch: x86_64, runner: X64 }
- { arch: aarch64, runner: ARM64 }
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: 60
with:
sha: ${{ needs.info.outputs.sha }}
target: ${{ matrix.arch }}-unknown-linux-gnu
artifacts: meta,query
category: udf
features: python-udf
docker:
needs: [info, build]
timeout-minutes: 10
runs-on: [self-hosted, X64, Linux, 4c8g, 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: udf
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: udf
artifacts: query
- uses: ./.github/actions/setup_docker
id: login
with:
repo: databend-query
ecr_role_arn: ${{ secrets.ECR_ROLE_ARN }}
- 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: push service image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.login.outputs.ecr_repo }}:${{ steps.prepare.outputs.tag }}
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,
> please check the [internal doc](https://datafuselabs.feishu.cn/wiki/Hk7iwYsnWi3wsXkpbW5c9apTn0b) for more details.
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 }}
runner_provider: aws
target: ${{ needs.info.outputs.target }}