forked from datafuselabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
111 lines (100 loc) 路 3.19 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
name: "Setup Build Tool Binaries"
description: "Setup Build Tool Binaries"
inputs:
target:
description: "Build target to use"
required: true
default: dev
bypass_env_vars:
description: "Environment variables bypass to docker container"
required: false
default: RUSTFLAGS,RUST_LOG
runs:
using: "composite"
steps:
- name: clean the existing toolchain
shell: bash
run: |
rm -rf $HOME/.cargo
rm -rf $HOME/.rustup
- name: setup build-tool binary
shell: bash
run: |
BIN_LOCAL=$HOME/.cargo/bin
mkdir -p $BIN_LOCAL
echo "$BIN_LOCAL" >> $GITHUB_PATH
cat <<EOF >$BIN_LOCAL/build-tool
#!/bin/bash
script_name=\$(basename "\$0")
export INTERACTIVE=false
export TARGET=${{ inputs.target }}
export CARGO_INCREMENTAL=0
export CARGO_TERM_COLOR=always
export BYPASS_ENV_VARS=${{ inputs.bypass_env_vars }},CARGO_INCREMENTAL,CARGO_TERM_COLOR,BUILD_PROFILE,JEMALLOC_SYS_WITH_LG_PAGE
EOF
RUNNER_PROVIDER="${RUNNER_PROVIDER:-github}"
case ${RUNNER_PROVIDER} in
aws)
echo "setting up sccache for AWS S3..."
cat <<EOF >>$BIN_LOCAL/build-tool
export ENABLE_SCCACHE=true
export SCCACHE_BUCKET=databend-ci
export SCCACHE_REGION=us-east-2
export SCCACHE_S3_KEY_PREFIX="cache/sccache/"
export SCCACHE_S3_USE_SSL="true"
EOF
;;
gcp)
echo "setting up sccache for Google Cloud Storage..."
cat <<EOF >>$BIN_LOCAL/build-tool
export ENABLE_SCCACHE=true
export SCCACHE_GCS_RW_MODE=READ_WRITE
export SCCACHE_GCS_BUCKET=databend-ci
export SCCACHE_GCS_KEY_PREFIX="cache/sccache/"
EOF
;;
github)
echo "sccache disabled on GitHub-hosted Runner"
;;
*)
echo "unknown runner provider"
exit 1
;;
esac
cat <<EOF >>$BIN_LOCAL/build-tool
if [[ \${script_name} == "build-tool" ]]; then
scripts/setup/run_build_tool.sh \$@
else
scripts/setup/run_build_tool.sh \${script_name} \$@
fi
EOF
chmod +x $BIN_LOCAL/build-tool
ln -s build-tool $BIN_LOCAL/rustc
ln -s build-tool $BIN_LOCAL/cargo
ln -s build-tool $BIN_LOCAL/rustup
ln -s build-tool $BIN_LOCAL/make
ln -s build-tool $BIN_LOCAL/readelf
ln -s build-tool $BIN_LOCAL/taplo
ln -s build-tool $BIN_LOCAL/typos
- name: check cargo version
shell: bash
run: rustup show
- name: check disk space
shell: bash
run: df -h
# - uses: everpcpc/actions-cache@v1
# if: env.RUNNER_PROVIDER == 'aws'
# env:
# AWS_REGION: us-east-2
# with:
# bucket: "databend-ci"
# root: "cache/cargo"
# path: |
# ~/.cargo/registry/cache
# ~/.cargo/registry/index
# ~/.cargo/git/db
# key: |
# ${{ runner.os }}/${{ inputs.target }}/${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.os }}/${{ inputs.target }}/
# ${{ runner.os }}/