blob: 1072725501ac12e89aa4883b2c7f62f57a34b38d [file] [log] [blame] [edit]
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
image: jbettis/bionic-20200807-20sep21
# You can update that image using this repo:
# https://gitlab.com/zephyr-ec/gitlab-ci-runner/-/tree/main
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
# The directory structure is:
#
# /zephyr
# /builds/zephyr-ec/ec EC_DIR
before_script:
- export MODULES_DIR="$HOME/modules"
- mkdir -p "${MODULES_DIR}"
- export ZEPHYR_BASE="$HOME/zephyr"
- git clone -b chromeos-v2.6 https://chromium.googlesource.com/chromiumos/third_party/zephyr "${ZEPHYR_BASE}26"
- git clone -b chromeos-main https://chromium.googlesource.com/chromiumos/third_party/zephyr/cmsis "${MODULES_DIR}/cmsis"
- git clone -b chromeos-main https://chromium.googlesource.com/chromiumos/third_party/zephyr/hal_stm32 "${MODULES_DIR}/hal_stm32"
- git clone -b main https://chromium.googlesource.com/chromiumos/third_party/zephyr/nanopb "${MODULES_DIR}/nanopb"
- git clone -b main https://chromium.googlesource.com/chromiumos/third_party/cryptoc "${MODULES_DIR}/cryptoc"
- ln -s "$(pwd)" "${MODULES_DIR}/ec"
- python3 -V # Print out python version for debugging
- python3 -m pip install zephyr/zmake --user
- export BUILD_DIR=build
- export ZEPHYR_DIR=/zephyr
- export PATH="$PATH:$HOME/.local/bin"
- python3 -m pip install anytree --user
- python3 -m pip install pyelftools --user
- export PYTHONIOENCODING=utf-8
# Users of this template must set:
# $PROJECT to the project to build in zephyr/projects. E.g. "lazor")
# $VERSION to the Zephyr version to use (e.g. 25 for 2.5, 26 for 2.6)
# $PROJECT_SUBDIR if it is in a subdirectory. E.g. "trogdor/"
.build_template: &build_template
stage: build
script:
- zmake --zephyr-base "${ZEPHYR_BASE}${VERSION}"
--modules-dir "${MODULES_DIR}" -l DEBUG configure -b
-B "${BUILD_DIR}/${PROJECT}" -t ${TOOLCHAIN:-zephyr}
zephyr/projects/${PROJECT_SUBDIR}${PROJECT}
- for b in "${BUILD_DIR}/${PROJECT}"/build-* ; do
bdir=$(basename ${b}) ;
ninja -C ${b} ram_report >"${BUILD_DIR}/${PROJECT}/output/${bdir}_ram_report.txt" ;
cp ${b}/ram.json "${BUILD_DIR}/${PROJECT}/output/${bdir}_ram.json" ;
ninja -C ${b} rom_report >"${BUILD_DIR}/${PROJECT}/output/${bdir}_rom_report.txt" ;
cp ${b}/rom.json "${BUILD_DIR}/${PROJECT}/output/${bdir}_rom.json" ;
done
- ls "${BUILD_DIR}/${PROJECT}" "${BUILD_DIR}/${PROJECT}/output"
artifacts:
paths:
- build/${PROJECT}/output/*
expire_in: 1 week
delbin:
variables:
PROJECT: "delbin"
PROJECT_SUBDIR: "volteer/"
VERSION: 26
<<: *build_template
hayato:
variables:
PROJECT: "hayato"
PROJECT_SUBDIR: "asurada/"
VERSION: 26
<<: *build_template
herobrine_npcx9:
variables:
PROJECT: "herobrine_npcx9"
PROJECT_SUBDIR: "herobrine/"
VERSION: 26
<<: *build_template
it8xxx2_evb:
variables:
PROJECT: "it8xxx2_evb"
VERSION: 26
<<: *build_template
kohaku:
variables:
PROJECT: "kohaku"
VERSION: 26
<<: *build_template
lazor:
variables:
PROJECT: "lazor"
PROJECT_SUBDIR: "trogdor/"
VERSION: 26
<<: *build_template
native_posix:
variables:
PROJECT: "posix-ec"
TOOLCHAIN: "host"
VERSION: 26
<<: *build_template
volteer:
variables:
PROJECT: "volteer"
PROJECT_SUBDIR: "volteer/"
VERSION: 26
<<: *build_template
coverage:
stage: test
script:
- zmake --zephyr-base "${ZEPHYR_BASE}26"
--modules-dir "${MODULES_DIR}" -l DEBUG coverage
"${BUILD_DIR}/zcoverage"
- make -j CRYPTOC_DIR="${MODULES_DIR}/cryptoc"
FTDIVERSION=1 HOSTGCOV='gcov'
CROSS_COMPILE_arm=/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-
coverage
- lcov -o build/merged.info -a build/coverage/lcov.info -a build/zcoverage/lcov.info
- lcov -o build/merged_no_zephyr.info -r build/merged.info '/home/uboot/zephyr26/*' '/home/uboot/modules/*' '/usr/include/x86_64-linux-gnu/*'
- grep "SF:" build/zcoverage/projects_herobrine_herobrine_npcx9.info | sort -u | sed -e 's|^SF:||' | xargs lcov -o build/merged_no_zephyr_herobrine_npcx9.info -e build/merged_no_zephyr.info
- /usr/bin/genhtml -q -o build/merged_no_zephyr_herobrine_npcx9_rpt -t "Herobrine npcx9 coverage w/o zephyr" -p /builds/zephyr-ec/ec -s build/merged_no_zephyr_herobrine_npcx9.info
artifacts:
paths:
- build/zcoverage/coverage_rpt/*
- build/coverage/coverage_rpt/*
- build/*.info
- build/*_rpt
expire_in: 1 week
testall:
stage: test
script:
- zmake --zephyr-base "${ZEPHYR_BASE}26"
--modules-dir "${MODULES_DIR}" -l DEBUG testall