V8 Build #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --verbose --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 | |
deps/${{ matrix.os }}_${{ matrix.arch }}/obj/ | |
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 |