/
action.yml
73 lines (67 loc) · 1.8 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
name: Single Docker build
description: Docker build for a single target
inputs:
target:
required: true
type: string
image:
required: true
type: string
profile:
default: "release"
required: false
type: string
options:
description: "Options for docker"
default: ""
required: false
type: string
pre:
required: false
default: ""
type: string
post:
required: false
default: ""
type: string
runs:
using: composite
steps:
- name: Docker Build ${{ inputs.target }}
shell: bash
run: |
code='
set -e
if [ -x "$(command -v sccache)" ]; then
export RUSTC_WRAPPER=sccache
echo "enable sccache"
fi
${{ inputs.pre }}
rustup target add ${{ inputs.target }}
# corepack > 0.24.1 will use native fetch
# and native fetch not support HTTP_PROXY
# https://github.com/nodejs/undici/issues/1650
npm install -g corepack@0.24.1
corepack enable
RUST_TARGET=${{ inputs.target }} pnpm build:binding:${{ inputs.profile }}
${{ inputs.post }}
'
if [[ ! -n "$CARGO_HOME" ]]; then
CARGO_HOME="$(dirname $(dirname $(which cargo)))"
fi
docker run \
--rm \
--privileged \
--user 0:0 \
-v $CARGO_HOME/registry/index:/usr/local/cargo/registry/index \
-v $CARGO_HOME/registry/cache:/usr/local/cargo/registry/cache \
-v $CARGO_HOME/git/db:/usr/local/cargo/git/db \
${{ inputs.options }} \
-e CI=1 \
-e HOME=$HOME \
-v $HOME/.cache:$HOME/.cache \
-v ${{ github.workspace }}:/build \
-w /build \
-i \
${{ inputs.image }} \
bash -c "$code"