forked from rogchap/v8go
-
-
Notifications
You must be signed in to change notification settings - Fork 6
173 lines (148 loc) · 6.5 KB
/
v8build.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: V8 Build
on: workflow_dispatch
jobs:
build_common:
name: Build Architecture Independent Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
- name: Update to latest V8
run: |
latest_v8_hash="$(<deps/latest_v8_hash)"
cd deps/v8
git fetch origin "$latest_v8_hash"
latest_v8_version="$(git tag --points-at "$latest_v8_hash" | head -n1)"
git checkout "${latest_v8_version:-$latest_v8_hash}"
- name: Create include files
run: cd deps && ./build_common.py
- name: Upload include/ Artifacts
uses: actions/upload-artifact@v4
with:
# The name matches the directory under deps/.
name: include
if-no-files-found: error
path: deps/include/
retention-days: 2
build:
name: Build V8 for ${{ matrix.os }} ${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
os: [android, darwin, linux]
arch: [x86_64, arm64]
include:
- os: android
platform: ubuntu-latest
- os: linux
platform: ubuntu-latest
- os: darwin
platform: macos-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Restore CCache
uses: actions/cache@v3
with:
path: ~/.ccache
key: libv8:ccache:${{ matrix.os }}:${{ matrix.arch }}:${{ hashFiles('deps/v8_hash') }}:${{ runner.os }}
restore-keys: |
libv8:ccache:${{ matrix.os }}:${{ matrix.arch }}:
${{ runner.os }}:${{ matrix.os }}:${{ matrix.arch }}:libv8:ccache
- name: Install CCache
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -yq ccache
sudo update-ccache-symlinks
echo "/usr/lib/ccache" >> "$GITHUB_PATH"
- name: Install CCache
if: matrix.platform == 'macos-latest'
run: |
brew install ccache
echo "$(brew --prefix ccache)/libexec" >> "$GITHUB_PATH"
- name: Configure CCache
run: |
ccacheDir="$HOME/.ccache"
mkdir -p "$ccacheDir"
echo "CCACHE_DIR=$ccacheDir" >> "$GITHUB_ENV"
echo "CCACHE_CPP2=yes" >> "$GITHUB_ENV"
echo "CCACHE_SLOPPINESS=time_macros" >> "$GITHUB_ENV"
- name: Install g++-aarch64-linux-gnu
if: matrix.os == 'linux' && matrix.arch == 'arm64'
run: sudo apt update && sudo apt install g++-aarch64-linux-gnu -y
- name: Install setuptools
if: matrix.platform == 'macos-latest'
run: python3 -m ensurepip --default-pip && python3 -m pip install --upgrade setuptools
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
- name: Update to latest V8
run: |
latest_v8_hash="$(<deps/latest_v8_hash)"
cd deps/v8
git fetch origin "$latest_v8_hash"
latest_v8_version="$(git tag --points-at "$latest_v8_hash" | head -n1)"
git checkout "${latest_v8_version:-$latest_v8_hash}"
- name: Restore V8 Build Cache
uses: actions/cache@v3
with:
path: deps/v8/build
key: libv8:v8build:${{ matrix.os }}:${{ matrix.arch }}:${{ hashFiles('deps/v8_hash') }}:${{ runner.os }}
restore-keys: |
libv8:v8build:${{ matrix.os }}:${{ matrix.arch }}:
- name: Update depot_tools fetch config
run: cd deps/depot_tools && git config --unset-all remote.origin.fetch; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- name: Build V8 (${{ matrix.os }})
run: cd deps && ./build.py --ccache --arch ${{ matrix.arch }} --os ${{ matrix.os }}
- name: Show CCache Status
run: ccache -s
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
# The name matches the directory under deps/.
name: ${{ matrix.os }}_${{ matrix.arch }}
if-no-files-found: error
path: deps/${{ matrix.os }}_${{ matrix.arch }}/libv8.a
retention-days: 2
commit:
name: Commit Built Artifacts
needs: [build, build_common]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: deps
- id: update_v8
name: Update to latest V8
run: |
latest_v8_hash="$(<deps/latest_v8_hash)"
echo "$latest_v8_hash" >deps/v8_hash
cd deps/v8
git fetch origin "$latest_v8_hash"
latest_v8_version="$(git tag --points-at "$latest_v8_hash" | head -n1)"
git checkout "${latest_v8_version:-$latest_v8_hash}"
echo "latest_v8_version=${latest_v8_version:-$latest_v8_hash}" >>"$GITHUB_OUTPUT"
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
commit-message: Add built V8 libraries at ${{ steps.update_v8.outputs.latest_v8_version }}
title: Add built V8 libraries at ${{ steps.update_v8.outputs.latest_v8_version }}
body: Auto-generated pull request of built V8 libraries
add-paths: |
deps/*_*/libv8.a
deps/include/
deps/v8
deps/v8_hash
branch: workflow/v8build
delete-branch: true