Skip to content

Commit

Permalink
infra: update and clean makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoSagadin committed Apr 25, 2024
1 parent 6dc1dab commit 909d594
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,53 @@
# This is a default makefile for the Zephyr project, that is supposed to be
# initialized with West and built with East.
# This is a default makefile for the Zephyr project, that is supposed to be
# initialized with West and built with East.
#
# This makefile in combination with the Github actions does the following:
# * Installs python dependencies and toolchain
# * Initializes the project with West and updates it
# * Runs east release
# If the _build_ is running due to the release creation, then the following also
# If the _build_ is running due to the release creation, then the following also
# happens:
# * Creates 'artefacts' folder,
# * Copies release zip files and extra release notes files into it.
#
# Downloaded West modules, toolchain and nrfutil-toolchain-manager are cached in
# Downloaded West modules, toolchain and nrfutil-toolchain-manager are cached in
# CI after the first time the entire build is run.
#
# The assumed precondition is that the repo was setup with below commands:
# mkdir -p <project_name>/project
# cd <project_name>/project
# git clone <project_url> .
#
# Every target assumes that is run from the repo's root directory, which is
# Every target assumes that is run from the repo's root directory, which is
# <project_name>/project.

install-dep:
# Install gcc-multilib for 32-bit support
sudo apt-get update
sudo apt-get install gcc-multilib
pip install -r scripts/requirements.txt
east sys-setup
east install nrfutil-toolchain-manager
# Below line is needed, as the toolchain manager might be cached in CI, but not configured
~/.local/share/east/nrfutil-toolchain-manager.exe config --install-dir ~/.local/share/east

install-test-dep:
sudo apt-get install gcc-multilib lcov
pip install junit2html
~/.local/share/east/tooling/nrfutil/nrfutil-toolchain-manager.exe config --install-dir ~/.local/share/east

project-setup:
# Make a West workspace around this project
west init -l .
east init -l .
# Use a faster update method
west update -o=--depth=1 -n
east update toolchain
east update -o=--depth=1 -n
east install toolchain

pre-build:
echo "Pre-build"

build:
# Change east.yml to control what is built.
# east release
# Runs on every push to the main branch
quick-build:
east build -b nrf52840dk_nrf52840 tests/flash_read_write

# Runs on every PR and when doing releases
release:
# This is empty on purpose, no artefacts are generated by this repo.

# Pre-package target is only run in release process.
pre-package:
mkdir -p artefacts
# cp release/*.zip artefacts
cp release/*.zip artefacts
cp scripts/pre_changelog.md artefacts
cp scripts/post_changelog.md artefacts

Expand All @@ -61,6 +57,24 @@ test:
test-report-ci:
junit2html twister-out/twister.xml twister-out/twister-report.html

# Intended to be used by developer
# Intended to be used by developer, use 'pip install junit2html' to install
# tooling
test-report: test-report-ci
firefox twister-out/twister-report.html

# Twister's coverage report by default includes all Zephyr sources, which is not
# what we want. Below coverage-report-ci target removes all Zephyr sources from
# coverage.info and generates a new coverage report.
REMOVE_DIR = $(shell realpath $(shell pwd)/../zephyr)

# This target is used in CI. It differs from coverage-report target in that it
# removes "project/" from the paths in coverage.info, so that the GitHub action
# that makes the coverage report can create proper links to the source files.
coverage-report-ci:
rm -fr twister-out/coverage
lcov -q --remove twister-out/coverage.info "${REMOVE_DIR}/*" -o twister-out/coverage.info --rc lcov_branch_coverage=1

# Intended to be used by developer
coverage-report: coverage-report-ci
genhtml -q --output-directory twister-out/coverage --ignore-errors source --branch-coverage --highlight --legend twister-out/coverage.info
firefox twister-out/coverage/index.html

0 comments on commit 909d594

Please sign in to comment.