forked from web-infra-dev/rspack
/
action.yml
61 lines (57 loc) · 1.29 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
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 enable
RUST_TARGET=${{ inputs.target }} pnpm build:binding:${{ inputs.profile }}
${{ inputs.post }}
'
docker run \
--rm \
--privileged \
--user 0:0 \
${{ 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"