From 08a5fff4ca5b9125a46236b907020708165b7dad Mon Sep 17 00:00:00 2001 From: David Colburn Date: Thu, 6 Jun 2024 15:47:20 -0700 Subject: [PATCH 1/2] testing --- .github/workflows/publish-chrome.yaml | 69 +++++++++++++++++++++++++++ build/chrome/scripts/build.sh | 51 ++++++++++++++++++++ build/chrome/scripts/create-user.sh | 10 ++++ build/chrome/scripts/version.sh | 10 ++++ 4 files changed, 140 insertions(+) create mode 100644 .github/workflows/publish-chrome.yaml create mode 100644 build/chrome/scripts/build.sh create mode 100644 build/chrome/scripts/create-user.sh create mode 100644 build/chrome/scripts/version.sh diff --git a/.github/workflows/publish-chrome.yaml b/.github/workflows/publish-chrome.yaml new file mode 100644 index 00000000..a108c37c --- /dev/null +++ b/.github/workflows/publish-chrome.yaml @@ -0,0 +1,69 @@ +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 <> $GITHUB_OUTPUT + env: + SSH_HOST: ${{ inputs.builder_ip }} + + - name: Check + run: echo ${{ steps.get_version.outputs.chrome_version }} + +# - 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: ${{ steps.get_version.outputs.CHROME_VERSION }} diff --git a/build/chrome/scripts/build.sh b/build/chrome/scripts/build.sh new file mode 100644 index 00000000..e6a92afe --- /dev/null +++ b/build/chrome/scripts/build.sh @@ -0,0 +1,51 @@ +#!/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 +./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 +zip arm64.zip \ + 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 diff --git a/build/chrome/scripts/create-user.sh b/build/chrome/scripts/create-user.sh new file mode 100644 index 00000000..ffa7b5ab --- /dev/null +++ b/build/chrome/scripts/create-user.sh @@ -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 diff --git a/build/chrome/scripts/version.sh b/build/chrome/scripts/version.sh new file mode 100644 index 00000000..024019d9 --- /dev/null +++ b/build/chrome/scripts/version.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +version_full=$(tr '\n' ' ' < /home/chrome/chromium/src/chrome/VERSION) +version_delim="${version_full// /=}" + +IFS='=' +split=($version_delim) +unset IFS + +echo "${split[1]}.${split[3]}.${split[5]}.${split[7]}" From 89c54d0ec63b10fbc88d5019d176d83f723fbb41 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Thu, 6 Jun 2024 16:21:15 -0700 Subject: [PATCH 2/2] testing --- .github/workflows/publish-chrome.yaml | 53 +++++++++++---------------- build/chrome/scripts/build.sh | 6 ++- build/chrome/scripts/version.sh | 10 ----- 3 files changed, 27 insertions(+), 42 deletions(-) delete mode 100644 build/chrome/scripts/version.sh diff --git a/.github/workflows/publish-chrome.yaml b/.github/workflows/publish-chrome.yaml index a108c37c..c9857ca3 100644 --- a/.github/workflows/publish-chrome.yaml +++ b/.github/workflows/publish-chrome.yaml @@ -31,39 +31,30 @@ jobs: 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: Create chrome user + run: ssh -t root@$SSH_HOST 'bash -s' < ./build/chrome/scripts/create-user.sh + env: + SSH_HOST: ${{ inputs.builder_ip }} - - name: Get version - id: get_version - run: echo "chrome_version=$(ssh -t chrome@$SSH_HOST 'bash -s' < ./build/chrome/scripts/version.sh)\n" >> $GITHUB_OUTPUT + - name: Build chrome + run: ssh -t chrome@$SSH_HOST 'bash -s' < ./build/chrome/scripts/build.sh env: SSH_HOST: ${{ inputs.builder_ip }} - - name: Check - run: echo ${{ steps.get_version.outputs.chrome_version }} + - 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: 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: ${{ steps.get_version.outputs.CHROME_VERSION }} + - 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 diff --git a/build/chrome/scripts/build.sh b/build/chrome/scripts/build.sh index e6a92afe..89ad8173 100644 --- a/build/chrome/scripts/build.sh +++ b/build/chrome/scripts/build.sh @@ -27,13 +27,17 @@ echo 'solutions = [ }, ]' | 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 -zip arm64.zip \ +mkdir "$GITHUB_WORKSPACE"/build/chrome/arm64 +mv "$GITHUB_WORKSPACE"/build/chrome/arm64 \ chrome \ chrome-wrapper \ chrome_sandbox \ diff --git a/build/chrome/scripts/version.sh b/build/chrome/scripts/version.sh deleted file mode 100644 index 024019d9..00000000 --- a/build/chrome/scripts/version.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -version_full=$(tr '\n' ' ' < /home/chrome/chromium/src/chrome/VERSION) -version_delim="${version_full// /=}" - -IFS='=' -split=($version_delim) -unset IFS - -echo "${split[1]}.${split[3]}.${split[5]}.${split[7]}"