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

387 lines
15 KiB
YAML
Raw Normal View History

2021-07-11 16:25:43 +05:30
name: Build x86
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
default: '76745fde6ed75542f005ea5528f486df41c56da4'
2021-09-15 15:47:07 +05:30
usegoma:
description: 'Use goma?'
required: true
default: 'true'
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-09-15 19:34:08 +05:30
USEGOMA: ${{ github.event.inputs.usegoma }}
2021-07-28 01:32:57 +05:30
REMOVEDOCKERSUPPORT: true
2021-07-30 13:00:54 +05:30
USELOCALIMAGE: true
2021-08-04 23:38:37 +05:30
GOMAJOBS: 60
2021-07-11 18:42:14 +05:30
2021-07-11 16:25:43 +05:30
jobs:
check_images:
runs-on: self-hosted
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
2021-07-11 18:42:14 +05:30
- name: Checking build-deps for ${{ env.VERSION }}
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
2021-07-11 18:42:14 +05:30
- name: Checking chromium for ${{ env.VERSION }}
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
2021-07-11 18:42:14 +05:30
- name: Checking bromite for ${{ env.BROMITE_SHA }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/bromite:$BROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/bromite:$BROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/bromite:$BROMITE_SHA --progress plain \
--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
- name: Checking bromite-build for ${{ env.BROMITE_SHA }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/bromite-build:$BROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/bromite-build:$BROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/bromite-build:$BROMITE_SHA --progress plain \
--build-arg BROMITE_SHA=$BROMITE_SHA \
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
docker tag uazo/bromite-build:$BROMITE_SHA uazo/bromite-build:build
2021-07-11 16:25:43 +05:30
build:
runs-on: self-hosted
needs: check_images
if: success()
2021-08-09 18:03:59 +05:30
timeout-minutes: 720
2021-07-11 16:25:43 +05:30
2021-08-01 22:35:27 +05:30
services:
2021-07-11 16:25:43 +05:30
gomaserver:
image: uazo/goma-server
volumes:
- /tmp/proxy:/tmp/proxy
2021-08-01 22:35:27 +05:30
- /redis:/var/lib/redis
2021-07-30 15:18:20 +05:30
options: >-
--health-cmd "hostname -I >/tmp/proxy/gomaserverip"
2021-07-30 15:36:31 +05:30
--health-interval 30s
2021-07-30 15:18:20 +05:30
--health-timeout 5s
--health-retries 5
2021-07-30 15:36:31 +05:30
2021-07-11 16:25:43 +05:30
env:
2021-07-30 13:08:27 +05:30
REMOVEDOCKERSUPPORT: true
USELOCALIMAGE: true
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:
SERVER_HOST_GOMA: gomaserver
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
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
2021-09-16 20:30:49 +05:30
# compile in debug mode
TARGET_ISDEBUG: true
2021-07-11 16:25:43 +05:30
volumes:
2021-12-01 13:16:09 +05:30
- /storage/images/${{ github.event.inputs.sha }}:/home/lg/working_dir/chromium/src/out/bromite
2021-08-04 13:25:01 +05:30
- /tmp/proxy:/tmp/proxy
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-08-01 22:35:27 +05:30
# update hosts
#sudo echo "$(cat /tmp/proxy/gomaserverip | xargs) gomaserver" >/etc/hosts
#sudo echo "$(cat /tmp/proxy/redisip | xargs) redis" >/etc/hosts
2021-07-31 18:43:23 +05:30
# set goma options
2021-07-31 14:41:13 +05:30
export SERVER_HOST_GOMA=$(cat /tmp/proxy/gomaserverip | xargs)
2021-07-31 18:43:23 +05:30
export GOMA_SERVER_HOST=$SERVER_HOST_GOMA
export GOMA_SERVER_PORT=5050
export GOMA_USE_SSL=false
export GOMA_HTTP_AUTHORIZATION_FILE=$WORKSPACE/.debug_auth_file
export GOMA_HERMETIC=error
export GOMA_USE_LOCAL=false
export GOMA_FALLBACK=true
export GOMA_ARBITRARY_TOOLCHAIN_SUPPORT=true
export GOMA_MAX_SUBPROCS_LOW=0
2021-09-15 20:45:08 +05:30
2021-12-01 13:51:16 +05:30
# make kythe output directory
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-31 18:43:23 +05:30
# start goma client
2021-09-15 19:34:08 +05:30
[[ "$USEGOMA" = "true" ]] && \
2021-09-15 15:47:07 +05:30
echo "::group::-------- start goma client" && \
$WORKSPACE/goma/goma_ctl.py ensure_stop && \
$WORKSPACE/goma/goma_ctl.py ensure_start && \
echo "::endgroup::" \
|| true
2021-07-30 15:18:20 +05:30
2021-07-31 18:43:23 +05:30
cd chromium/src
OUT_PRESENT=0
2021-12-01 13:16:09 +05:30
test -f out/bromite/prepare_gn && OUT_PRESENT=1
2021-07-31 18:43:23 +05:30
if [[ OUT_PRESENT -eq 0 ]]; then
echo "::group::-------- gn gen"
2021-09-15 19:34:08 +05:30
[[ "$USEGOMA" = "true" ]] && \
2021-09-15 15:47:07 +05:30
gn gen --args="import(\"/home/lg/working_dir/bromite/build/GN_ARGS\") use_goma=true goma_dir=\"$WORKSPACE/goma\" $(cat ../../build_args.gni) " out/bromite \
|| \
2021-09-15 15:52:31 +05:30
gn gen --args="import(\"/home/lg/working_dir/bromite/build/GN_ARGS\") $(cat ../../build_args.gni) " out/bromite
2021-07-31 18:43:23 +05:30
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/bromite/ --list --short
2021-12-01 13:16:09 +05:30
gn args out/bromite/ --list >out/bromite/gn_list
2021-07-31 18:43:23 +05:30
echo "::endgroup::"
echo "::group::-------- apply .mtool"
test -f out/bromite/.mtool && \
cp out/bromite/.mtool .mtool && \
$WORKSPACE/mtool/chromium/mtime.sh --restore
echo "::endgroup::"
2021-12-01 13:16:09 +05:30
echo "OK" >out/bromite/prepare_gn
2021-07-31 18:43:23 +05:30
fi
if [[ -z "${GOMAJOBS}" ]]; then
GOMAJOBS=40
fi
2021-09-15 15:52:31 +05:30
echo "::group::-------- pre-cache toolchain"
2021-09-15 19:34:08 +05:30
[[ "$USEGOMA" = "true" ]] && \
2021-09-15 15:47:07 +05:30
sudo ../../casupload --cas-server=unix:/tmp/proxy/bots.sock --instance=default_instance \
third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include \
third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/include \
third_party/llvm-build/Release+Asserts/lib \
third_party/llvm-build/Release+Asserts/bin \
buildtools/third_party/libc++ \
2021-09-15 15:52:31 +05:30
chrome/android/profiles/afdo.prof \
2021-09-15 15:47:07 +05:30
|| true
2021-09-15 15:52:31 +05:30
echo "::endgroup::"
2021-07-31 18:43:23 +05:30
- name: Build Bromite
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-09-15 19:34:08 +05:30
[[ "$USEGOMA" = "true" ]] && \
2021-09-15 15:47:07 +05:30
autoninja -j $GOMAJOBS -C out/bromite chrome_public_apk \
|| \
2021-09-15 15:52:31 +05:30
autoninja -C out/bromite chrome_public_apk
2021-07-31 18:43:23 +05:30
2021-08-04 18:17:36 +05:30
- name: Get goma logs
shell: bash
run: |
2021-08-04 18:42:57 +05:30
# reset proxy env
HTTP_PROXY=
HTTPS_PROXY=
http_proxy=
https_proxy=
2021-10-11 00:23:22 +05:30
[[ "$USEGOMA" = "true" ]] && \
2021-12-01 13:16:09 +05:30
wget http://127.0.0.1:8088/logz?INFO -O out/bromite/goma-client.log \
2021-10-11 00:23:22 +05:30
|| \
echo Skipped.
2021-08-04 23:38:37 +05:30
- name: Generate breakpad symbols
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"
autoninja -j $GOMAJOBS -C out/bromite minidump_stackwalk dump_syms
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
2021-11-30 20:02:54 +05:30
- name: Generate kythe index
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-11-30 22:10:22 +05:30
python tools/clang/scripts/generate_compdb.py -p out/bromite/ -o out/bromite/compile_commands.json
gn desc out/bromite/ '*' --format=json >out/bromite/gn_targets.json
2021-12-01 13:16:09 +05:30
python tools/clang/scripts/run_tool.py --tool translation_unit -p out/bromite/ --all || true
2021-12-01 16:29:52 +05:30
python /home/lg/add_kythe_metadata.py out/bromite/ --corpus $KYTHE_CORPUS || true
2021-12-01 18:34:10 +05:30
cd ..
2021-12-01 16:29:52 +05:30
/home/lg/package_index/latest/package_index \
2021-12-01 18:34:10 +05:30
--checkout_dir src \
--path_to_compdb src/out/bromite/compile_commands.json \
--path_to_gn_targets src/out/bromite/gn_targets.json \
2021-11-30 22:10:22 +05:30
--path_to_java_kzips $KYTHE_OUTPUT_DIRECTORY \
2021-12-01 18:34:10 +05:30
--path_to_archive_output src/out/bromite/chromium_linux.kzip \
2021-11-30 22:10:22 +05:30
--corpus $KYTHE_CORPUS \
2021-12-01 18:34:10 +05:30
--out_dir src/out/bromite \
2021-12-01 13:16:09 +05:30
--keep_filepaths_files || true
2021-11-30 20:02:54 +05:30
2021-08-09 18:03:59 +05:30
- name: Build junit tests
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
git log | grep FILE:Fix-build-test-suite.patch && TEST=1
if [[ TEST -eq 1 ]]; then
autoninja -j $GOMAJOBS -C out/bromite chrome_junit_tests
autoninja -j $GOMAJOBS -C out/bromite components_junit_tests
autoninja -j $GOMAJOBS -C out/bromite content_junit_tests
autoninja -j $GOMAJOBS -C out/bromite base_junit_tests
autoninja -j $GOMAJOBS -C out/bromite ui_junit_tests
fi
2021-08-09 18:03:59 +05:30
- name: Build c++ tests
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
git log | grep FILE:Fix-build-test-suite.patch && TEST=1
if [[ TEST -eq 1 ]]; then
autoninja -j $GOMAJOBS -C out/bromite network_service
autoninja -j $GOMAJOBS -C out/bromite unit_tests
autoninja -j $GOMAJOBS -C out/bromite content_browsertests
autoninja -j $GOMAJOBS -C out/bromite components_unittests
autoninja -j $GOMAJOBS -C out/bromite components_browsertests
fi
2021-08-09 18:03:59 +05:30
- name: Build instrumentation tests
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
git log | grep FILE:Fix-build-test-suite.patch && TEST=1
if [[ TEST -eq 1 ]]; then
autoninja -j $GOMAJOBS -C out/bromite content_shell_test_apk
autoninja -j $GOMAJOBS -C out/bromite chrome_public_test_apk
fi
2021-08-06 11:09:04 +05:30
2021-08-04 23:38:37 +05:30
- name: Stop goma
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
echo "::group::-------- stop goma"
2021-10-11 16:17:28 +05:30
[[ "$USEGOMA" = "true" ]] && $WORKSPACE/goma/goma_ctl.py ensure_stop || true
[[ "$USEGOMA" = "true" ]] && find /tmp/ -maxdepth 1 -name "gomacc*" -print0 | xargs -0 rm || true
[[ "$USEGOMA" = "true" ]] && rm -rf /tmp/goma_lg/ || true
2021-07-31 18:43:23 +05:30
echo "::endgroup::"