-
Notifications
You must be signed in to change notification settings - Fork 751
103 lines (96 loc) · 3.19 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
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:
build:
if: contains(github.event.pull_request.labels.*.name, 'ci-cloud') || contains(github.event.pull_request.labels.*.name, 'ci-benchmark')
runs-on: [self-hosted, X64, Linux, 16c32g]
outputs:
sha: ${{ steps.sha.outputs.sha }}
steps:
- uses: actions/checkout@v3
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
- name: Build Release
uses: ./.github/actions/build_linux
timeout-minutes: 30
with:
sha: ${{ steps.sha.outputs.sha }}
target: x86_64-unknown-linux-gnu
artifacts: meta,query
docker:
needs: build
timeout-minutes: 10
runs-on: [self-hosted, X64, Linux, 4c8g]
outputs:
tag: ${{ steps.prepare.outputs.tag }}
steps:
- uses: actions/checkout@v3
- name: Download artifact
uses: ./.github/actions/artifact_download
with:
sha: ${{ needs.build.outputs.sha }}
target: x86_64-unknown-linux-gnu
artifacts: meta,query
- name: Prepare docker build
run: |
mkdir -p ./distro/linux/amd64
cp ./target/release/databend-* ./distro/linux/amd64
- 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: |
mkdir -p ./distro/linux/amd64
cp ./target/release/databend-query ./distro/linux/amd64/databend-query
short_sha=$(echo "${{ needs.build.outputs.sha }}" | cut -c1-7)
echo "tag=pr-${{ github.event.pull_request.number }}-${short_sha}" >> $GITHUB_OUTPUT
- name: push service image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.login.outputs.ecr_repo }}:${{ steps.prepare.outputs.tag }}
platforms: linux/amd64
context: .
file: ./docker/debian/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: contains(github.event.pull_request.labels.*.name, 'ci-benchmark')
needs: [build, docker]
uses: ./.github/workflows/reuse.benchmark.yml
secrets: inherit
with:
sha: ${{ needs.build.outputs.sha }}
run_id: ${{ github.run_id }}
source: pr
source_id: ${{ github.event.pull_request.number }}
version: ${{ needs.docker.outputs.tag }}