forked from xline-kv/Xline
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (81 loc) · 2.69 KB
/
build_xline.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
name: Build Xline
env:
CI_RUST_TOOLCHAIN: 1.74.0
on:
workflow_call:
inputs:
additional_setup_commands:
description: "Additional commands to run after initial setup, before running the script"
required: false
default: ""
type: string
docker_xline_image:
description: "Docker image to use for building"
required: true
type: string
binaries:
description: "Comma-separated list of binaries"
required: true
type: string
script_name:
description: "Name of the script to run"
required: true
type: string
uploadLogs:
description: "Boolean to decide if logs should be uploaded"
required: false
default: false
type: boolean
uploadBenchmark:
description: "Boolean to decide if benchmark output should be uploaded"
required: false
default: false
type: boolean
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Prepare release binaries
id: prepare_binaries
run: |
IFS=',' read -ra binary_array <<< "${{ inputs.binaries }}"
release_bin=""
for binary in "${binary_array[@]}"; do
release_bin+="--bin $binary "
done
release_bin="${release_bin::-1}"
echo "::set-output name=release_bin::$release_bin"
- name: Build xline
run: |
docker run -q --rm -v $(pwd):/xline \
-e SCCACHE_GHA_ENABLED=on \
-e ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL} \
-e ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN} \
${{ inputs.docker_xline_image }} \
cargo build --release ${{ steps.prepare_binaries.outputs.release_bin }}
- run: |
cd scripts
cp ../target/release/{${{ inputs.binaries }}} .
${{ inputs.additional_setup_commands }}
bash ./${{ inputs.script_name }}
- name: Upload logs
if: ${{ inputs.uploadLogs }} && (failure() || cancelled())
uses: actions/upload-artifact@v4
with:
name: Xline logs
path: scripts/logs
- name: Upload benchmark output
if: ${{ inputs.uploadBenchmark }}
uses: actions/upload-artifact@v4
with:
name: benchmark-output
path: scripts/out