Files
IronFox/scripts/ci-build.sh
Akash Yadav 6d38c182f1 ci: add CI build metrics
Signed-off-by: Akash Yadav <contact@itsaky.com>
2026-06-01 15:56:58 +05:30

53 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
if [[ "${CI_COMMIT_REF_NAME}" == "${PRODUCTION_BRANCH}" ]]; then
# Target release
export IRONFOX_RELEASE=1
fi
# Set-up our environment
if [[ -z "${IRONFOX_CI+x}" ]]; then
export IRONFOX_CI=1
fi
if [[ -z "${IRONFOX_SET_ENVS+x}" ]]; then
bash -x $(dirname $0)/env.sh
fi
source $(dirname $0)/env.sh
# Include utilities
source "${IRONFOX_UTILS}"
# Include metrics helpers
source "${IRONFOX_METRICS_LIB}"
readonly ci_target=$(echo "${1}" | "${IRONFOX_AWK}" '{print tolower($0)}')
# Label all metrics from this job with the variant we're building
export IRONFOX_METRICS_VARIANT="${ci_target}"
# Function to compress our archives
function compress_archives() {
if [ "${ci_target}" == 'bundle' ]; then
local readonly ci_job_artifact="build-final-${ci_target}"
else
local readonly ci_job_artifact="build-aar-${ci_target}"
fi
bash -x "${IRONFOX_SCRIPTS}/ci-compress.sh" "${ci_job_artifact}"
}
# By default, we know the build hasn't failed...
IRONFOX_CI_BUILD_FAILED=0
# Build IronFox
readonly IRONFOX_FROM_CI_BUILD=1
export IRONFOX_FROM_CI_BUILD
bash -x "${IRONFOX_SCRIPTS}/ci-build-if.sh" "${ci_target}" || IRONFOX_CI_BUILD_FAILED=1
readonly IRONFOX_CI_BUILD_FAILED
export IRONFOX_CI_BUILD_FAILED
# Compress our archives
ironfox_metric_measure compress compress_archives