summaryrefslogtreecommitdiff
path: root/tcwg_chromium-build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tcwg_chromium-build.sh')
-rwxr-xr-xtcwg_chromium-build.sh218
1 files changed, 218 insertions, 0 deletions
diff --git a/tcwg_chromium-build.sh b/tcwg_chromium-build.sh
new file mode 100755
index 00000000..aa956062
--- /dev/null
+++ b/tcwg_chromium-build.sh
@@ -0,0 +1,218 @@
+#!/bin/bash
+
+set -euf -o pipefail
+
+scripts=$(dirname $0)
+# shellcheck source=jenkins-helpers.sh
+. $scripts/jenkins-helpers.sh
+# shellcheck source=round-robin.sh
+. $scripts/round-robin.sh
+# shellcheck source=ci-autotest.sh
+. $scripts/ci-autotest.sh
+
+workspace="${workspace-$(pwd)}"
+
+convert_args_to_variables "$@"
+
+obligatory_variables rr[ci_project] rr[ci_config]
+declare -A rr
+
+# Execution mode: build or bisect
+rr[mode]="${rr[mode]-build}"
+
+# mandatory major/minor fields
+rr[major]=1
+rr[minor]=0
+
+# Set custom revision for one of the projects, and use baseline revisions
+# for all other projects.
+rr[baseline_branch]="${rr[baseline_branch]-linaro-local/ci/${rr[ci_project]}/${rr[ci_config]}}"
+rr[update_baseline]="${rr[update_baseline]-ignore}"
+rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}"
+
+# FIXME : Disable ci_autotest when ready
+rr[ci_autotest]="" # "${rr[ci_autotest]-test}"
+
+# This project uses a dynamic component list
+rr[dynamic_components_list]="${rr[dynamic_components_list]-}"
+
+# Artifacts version
+rr[major]=4
+rr[minor]=0
+
+if [ x"${rr[dynamic_components_list]}" == x"*" ]; then
+ dynamic_components_list="${!deps_dir[*]}"
+else
+ dynamic_components_list="${rr[dynamic_components_list]}"
+fi
+
+rr[components]="${rr[components]-}"
+for dep in $dynamic_components_list; do
+ if [ -f ${rr[top_artifacts]}/git/${dep}_rev ]; then
+ rr[components]="${rr[components]} ${dep}"
+ dep_url="$(get_component_url ${dep})"
+ rr[${dep}_git]="$dep_url#$(get_current_git ${dep}_rev)"
+ fi
+done
+
+for dep in "${!deps_dir[@]}"; do
+ if [[ -v rr[${dep}_git] ]]; then
+ [[ "${rr[components]}" =~ $dep ]] || rr[components]="${rr[components]} ${dep}"
+ dep_url="${rr[${dep}_git]%#*}"
+ dep_rev="${rr[${dep}_git]#*#}"
+ echo "$dep_url" | set_current_git ${dep}_url
+ echo "$dep_rev" | set_current_git ${dep}_rev
+ :
+ fi
+done
+
+verbose="${verbose-true}"
+verbose2="${verbose2-false}"
+
+if $verbose2; then set -x; fi
+
+trap print_traceback EXIT
+
+# Set start and finish steps for different modes.
+start_at="${start_at-default}"
+finish_at="${finish_at-default}"
+default_start_at=""
+default_finish_at=""
+if [ x"$start_at" = x"default" ]; then
+ start_at="$default_start_at"
+fi
+if [ x"$finish_at" = x"default" ]; then
+ finish_at="$default_finish_at"
+fi
+
+run_step_init "$start_at" "$finish_at" "${rr[top_artifacts]}" "$verbose"
+#
+get_sources()
+{
+ cd $workspace
+
+ echo "# RUN_STEP: get_sources"
+
+ /bin/rm -fr $PWD/depot_tools
+
+ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
+
+ export PATH="$PWD/depot_tools:$PATH"
+
+ force_fetch=false
+
+ if [ ! -d $PWD/src ] || $force_fetch; then
+ /bin/rm -fr $PWD/src $PWD/.gclient $PWD/.gclient_entries $PWD/.gclient_previous_sync_commits
+
+ fetch --nohooks --no-history chromium
+ fi
+
+
+ cd $workspace/src
+
+ #
+
+ # FIXME : Temporarily disabled to make it faster
+ gclient revinfo > REVINFO.BEF
+
+ # Updating individual components
+ (
+ cd $workspace
+
+ echo "components=${rr[components]}"
+
+ # update the rev
+ for depfile in ${rr[components]}; do
+ dep=${depfile#${rr[top_artifacts]}/git/}
+ dep=${dep%_rev}
+
+
+ git_dir="$(get_component_dir ${dep})"
+ rev_or_branch=$(get_current_git ${dep}_rev)
+ git_component_cmd "$dep" fetch origin "$rev_or_branch"
+ git_component_cmd "$dep" checkout FETCH_HEAD
+ rev=$(git_component_cmd "$dep" rev-parse HEAD)
+
+ echo "UPDATING [$dep] : $rev_or_branch -> $rev"
+ echo "$rev" | set_current_git ${dep}_rev
+ (
+ cd $workspace/src
+ gclient setdep --revision=$git_dir@$rev
+ )
+
+ done
+ )
+
+ # FIXME : Temporarily return here to make it faster
+ # return
+
+ gclient revinfo > REVINFO.AFT
+
+ #
+ sudo apt-get update
+ sudo env DEBIAN_FRONTEND=noninteractive apt-get install keyboard-configuration
+
+ ./build/install-build-deps.sh
+
+ ./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
+
+ gclient sync --nohooks
+
+ gclient runhooks
+
+ gn gen out/Default
+
+ [ "$(grep target_cpu out/Default/args.gn | wc -l)" -ne 0 ] \
+ || echo 'target_cpu = "arm64"' >> out/Default/args.gn
+
+}
+
+#
+build_chromium()
+{
+ echo "# RUN_STEP: build_chromium"
+ export PATH="$PWD/depot_tools:$PATH"
+ if [ "${rr[ci_autotest]}" == "build" ]; then
+ ci_autotest_check_guilty_commit "build"
+ return
+ fi
+
+ cd $workspace/src
+ # FIXME: long
+ autoninja -C out/Default chrome
+ true
+}
+
+#
+test_chromium()
+{
+ echo "# RUN_STEP: test_chromium"
+ if [ "${rr[ci_autotest]}" == "test" ]; then
+ ci_autotest_check_guilty_commit "test"
+ return
+ fi
+
+ # test it
+ true
+}
+
+# Exit with code 0 if no regression compared to base-artifacts/results.
+no_regression_p ()
+{
+ # check score-based regression
+ no_build_regression_p "$@"
+
+ # Regression detecvtion can be more precise :
+ # - same "build" score : we could check the number of objects
+ # - etc..
+
+ return 0
+}
+
+run_step stop_on_fail -1 reset_artifacts
+run_step skip_on_fail 0 get_sources
+run_step skip_on_fail 1 build_chromium
+run_step skip_on_fail 2 test_chromium
+run_step reset_on_fail x check_regression
+
+trap "" EXIT