forked from datafuselabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
126 lines (117 loc) · 4.45 KB
/
action.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
name: "Build Linux"
description: "Build with profile"
inputs:
sha:
description: "Git commit sha"
required: true
target:
description: ""
required: true
upload:
description: "Upload artifact"
required: false
default: "true"
artifacts:
description: "Artifacts to build"
required: false
default: "sqllogictests,meta,query"
features:
description: "Features to build"
required: false
default: "default"
category:
description: "Category to upload"
required: false
default: "default"
runs:
using: "composite"
steps:
- name: Setup Build Tool
uses: ./.github/actions/setup_build_tool
with:
target: ${{ inputs.target }}
bypass_env_vars: RUSTFLAGS,RUST_LOG
- name: Cross setup
if: startsWith(inputs.target, 'aarch64-')
shell: bash
run: |
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
- name: Set Build Flags
shell: bash
run: |
case ${{ inputs.target }} in
x86_64-unknown-linux-gnu)
flags="-C target-feature=+sse4.2"
;;
x86_64-unknown-linux-musl)
flags="-C target-feature=+sse4.2"
;;
aarch64-unknown-linux-gnu)
flags=""
;;
aarch64-unknown-linux-musl)
flags=""
;;
*)
flags=""
;;
esac
echo "RUSTFLAGS=${flags} -C link-arg=-Wl,--compress-debug-sections=zlib" >> $GITHUB_ENV
target=${{ inputs.target }}
echo "BUILD_ARCH=${target/-unknown-linux-*}" >> $GITHUB_ENV
# build all binaries for debug
- name: Build Debug
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts == 'all'
shell: bash
run: |
artifacts="meta,metactl,query,sqllogictests"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
done
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin open-sharing
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
- name: Build Debug for specific artifacts
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts != 'all'
shell: bash
run: |
artifacts="${{ inputs.artifacts }}"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
- name: Build Release
if: env.BUILD_PROFILE == 'release' && inputs.artifacts == 'all'
shell: bash
run: |
artifacts="meta,metactl,query,sqllogictests"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
- name: Build Release for specific artifacts
if: env.BUILD_PROFILE == 'release' && inputs.artifacts != 'all'
shell: bash
run: |
artifacts="${{ inputs.artifacts }}"
for artifact in ${artifacts//,/ }; do
echo "==> building databend-$artifact ..."
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
done
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
- shell: bash
run: readelf -p .comment ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query
# - name: Compress Binaries with UPX
# if: env.BUILD_PROFILE == 'debug'
# uses: crazy-max/ghaction-upx@v2
# with:
# files: ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
- name: Upload artifact
if: inputs.upload == 'true'
uses: ./.github/actions/artifact_upload
with:
sha: ${{ inputs.sha }}
target: ${{ inputs.target }}
category: ${{ inputs.category }}