Skip to content

Support for Chrome 132 #662

Support for Chrome 132

Support for Chrome 132 #662

name: Build VisibleV8
on:
push:
branches:
- 'master'
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build_vv8:
runs-on: [self-hosted, vv8-builder]
timeout-minutes: 2880
# Lets give ourselves 2 day to build VisibleV8 (github by default gives 6 hrs which is not enough time to build Chrome three times unless we use Google magic)
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract short SHA
id: short_sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: actions/github-script@v7
id: get_release
with:
script: |
const release = await github.rest.repos.getLatestRelease({
owner: 'wspr-ncsu',
repo: 'visiblev8'
});
const tag = release.data.tag_name;
const currentGitCommit = '${{ steps.short_sha.outputs.sha_short }}'
const [_, commit, fullVersion, majorVersion] = tag.match(/visiblev8_([0-9a-f]+)-(([0-9]+)\.[0-9.]+)/);
const chromeReleaseVersion = (await (await fetch('https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Linux&num=1&offset=0')).json())[0]['version'];
const chromeMajorVersion = chromeReleaseVersion.split('.')[0];
console.log(`tag: ${tag}`);
console.log(`commit: ${commit}`);
console.log(`oldVersion: ${fullVersion}`);
console.log(`majorVersion: ${chromeMajorVersion}`);
console.log(`currentGitCommit: ${currentGitCommit}`);
console.log(`chromeReleaseVersion: ${chromeReleaseVersion}`);
core.setOutput('tag', tag);
core.setOutput('commit', commit);
core.setOutput('fullVersion', fullVersion);
core.setOutput('majorVersion', majorVersion);
core.setOutput('chromeReleaseVersion', chromeReleaseVersion);
core.setOutput('currentGitCommit', currentGitCommit);
core.setOutput('chromeMajorVersion', chromeMajorVersion);
- name: Diff our changes
id: diff
uses: actions/github-script@v7
env:
oldCommit: ${{ steps.get_release.outputs.commit }}
currentCommit: ${{ steps.get_release.outputs.currentGitCommit }}
with:
script: |
let output = '';
const options = {};
options.listeners = {
stdout: (data) => {
output += data.toString();
}
};
await exec.exec( 'git', [ '--no-pager', 'diff', process.env.oldCommit + '..' + process.env.currentCommit, 'patches', 'builder', '.github' ], options );
core.setOutput('diff', output[0] || 'empty');
# Hack: We send the first letter or the string 'empty' since Github runners hang if we send over the entire diff
- name: Should we publish ?
id: shouldPublish
uses: actions/github-script@v7
env:
GIT_DIFF: ${{ steps.diff.outputs.diff }}
with:
script: |
const shouldPublish = '${{ steps.get_release.outputs.chromeReleaseVersion }}' != '${{ steps.get_release.outputs.fullVersion }}' || ( '${{ steps.get_release.outputs.currentGitCommit }}' != '${{ steps.get_release.outputs.commit }}' && process.env.GIT_DIFF != 'empty' );
console.log(`shouldPublish: ${shouldPublish}`);
core.setOutput('shouldPublish', shouldPublish);
- name: Build VisibleV8
if: steps.shouldPublish.outputs.shouldPublish == 'true'
env:
VERSION: ${{ steps.get_release.outputs.chromeReleaseVersion }}
run: |
cd builder && make build VERSION=$VERSION DEBUG=0 PUBLISH_ASSETS=0 TESTS=1 ANDROID=1 ARM=1
- name: Get VV8 artifact name
if: steps.shouldPublish.outputs.shouldPublish == 'true'
id: artifact_name
run: |
PACKAGE_NAME_AMD64=`find ./builder/artifacts -name '*amd64.deb' -printf "%f\n" | sort -V | tail -n 1`
PACKAGE_NAME_ARM64=`find ./builder/artifacts -name '*arm64.deb' -printf "%f\n" | sort -V | tail -n 1`
echo "artifact_name_amd64=$PACKAGE_NAME_AMD64" >> $GITHUB_OUTPUT
echo "artifact_name_arm64=$PACKAGE_NAME_ARM64" >> $GITHUB_OUTPUT
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: visiblev8
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
if: steps.shouldPublish.outputs.shouldPublish == 'true'
uses: docker/metadata-action@v5
with:
images: visiblev8/vv8-base
tags: |
type=raw,value=latest,enable=true
type=raw,value=${{ steps.short_sha.outputs.sha_short }}_${{ steps.get_release.outputs.chromeReleaseVersion }},enable=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
if: steps.shouldPublish.outputs.shouldPublish == 'true'
with:
context: ./builder/
build-args: |
VERSION=${{ steps.get_release.outputs.chromeReleaseVersion }}
ARTIFACT_DIR=./artifacts
PACKAGE_NAME_AMD64=${{ steps.artifact_name.outputs.artifact_name_amd64 }}
PACKAGE_NAME_ARM64=${{ steps.artifact_name.outputs.artifact_name_arm64 }}
platforms: linux/amd64,linux/arm64
file: ./builder/vv82dockerhub.dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Prepare artifacts for upload
if: steps.shouldPublish.outputs.shouldPublish == 'true'
id: artifact
env:
VERSION: ${{ steps.get_release.outputs.chromeReleaseVersion }}
GIT_COMMIT: ${{ steps.short_sha.outputs.sha_short }}
run: |
ARTIFACT_FILE=../visiblev8_$GIT_COMMIT-$VERSION.tar.gz
ARTIFACT_NAME=visiblev8_$GIT_COMMIT-$VERSION.tar.gz
cd builder/artifacts && tar -czvf $ARTIFACT_FILE $VERSION/*.deb $VERSION/*.pickle $VERSION/*.json $VERSION/*.apk
echo "artifact_file=$ARTIFACT_FILE" >> $GITHUB_OUTPUT
echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
- name: Create a release
if: steps.shouldPublish.outputs.shouldPublish == 'true'
id: create_release
uses: actions/github-script@v7
with:
script: |
const name = 'visiblev8_${{ steps.get_release.outputs.currentGitCommit }}-${{ steps.get_release.outputs.chromeReleaseVersion }}';
const release = await github.rest.repos.createRelease({
owner: 'wspr-ncsu',
repo: 'visiblev8',
tag_name: name,
name: name,
body: 'This is the release for VisibleV8 commit ${{ steps.get_release.outputs.currentGitCommit }} based on Chromium ${{ steps.get_release.outputs.chromeReleaseVersion }} (major version ${{ steps.get_release.outputs.chromeMajorVersion }}).',
draft: false,
prerelease: false
});
console.log(release);
core.setOutput('releaseUploadURL', release.data.upload_url);
core.setOutput('release_id', release.data.id);
- name: Upload artifacts
if: steps.shouldPublish.outputs.shouldPublish == 'true'
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/gzip" \
--data-binary @./builder/artifacts/${{ steps.artifact.outputs.artifact_file }} \
"${{ steps.create_release.outputs.releaseUploadURL }}=${{ steps.artifact.outputs.artifact_name }}&label=${{ steps.artifact.outputs.artifact_name }}"
rm -rf ./builder/artifacts/${{ steps.artifact.outputs.artifact_name }}
- name: Notify slack that the build succeeded
if: steps.shouldPublish.outputs.shouldPublish == 'true' && success()
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"VisibleV8 build '${{ steps.get_release.outputs.currentGitCommit }}' for Chromium version '${{ steps.get_release.outputs.chromeReleaseVersion }}' has been successful!"}' ${{ secrets.SLACK_WEBHOOK }}
- name: Cleaning up docker environment
if: steps.shouldPublish.outputs.shouldPublish == 'true' && ( success() || failure() )
run: |
docker system prune -f
- name: Cleaning built data
if: steps.shouldPublish.outputs.shouldPublish == 'true' && ( success() || failure() )
run: |
rm -rf ./builder/visiblev8_*-*.tar.gz
- name: Clean up everything
if: steps.shouldPublish.outputs.shouldPublish == 'true' && always()
uses: docker://ubuntu:latest
with:
entrypoint: /usr/bin/rm
args: -rf ./builder/artifacts ./builder/build