generated from IRNAS/irnas-projects-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
117 lines (99 loc) · 4.31 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# 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
# 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
# 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
# <project_name>/project.
install-dep:
east install nrfutil-toolchain-manager
# Below line is needed, as the toolchain manager might be cached in CI, but not configured
~/.local/share/east/tooling/nrfutil/nrfutil toolchain-manager config --set install-dir=~/.local/share/east
project-setup:
# Make a West workspace around this project
east init -l .
# Use a faster update method
east update -o=--depth=1 -n
east install toolchain
# Generate version file for each app
# If multiple apps are present, this target should call the version script
# once for each app
gen-version:
./scripts/version/version.py --file ./app/VERSION
pre-build: gen-version
echo "Pre-build"
# Runs on every push to the main branch
quick-build:
east build -b custom_board app
# Runs on every PR and when doing releases
release:
# Change east.yml to control what is built.
east release
# Pre-package target is only run in release process.
pre-package:
mkdir -p artefacts
cp release/*.zip artefacts
cp scripts/pre_changelog.md artefacts
cp scripts/post_changelog.md artefacts
test:
east twister -T tests --coverage -p native_sim --coverage-tool lcov
# Used to run twister on remote RPi with attached nRF52840DK
# The {RPI_IP} variable must be set in the environment using Github Secrets
test-remote:
east twister -T tests -p custom_board --device-testing --device-serial-pty="scripts/rpi-jlink-server/twister_pty.py --host ${RPI_IP} --port 7777" --west-runner=jlink --west-flash="--tool-opt=ip ${RPI_IP}:7778"
test-report-ci:
junit2html twister-out/twister.xml twister-out/twister-report.html
# 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
# CodeChecker section
# build and check targets are run on every push to the `main` and in PRs.
# store target is run only on the push to `main`.
# diff target is run only in PRs.
#
# Important: If building more projects, make sure to create separate build
# directories with -d flag, so they can be analyzed separately, see examples
# below.
codechecker-build:
east build -b custom_board app -d build_app
east build -b custom_board app -u debug -d build_debug
codechecker-check:
east codechecker check -d build_app
east codechecker check -d build_debug
codechecker-store:
east codechecker store -d build_app
east codechecker store -d build_debug
# Specify build folders that you want to analyze to the script as positional
# arguments, open it to learn more.
codechecker-diff:
scripts/codechecker-diff.sh build_app build_debug