-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (93 loc) · 4.13 KB
/
build.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
name: Build
on:
push:
tags: ['**']
jobs:
build:
name: ${{ matrix.config.target }}
runs-on: ubuntu-22.04
timeout-minutes: 180
strategy:
matrix:
config:
- target: x86_64-unknown-linux-gnu
variant: release
- target: aarch64-linux-android
variant: release
env:
V8_FROM_SOURCE: 1
CARGO_VARIANT_FLAG: ${{ matrix.config.variant == 'release' && '--release' || '' }}
LIB_NAME: librusty_v8
LIB_EXT: a
RUSTFLAGS: -D warnings
steps:
- name: Checkout to rusty_v8_builder
uses: actions/checkout@v4
- name: Get version
id: get_version
run: |
version=$(cat ./README.md | grep -oP 'v\d+\.\d+\.\d+')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Checkout to rusty_v8
uses: actions/checkout@v4
with:
repository: denoland/rusty_v8
ref: f87e7964bddec089f7fcac7fc7a9b3dcd5669df9
fetch-depth: 10
submodules: recursive
- name: Install rust
uses: dsherret/rust-toolchain-file@v1
- name: Install python
uses: actions/setup-python@v4
with:
python-version: 3.11.x
architecture: x64
- name: Install cross compilation toolchain
if: matrix.config.target == 'aarch64-linux-android'
run: |
rustup target add aarch64-linux-android
- name: Write git_submodule_status.txt
run: git submodule status --recursive > git_submodule_status.txt
- name: Cache
uses: actions/cache@v3
with:
path: |-
target/sccache
target/*/.*
target/*/build
target/*/deps
key: cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }}
restore-keys: cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-
- name: Sccache
shell: pwsh
env:
SCCACHE_DIR: ${{ github.workspace }}/target/sccache
SCCACHE_CACHE_SIZE: 128M
SCCACHE_IDLE_TIMEOUT: 0
run: |
$version = "0.2.12"
$platform =
@{ "macOS" = "x86_64-apple-darwin"
"Linux" = "x86_64-unknown-linux-musl"
"Windows" = "x86_64-pc-windows-msvc"
}.${{ runner.os }}
$basename = "sccache-$version-$platform"
$url = "https://github.com/mozilla/sccache/releases/download/" +
"$version/$basename.tar.gz"
cd ~
curl -LO $url
tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server
echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build
run: cargo build -vv --locked ${{ env.CARGO_VARIANT_FLAG }} --target ${{ matrix.config.target }}
- name: Prepare Release
run: gzip -9c
target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }} >
target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz &&
ls -l target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz