Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrome publish testing #694

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/publish-chrome.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Chrome

on:
workflow_dispatch:
inputs:
builder_ip:
description: "IP address of the builder"
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/builder.key
chmod 600 ~/.ssh/builder.key
cat >>~/.ssh/config <<END
Host builder
HostName $SSH_HOST
User root
IdentityFile ~/.ssh/builder.key
StrictHostKeyChecking no
END
env:
SSH_KEY: ${{ secrets.LINODE_SSH_KEY }}
SSH_HOST: ${{ inputs.builder_ip }}

- name: Create chrome user
run: ssh -t root@$SSH_HOST 'bash -s' < ./build/chrome/scripts/create-user.sh
env:
SSH_HOST: ${{ inputs.builder_ip }}

- name: Build chrome
run: ssh -t chrome@$SSH_HOST 'bash -s' < ./build/chrome/scripts/build.sh
env:
SSH_HOST: ${{ inputs.builder_ip }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./build/chrome/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: test
55 changes: 55 additions & 0 deletions build/chrome/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

sudo apt-get update
sudo apt-get install -y \
apt-utils \
build-essential \
curl \
git \
python3 \
sudo \
zip
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/home/chrome/depot_tools"
mkdir chromium
cd chromium || exit
fetch --nohooks --no-history chromium
echo 'solutions = [
{
"name": "src",
"url": "https://chromium.googlesource.com/chromium/src.git",
"managed": False,
"custom_deps": {},
"custom_vars": {
"checkout_pgo_profiles": True,
},
"target_cpu": "arm64",
},
]' | tee '.gclient' > /dev/null
cd src || exit
git fetch --tags
git checkout -b stable 124.0.6367.201
gclient sync --with_branch_heads --with_tags
./build/install-build-deps.sh
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
gclient runhooks
gn gen out/default --args='target_cpu="arm64" proprietary_codecs=true ffmpeg_branding="Chrome" enable_nacl=false is_debug=false symbol_level=0 v8_symbol_level=0 dcheck_always_on=false is_official_build=true'
autoninja -C out/default chrome chrome_sandbox
cd out/default || exit
mkdir "$GITHUB_WORKSPACE"/build/chrome/arm64
mv "$GITHUB_WORKSPACE"/build/chrome/arm64 \
chrome \
chrome-wrapper \
chrome_sandbox \
chrome_100_percent.pak \
chrome_200_percent.pak \
chrome_crashpad_handler \
headless_lib_data.pak \
headless_lib_strings.pak \
icudtl.dat \
locales/en-US.pak \
libEGL.so \
libGLESv2.so \
resources.pak \
snapshot_blob.bin \
v8_context_snapshot.bin
10 changes: 10 additions & 0 deletions build/chrome/scripts/create-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

useradd -m -d /home/chrome -s /bin/bash chrome
mkdir /home/chrome/.ssh
cp /root/.ssh/authorized_keys /home/chrome/.ssh/authorized_keys
chown -R chrome:chrome /home/chrome/.ssh
chmod 700 /home/chrome/.ssh
chmod 600 /home/chrome/.ssh/authorized_keys
adduser chrome sudo
sed -i '54i chrome ALL=(ALL:ALL) NOPASSWD: ALL' /etc/sudoers
Loading