bromite-buildtools/.github/workflows/build_bromite_dev.yaml

344 lines
15 KiB
YAML
Raw Permalink Normal View History

name: Build Bromite
2021-07-11 16:25:43 +05:30
permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
on:
workflow_dispatch:
2021-07-31 18:55:15 +05:30
inputs:
sha:
description: 'uazo/bromite SHA'
required: true
2022-10-17 12:25:53 +05:30
default: ''
target_os:
description: 'targetos [android/win/all]'
required: true
default: 'all'
build:
2023-04-20 16:50:36 +05:30
description: 'android arch [arm64/x64/all]'
required: true
2023-04-20 16:50:36 +05:30
default: 'all'
type:
2022-01-17 15:22:22 +05:30
description: 'runner? [dev/ci]'
required: true
2023-04-20 16:50:36 +05:30
default: 'ci'
debug:
2022-01-17 15:22:22 +05:30
description: 'debug? [true/false]'
required: true
2023-04-20 16:50:36 +05:30
default: 'false'
2022-10-17 12:25:53 +05:30
clangd:
description: 'clangd? [true/false]'
2021-09-15 15:47:07 +05:30
required: true
default: 'false'
2021-07-31 18:55:15 +05:30
2021-07-11 18:42:14 +05:30
env:
2021-07-31 18:55:15 +05:30
BROMITE_SHA: ${{ github.event.inputs.sha }}
2021-07-28 01:32:57 +05:30
REMOVEDOCKERSUPPORT: true
2021-07-30 13:00:54 +05:30
USELOCALIMAGE: true
2021-07-11 18:42:14 +05:30
2021-07-11 16:25:43 +05:30
jobs:
check_images:
runs-on: ${{ github.event.inputs.type }}
2021-07-11 16:25:43 +05:30
steps:
2021-07-11 18:46:50 +05:30
- name: Checkout repo
uses: actions/checkout@v2
with:
2021-07-11 18:51:44 +05:30
path: bromite-buildtools
2021-07-11 18:46:50 +05:30
fetch-depth: 1
2021-07-29 18:37:10 +05:30
2021-07-31 14:19:09 +05:30
- name: Enable proxy on container
2021-07-29 18:37:10 +05:30
shell: bash
run: |
if ! [[ -z "${HTTP_PROXY}" ]]; then
2021-09-23 12:52:15 +05:30
PROXY_ADDR=http://$(hostname -I | cut -d' ' -f1 | xargs):8118
2021-07-29 21:27:57 +05:30
echo "PROXY_ADDR=$PROXY_ADDR" >> $GITHUB_ENV
2021-07-31 14:19:09 +05:30
sudo iptables -D INPUT -p tcp -s localhost --dport 8118 -j ACCEPT
sudo iptables -D INPUT -p tcp --dport 8118 -j DROP
2021-07-29 18:37:10 +05:30
fi
2021-07-11 16:25:43 +05:30
- name: Get current chromium version
shell: bash
run: |
mkdir bromite
cd bromite
2021-07-11 17:26:27 +05:30
git init
2021-07-11 17:30:02 +05:30
git remote add origin https://github.com/uazo/bromite
2021-07-11 18:42:14 +05:30
git fetch origin $BROMITE_SHA
2021-07-11 17:30:02 +05:30
git reset --hard FETCH_HEAD
2021-07-11 16:25:43 +05:30
cd ..
export VERSION=$( cat ./bromite/build/RELEASE )
2021-07-11 18:42:14 +05:30
rm -rf bromite
2021-07-11 16:25:43 +05:30
echo Current version is $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
2021-07-11 18:49:19 +05:30
cd bromite-buildtools
2022-02-04 02:14:09 +05:30
- name: Building build-deps container ${{ env.VERSION }}
2021-07-11 18:42:14 +05:30
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/build-deps:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/build-deps:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
2021-07-11 18:54:44 +05:30
DOCKER_BUILDKIT=1 docker build -t uazo/build-deps:$VERSION \
--progress plain \
--build-arg VERSION=$VERSION \
2021-07-29 18:37:10 +05:30
--build-arg HTTP_PROXY="$PROXY_ADDR" \
2021-07-12 12:51:47 +05:30
--no-cache \
2021-07-11 18:54:44 +05:30
bromite-buildtools/images/build-deps/.
2021-07-11 18:42:14 +05:30
fi
fi
2021-07-11 16:25:43 +05:30
2022-02-04 02:14:09 +05:30
- name: Building chromium container ${{ env.VERSION }}
2021-07-11 18:42:14 +05:30
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/chromium:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/chromium:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
2021-07-11 18:54:44 +05:30
DOCKER_BUILDKIT=1 docker build -t uazo/chromium:$VERSION \
--progress plain \
--build-arg VERSION=$VERSION \
2021-07-29 18:37:10 +05:30
--build-arg HTTP_PROXY="$PROXY_ADDR" \
2021-07-11 18:54:44 +05:30
bromite-buildtools/images/chr-source/.
2021-07-11 18:42:14 +05:30
fi
fi
2021-07-11 16:25:43 +05:30
2023-03-08 14:21:49 +05:30
- name: Building bromite container ${{ env.VERSION }}-${{ env.BROMITE_SHA }}
2021-07-11 18:42:14 +05:30
shell: bash
run: |
2023-03-08 14:21:49 +05:30
IS_PRESENT=$(docker inspect --type=image uazo/bromite:$VERSION-$BROMITE_SHA > /dev/null ; echo $?)
2021-07-11 18:42:14 +05:30
if [ $IS_PRESENT -ne "0" ]; then
2023-03-08 14:21:49 +05:30
IS_PRESENT=$(docker manifest inspect uazo/bromite:$VERSION-$BROMITE_SHA > /dev/null ; echo $?)
2021-07-11 18:42:14 +05:30
if [ $IS_PRESENT -ne "0" ]; then
2023-03-08 14:21:49 +05:30
DOCKER_BUILDKIT=1 docker build -t uazo/bromite:$VERSION-$BROMITE_SHA --progress plain \
2021-07-11 18:42:14 +05:30
--build-arg BROMITE_SHA=$BROMITE_SHA \
--build-arg VERSION=$VERSION \
2021-07-29 18:37:10 +05:30
--build-arg HTTP_PROXY="$PROXY_ADDR" \
2021-07-11 18:42:14 +05:30
bromite-buildtools/images/bromite-source/.
fi
fi
2023-03-08 14:21:49 +05:30
- name: Building bromite-build container ${{ env.VERSION }}-${{ env.BROMITE_SHA }}
2021-07-11 18:42:14 +05:30
shell: bash
run: |
2023-03-08 14:21:49 +05:30
IS_PRESENT=$(docker inspect --type=image uazo/bromite-build:$VERSION-$BROMITE_SHA > /dev/null ; echo $?)
2021-07-11 18:42:14 +05:30
if [ $IS_PRESENT -ne "0" ]; then
2023-03-08 14:21:49 +05:30
IS_PRESENT=$(docker manifest inspect uazo/bromite-build:$VERSION-$BROMITE_SHA > /dev/null ; echo $?)
2021-07-11 18:42:14 +05:30
if [ $IS_PRESENT -ne "0" ]; then
2023-03-08 14:21:49 +05:30
DOCKER_BUILDKIT=1 docker build -t uazo/bromite-build:$VERSION-$BROMITE_SHA --progress plain \
2021-07-11 18:42:14 +05:30
--build-arg BROMITE_SHA=$BROMITE_SHA \
2023-03-08 14:21:49 +05:30
--build-arg VERSION=$VERSION \
2021-07-29 18:37:10 +05:30
--build-arg HTTP_PROXY="$PROXY_ADDR" \
2021-07-13 00:13:47 +05:30
--no-cache \
2021-07-11 18:42:14 +05:30
bromite-buildtools/images/bromite-build/.
fi
fi
2021-07-31 14:41:13 +05:30
- name: Mark image to build
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/bromite-build:build > /dev/null ; echo $?)
2021-07-31 14:44:16 +05:30
if [ $IS_PRESENT -eq "0" ]; then
2021-07-31 14:41:13 +05:30
docker rmi uazo/bromite-build:build
fi
2023-03-08 14:21:49 +05:30
docker tag uazo/bromite-build:$VERSION-$BROMITE_SHA uazo/bromite-build:build
2021-07-11 16:25:43 +05:30
build:
runs-on: ${{ github.event.inputs.type }}
2021-07-11 16:25:43 +05:30
needs: check_images
if: success()
2021-08-09 18:03:59 +05:30
timeout-minutes: 720
2021-07-30 13:08:27 +05:30
2021-07-11 16:25:43 +05:30
container:
2021-07-31 14:41:13 +05:30
image: uazo/bromite-build:build
2021-07-11 16:25:43 +05:30
env:
2021-07-31 12:45:55 +05:30
REMOVEDOCKERSUPPORT: true # CUSTOM RUNNER: remove sharing of docker socket
USELOCALIMAGE: true # CUSTOM RUNNER: permit use of local images
USEINTERNALNETWORK: true # CUSTOM RUNNER: create the docker network as internal
2021-08-04 13:44:46 +05:30
WORKSPACE: /home/lg/working_dir
2022-10-13 20:14:02 +05:30
# kythe
2021-12-01 13:51:16 +05:30
KYTHE_CORPUS: chromium.googlesource.com/chromium/src
KYTHE_ROOT_DIRECTORY: /home/lg/working_dir/chromium/src
KYTHE_OUTPUT_DIRECTORY: /home/lg/working_dir/chromium/src/out/bromite/kythe
2022-10-13 20:14:02 +05:30
# cross build
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: /win_sdk/10.0.22621.0/
WINDOWSSDKDIR: "/win_sdk/10.0.22621.0/Windows Kits/10/"
GYP_MSVS_OVERRIDE_PATH: /win_sdk/10.0.22621.0/
2021-09-16 20:30:49 +05:30
# compile in debug mode
2022-01-17 22:37:46 +05:30
TARGET_ISDEBUG: ${{ github.event.inputs.debug }}
2022-10-17 12:25:53 +05:30
TARGET_OS: ${{ github.event.inputs.target_os }}
2021-07-11 16:25:43 +05:30
volumes:
2023-04-20 16:50:36 +05:30
- /storage/images/android/arm64/${{ github.event.inputs.build }}/${{ github.event.inputs.sha }}:/home/lg/working_dir/chromium/src/out/bromite
- /storage/images/android/x64/${{ github.event.inputs.build }}/${{ github.event.inputs.sha }}:/home/lg/working_dir/chromium/src/out/bromite_x64
2022-10-17 12:25:53 +05:30
- /storage/images/win/x64/${{ github.event.inputs.sha }}:/home/lg/working_dir/chromium/src/out/bromite_win
2021-08-04 13:25:01 +05:30
- /tmp/proxy:/tmp/proxy
2022-10-05 18:56:27 +05:30
- /win_sdk:/win_sdk
2021-08-04 13:25:01 +05:30
2021-07-30 13:23:16 +05:30
steps:
- name: Prepare Build Container
2021-07-11 16:25:43 +05:30
shell: bash
run: |
# set workspace paths
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
2021-07-30 15:18:20 +05:30
cd $WORKSPACE
2021-08-04 18:42:57 +05:30
# reset proxy env
HTTP_PROXY=
HTTPS_PROXY=
http_proxy=
https_proxy=
2021-07-31 18:43:23 +05:30
2021-12-05 00:41:49 +05:30
# set out folder permissions
test -d chromium/src/out/bromite || sudo mkdir -p chromium/src/out/bromite && \
sudo chown lg chromium/src/out &&
2022-10-17 12:25:53 +05:30
sudo chown lg chromium/src/out/bromite
test -d chromium/src/out/bromite_win || sudo mkdir -p chromium/src/out/bromite_win && \
sudo chown lg chromium/src/out &&
sudo chown lg chromium/src/out/bromite_win
2021-12-05 00:41:49 +05:30
2021-12-01 13:51:16 +05:30
# make kythe output directory
2021-12-05 00:41:49 +05:30
test -d $KYTHE_OUTPUT_DIRECTORY || mkdir -p $KYTHE_OUTPUT_DIRECTORY
2021-11-30 20:02:54 +05:30
2021-09-15 20:45:08 +05:30
sudo mkdir -p /run/user/1000/
sudo chown lg /run/user/1000/
sudo chmod g-rxw /run/user/1000/
sudo chmod o-rxw /run/user/1000/
2021-07-30 15:18:20 +05:30
2023-04-20 16:50:36 +05:30
- name: Build Bromite Android arm64
2023-04-20 17:06:05 +05:30
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm64' || github.event.inputs.build == 'all') }}
2022-10-17 12:25:53 +05:30
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
2021-07-31 18:43:23 +05:30
2022-10-17 12:25:53 +05:30
echo "::group::-------- gn gen"
2023-04-20 16:50:36 +05:30
gn gen --args="import(\"/home/lg/working_dir/bromite/build/bromite.gn_args\") $(cat ../../build_args.gni) target_cpu = \"arm64\" " out/bromite
2022-10-17 12:25:53 +05:30
echo "::endgroup::"
2021-07-31 18:43:23 +05:30
2022-10-17 12:25:53 +05:30
echo "::group::-------- gn args"
gn args out/bromite/ --list --short
gn args out/bromite/ --list >out/bromite/gn_list
echo "::endgroup::"
2021-07-31 18:43:23 +05:30
2022-10-17 12:25:53 +05:30
autoninja -C out/bromite chrome_public_apk
2021-07-31 18:43:23 +05:30
2022-01-17 21:26:10 +05:30
cp ../../bromite/build/RELEASE out/bromite
2021-07-31 18:43:23 +05:30
2023-04-20 16:50:36 +05:30
- name: Get ninja logs Android arm64
2023-04-20 17:06:05 +05:30
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm64' || github.event.inputs.build == 'all') }}
2022-10-17 12:25:53 +05:30
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing $WORKSPACE/chromium/src/out/bromite/.ninja_log >$WORKSPACE/chromium/src/out/bromite/ninja_log_trace.json
2023-04-04 11:59:19 +05:30
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/bromite/ninja_log_trace.json
2023-04-20 16:50:36 +05:30
2022-10-17 12:25:53 +05:30
- name: Build Bromite Windows
if: ${{ github.event.inputs.target_os == 'win' || github.event.inputs.target_os == 'all' }}
shell: bash
run: |
2021-08-04 13:44:46 +05:30
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
2021-07-31 18:43:23 +05:30
2022-10-17 12:25:53 +05:30
echo "::group::-------- gn gen"
2022-10-21 15:58:39 +05:30
gn gen --args="import(\"/home/lg/working_dir/bromite/build/bromite.gn_args\") target_os = \"win\" $(cat ../../build_args.gni) target_cpu = \"x64\" " out/bromite_win
2022-10-17 12:25:53 +05:30
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/bromite_win/ --list --short
gn args out/bromite_win/ --list >out/bromite_win/gn_list
echo "::endgroup::"
autoninja -C out/bromite_win chrome
cp ../../bromite/build/RELEASE out/bromite_win
- name: Get ninja logs Windows
if: ${{ github.event.inputs.target_os == 'win' || github.event.inputs.target_os == 'all' }}
2021-12-06 19:49:59 +05:30
shell: bash
run: |
cd $WORKSPACE
2022-10-17 12:25:53 +05:30
$WORKSPACE/ninjatracing/ninjatracing $WORKSPACE/chromium/src/out/bromite_win/.ninja_log >$WORKSPACE/chromium/src/out/bromite_win/ninja_log_trace.json
2023-04-04 11:59:19 +05:30
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/bromite_win/ninja_log_trace.json
2022-10-17 12:25:53 +05:30
2023-04-20 16:50:36 +05:30
- name: Build Bromite Android x64
2023-04-20 17:06:05 +05:30
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'x64' || github.event.inputs.build == 'all') }}
2023-04-20 16:50:36 +05:30
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- gn gen"
gn gen --args="import(\"/home/lg/working_dir/bromite/build/bromite.gn_args\") $(cat ../../build_args.gni) target_cpu = \"x64\" " out/bromite_x64
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/bromite_x64/ --list --short
gn args out/bromite_x64/ --list >out/bromite_x64/gn_list
echo "::endgroup::"
autoninja -C out/bromite_x64 chrome_public_apk
cp ../../bromite/build/RELEASE out/bromite_x64
- name: Get ninja logs Android x64
2023-04-20 17:06:05 +05:30
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'x64' || github.event.inputs.build == 'all') }}
2023-04-20 16:50:36 +05:30
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing $WORKSPACE/chromium/src/out/bromite_x64/.ninja_log >$WORKSPACE/chromium/src/out/bromite_x64/ninja_log_trace.json
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/bromite_x64/ninja_log_trace.json
- name: Generate breakpad symbols arm64
2022-10-17 12:25:53 +05:30
if: ${{ github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all' }}
shell: bash
run: |
2021-08-04 13:44:46 +05:30
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
2021-08-09 17:58:02 +05:30
echo "::group::-------- generating breakpad symbols"
2022-10-17 12:25:53 +05:30
autoninja -C out/bromite minidump_stackwalk dump_syms
2021-08-09 17:58:02 +05:30
components/crash/content/tools/generate_breakpad_symbols.py --build-dir=out/bromite \
2021-12-01 13:16:09 +05:30
--symbols-dir=out/bromite/symbols/ --binary=out/bromite/lib.unstripped/libchrome.so \
2021-08-09 17:58:02 +05:30
--platform=android --clear --verbose
2021-12-01 13:16:09 +05:30
cp out/bromite/lib.unstripped/libchrome.so out/bromite/symbols/libchrome.lib.so
cp out/bromite/minidump_stackwalk out/bromite/symbols
cp out/bromite/dump_syms out/bromite/symbols
2021-08-09 17:58:02 +05:30
echo "::endgroup::"
2021-07-31 18:43:23 +05:30
2022-10-17 12:25:53 +05:30
- name: Generate Supersize data
if: ${{ github.event.inputs.debug == 'false' && (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
tools/binary_size/supersize archive out/bromite/chrome.size --apk-file out/bromite/apks/ChromePublic.apk -v
2021-12-08 17:35:33 +05:30
- name: Generate clangd index
2022-10-17 12:25:53 +05:30
if: ${{ github.event.inputs.debug == 'true' && github.event.inputs.clangd == 'true' }}
2021-12-08 17:35:33 +05:30
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
2022-01-17 19:15:42 +05:30
test -f out/bromite/bromite.idx || \
2022-08-02 20:51:58 +05:30
cp -r out/bromite out/clangd && \
2022-07-12 21:11:44 +05:30
gn gen --args="import(\"/home/lg/working_dir/bromite/build/bromite.gn_args\") $(cat ../../build_args.gni) skip_clangd_unsupported_options = true" out/clangd && \
2022-08-02 20:51:58 +05:30
$WORKSPACE/ninja/ninja -C $WORKSPACE/chromium/src/out/clangd -a chrome_public_apk \
-t compdb cc cxx objc objcxx >$WORKSPACE/chromium/src/out/clangd/compile_commands.json && \
2022-07-12 21:11:44 +05:30
/home/lg/working_dir/clangd_snapshot_20211205/bin/clangd-indexer --executor=all-TUs out/clangd/compile_commands.json >out/bromite/bromite.idx && \
rm -rf out/clangd