2021-02-10 07:39:43 -04:00
|
|
|
name: test size
|
|
|
|
|
2023-02-08 18:33:17 -04:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths-ignore: # ignore autotest stuffs
|
|
|
|
- 'Tools/autotest/**'
|
|
|
|
# Remove markdown files as irrelevant
|
|
|
|
- '**.md'
|
|
|
|
# Remove dotfile at root directory
|
|
|
|
- './.dir-locals.el'
|
|
|
|
- './.dockerignore'
|
|
|
|
- './.editorconfig'
|
|
|
|
- './.flake8'
|
|
|
|
- './.gitattributes'
|
|
|
|
- './.github'
|
|
|
|
- './.gitignore'
|
|
|
|
- './.pre-commit-config.yaml'
|
|
|
|
- './.pydevproject'
|
|
|
|
- './.valgrind-suppressions'
|
|
|
|
- './.valgrindrc'
|
|
|
|
- 'Dockerfile'
|
|
|
|
- 'Vagrantfile'
|
|
|
|
- 'Makefile'
|
|
|
|
# Remove some directories check
|
|
|
|
- '.vscode/**'
|
|
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
|
|
# Remove generic tools
|
|
|
|
- 'Tools/CHDK-Script/**'
|
|
|
|
- 'Tools/CodeStyle/**'
|
|
|
|
- 'Tools/completion/**'
|
|
|
|
- 'Tools/CPUInfo/**'
|
|
|
|
- 'Tools/debug/**'
|
|
|
|
- 'Tools/environment_install/**'
|
|
|
|
- 'Tools/FilterTestTool/**'
|
|
|
|
- 'Tools/geotag/**'
|
|
|
|
- 'Tools/GIT_Test/**'
|
|
|
|
- 'Tools/gittools/**'
|
|
|
|
- 'Tools/Hello/**'
|
|
|
|
- 'Tools/Linux_HAL_Essentials/**'
|
|
|
|
- 'Tools/mavproxy_modules/**'
|
|
|
|
- 'Tools/Pozyx/**'
|
|
|
|
- 'Tools/PrintVersion.py'
|
|
|
|
- 'Tools/simulink/**'
|
|
|
|
- 'Tools/UDP_Proxy/**'
|
|
|
|
- 'Tools/vagrant/**'
|
|
|
|
- 'Tools/Vicon/**'
|
|
|
|
# remove non CHIBIOS HAL
|
|
|
|
- 'libraries/AP_HAL_SITL/**'
|
|
|
|
- 'libraries/AP_HAL_ESP32/**'
|
|
|
|
- 'libraries/AP_HAL_Linux/**'
|
2023-08-22 19:06:17 -03:00
|
|
|
# Remove change on other workflows
|
|
|
|
- '.github/workflows/test_environment.yml'
|
2023-02-08 18:33:17 -04:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
|
2021-06-23 04:42:11 -03:00
|
|
|
concurrency:
|
|
|
|
group: ci-${{github.workflow}}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-02-10 07:39:43 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-08-31 18:25:51 -03:00
|
|
|
runs-on: ubuntu-22.04
|
2023-11-21 17:27:07 -04:00
|
|
|
container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.3
|
2021-02-10 07:39:43 -04:00
|
|
|
strategy:
|
|
|
|
fail-fast: false # don't cancel if a job from the matrix fails
|
|
|
|
matrix:
|
|
|
|
toolchain: [
|
2023-02-03 04:59:53 -04:00
|
|
|
chibios,
|
2021-02-10 07:39:43 -04:00
|
|
|
]
|
|
|
|
config: [
|
|
|
|
Durandal,
|
|
|
|
MatekF405,
|
2023-09-27 06:18:58 -03:00
|
|
|
KakuteF7,
|
|
|
|
MatekH743-bdshot,
|
2022-01-08 07:16:48 -04:00
|
|
|
Pixhawk1-1M,
|
2023-02-25 01:27:30 -04:00
|
|
|
MatekF405-CAN, # see special "build bootloader" code below
|
2023-04-19 02:35:32 -03:00
|
|
|
DrotekP3Pro, # see special "build bootloader" code below
|
2022-01-08 07:16:48 -04:00
|
|
|
Hitec-Airspeed, # see special code for Periph below (3 places!)
|
|
|
|
f103-GPS # see special code for Periph below (3 places!)
|
2021-02-10 07:39:43 -04:00
|
|
|
]
|
2023-02-03 04:59:53 -04:00
|
|
|
include:
|
|
|
|
- config: disco
|
|
|
|
toolchain: armhf
|
|
|
|
exclude:
|
|
|
|
- config: disco
|
|
|
|
toolchain: chibios
|
2021-02-10 07:39:43 -04:00
|
|
|
steps:
|
2023-11-21 17:29:41 -04:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-10 07:39:43 -04:00
|
|
|
with:
|
2022-10-02 05:25:51 -03:00
|
|
|
ref: ${{ github.event.pull_request.base.ref }}
|
|
|
|
path: base_branch
|
2021-02-10 07:39:43 -04:00
|
|
|
submodules: 'recursive'
|
|
|
|
# Put ccache into github cache for faster build
|
|
|
|
- name: Prepare ccache timestamp
|
|
|
|
id: ccache_cache_timestamp
|
|
|
|
run: |
|
|
|
|
NOW=$(date -u +"%F-%T")
|
2023-02-07 12:48:57 -04:00
|
|
|
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
|
2021-02-10 07:39:43 -04:00
|
|
|
- name: ccache cache files
|
2024-10-30 06:18:39 -03:00
|
|
|
uses: actions/cache@v4
|
2021-02-10 07:39:43 -04:00
|
|
|
with:
|
|
|
|
path: ~/.ccache
|
|
|
|
key: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
|
2022-10-02 05:25:51 -03:00
|
|
|
restore-keys: ${{github.workflow}}-ccache-${{ matrix.toolchain }}- # restore ccache from either previous build on this branch or on base branch
|
2022-12-09 07:48:00 -04:00
|
|
|
- name: setup ccache
|
|
|
|
run: |
|
|
|
|
. base_branch/.github/workflows/ccache.env
|
2022-10-02 05:25:51 -03:00
|
|
|
- name: Build ${{ github.event.pull_request.base.ref }} ${{matrix.config}} ${{ matrix.toolchain }}
|
2021-02-10 07:39:43 -04:00
|
|
|
env:
|
|
|
|
CI_BUILD_TARGET: ${{matrix.config}}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-02-25 01:27:30 -04:00
|
|
|
set -ex
|
|
|
|
# set up some variables based on what sort of build we're doing:
|
|
|
|
BOOTLOADER=0
|
|
|
|
AP_PERIPH=0
|
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
|
|
|
AP_PERIPH=1
|
2023-04-19 02:35:32 -03:00
|
|
|
elif [ "${{matrix.config}}" = "MatekF405-CAN" ] ||
|
|
|
|
[ "${{matrix.config}}" = "DrotekP3Pro" ]; then
|
2023-02-25 01:27:30 -04:00
|
|
|
BOOTLOADER=1
|
|
|
|
fi
|
|
|
|
if [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
BIN_SRC="build/${{matrix.config}}/bootloader"
|
|
|
|
else
|
|
|
|
BIN_SRC="build/${{matrix.config}}/bin"
|
|
|
|
fi
|
|
|
|
|
2023-02-03 13:45:49 -04:00
|
|
|
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
2021-02-10 07:39:43 -04:00
|
|
|
PATH="/github/home/.local/bin:$PATH"
|
2023-02-25 01:27:30 -04:00
|
|
|
|
|
|
|
# build the base branch
|
2022-10-02 05:25:51 -03:00
|
|
|
cd base_branch
|
2023-02-25 01:27:30 -04:00
|
|
|
# configure:
|
|
|
|
if [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
./waf configure --board ${{matrix.config}} --bootloader
|
|
|
|
else
|
|
|
|
./waf configure --board ${{matrix.config}}
|
|
|
|
fi
|
|
|
|
# build:
|
|
|
|
if [ $AP_PERIPH -eq 1 ]; then
|
2022-01-08 07:16:48 -04:00
|
|
|
./waf AP_Periph
|
2023-02-25 01:27:30 -04:00
|
|
|
elif [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
./waf bootloader
|
2022-01-08 07:16:48 -04:00
|
|
|
else
|
|
|
|
./waf
|
|
|
|
fi
|
2022-10-02 05:25:51 -03:00
|
|
|
mkdir -p $GITHUB_WORKSPACE/base_branch_bin
|
2023-02-25 01:27:30 -04:00
|
|
|
|
|
|
|
cp -r $BIN_SRC/* $GITHUB_WORKSPACE/base_branch_bin/
|
2021-02-10 07:39:43 -04:00
|
|
|
|
2022-01-15 20:35:52 -04:00
|
|
|
# build a set of binaries without symbols so we can check if
|
|
|
|
# the binaries have changed.
|
2022-10-02 05:25:51 -03:00
|
|
|
echo [`date`] Building ${{ github.event.pull_request.base.ref }} with no versions
|
2022-01-15 20:35:52 -04:00
|
|
|
|
2022-10-02 05:25:51 -03:00
|
|
|
NO_VERSIONS_DIR="$GITHUB_WORKSPACE/base_branch_bin_no_versions"
|
2022-01-15 20:35:52 -04:00
|
|
|
mkdir "$NO_VERSIONS_DIR"
|
|
|
|
|
2022-11-02 19:21:35 -03:00
|
|
|
# export some environment variables designed to get
|
|
|
|
# repeatable builds from the same source:
|
|
|
|
export CHIBIOS_GIT_VERSION="12345678"
|
|
|
|
export GIT_VERSION="abcdef"
|
|
|
|
export GIT_VERSION_INT="15"
|
|
|
|
|
2023-02-25 01:27:30 -04:00
|
|
|
if [ $AP_PERIPH -eq 1 ]; then
|
2022-11-02 19:21:35 -03:00
|
|
|
./waf AP_Periph
|
2023-02-25 01:27:30 -04:00
|
|
|
elif [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
./waf bootloader
|
2022-01-15 20:35:52 -04:00
|
|
|
else
|
2022-11-02 19:21:35 -03:00
|
|
|
./waf
|
2022-01-15 20:35:52 -04:00
|
|
|
fi
|
2023-02-25 01:27:30 -04:00
|
|
|
cp -r $BIN_SRC/* "$NO_VERSIONS_DIR"
|
2022-01-15 20:35:52 -04:00
|
|
|
|
2022-10-02 05:25:51 -03:00
|
|
|
echo [`date`] Built ${{ github.event.pull_request.base.ref }} with no versions
|
2022-01-15 20:35:52 -04:00
|
|
|
|
2023-11-21 17:29:41 -04:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-10 07:39:43 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
path: 'pr'
|
|
|
|
|
|
|
|
- name: Build PR rebased ${{matrix.config}} ${{ matrix.toolchain }}
|
|
|
|
env:
|
|
|
|
CI_BUILD_TARGET: ${{matrix.config}}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-02-25 01:27:30 -04:00
|
|
|
set -ex
|
|
|
|
# set up some variables based on what sort of build we're doing:
|
|
|
|
BOOTLOADER=0
|
|
|
|
AP_PERIPH=0
|
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
|
|
|
AP_PERIPH=1
|
2023-04-19 02:35:32 -03:00
|
|
|
elif [ "${{matrix.config}}" = "MatekF405-CAN" ] ||
|
|
|
|
[ "${{matrix.config}}" = "DrotekP3Pro" ]; then
|
2023-02-25 01:27:30 -04:00
|
|
|
BOOTLOADER=1
|
|
|
|
fi
|
|
|
|
if [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
BIN_SRC="build/${{matrix.config}}/bootloader"
|
|
|
|
else
|
|
|
|
BIN_SRC="build/${{matrix.config}}/bin"
|
|
|
|
fi
|
2023-02-03 13:45:49 -04:00
|
|
|
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
2021-02-10 07:39:43 -04:00
|
|
|
PATH="/github/home/.local/bin:$PATH"
|
|
|
|
cd pr/
|
|
|
|
git config user.email "ardupilot-ci@ardupilot.org"
|
|
|
|
git config user.name "ArduPilot CI"
|
2023-01-23 19:26:35 -04:00
|
|
|
git remote add target_repo https://github.com/${{github.event.pull_request.base.repo.full_name}}
|
|
|
|
git fetch --no-tags --prune --progress target_repo ${{ github.event.pull_request.base.ref }}
|
|
|
|
git rebase target_repo/${{ github.event.pull_request.base.ref }}
|
2021-02-10 07:39:43 -04:00
|
|
|
git submodule update --init --recursive --depth=1
|
2023-02-25 01:27:30 -04:00
|
|
|
# configure
|
|
|
|
if [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
./waf configure --board ${{matrix.config}} --bootloader
|
|
|
|
else
|
|
|
|
./waf configure --board ${{matrix.config}}
|
|
|
|
fi
|
|
|
|
# build
|
|
|
|
if [ $AP_PERIPH -eq 1 ]; then
|
2022-01-08 07:16:48 -04:00
|
|
|
./waf AP_Periph
|
2023-02-25 01:27:30 -04:00
|
|
|
elif [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
./waf bootloader
|
2022-01-08 07:16:48 -04:00
|
|
|
else
|
|
|
|
./waf
|
|
|
|
fi
|
2021-02-10 07:39:43 -04:00
|
|
|
mkdir $GITHUB_WORKSPACE/pr_bin
|
2023-02-25 01:27:30 -04:00
|
|
|
cp -r $BIN_SRC/* $GITHUB_WORKSPACE/pr_bin/
|
2021-02-10 07:39:43 -04:00
|
|
|
|
2022-01-15 20:35:52 -04:00
|
|
|
# build a set of binaries without symbols so we can check if
|
|
|
|
# the binaries have changed.
|
|
|
|
echo [`date`] Building PR with no versions
|
|
|
|
|
|
|
|
NO_VERSIONS_DIR="$GITHUB_WORKSPACE/pr_bin_no_versions"
|
|
|
|
mkdir "$NO_VERSIONS_DIR"
|
|
|
|
|
2023-02-25 01:27:30 -04:00
|
|
|
# export some environment variables designed to get
|
|
|
|
# repeatable builds from the same source:
|
|
|
|
export CHIBIOS_GIT_VERSION="12345678"
|
|
|
|
export GIT_VERSION="abcdef"
|
|
|
|
export GIT_VERSION_INT="15"
|
|
|
|
|
|
|
|
if [ $AP_PERIPH -eq 1 ]; then
|
|
|
|
./waf AP_Periph
|
|
|
|
elif [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
./waf bootloader
|
2022-01-15 20:35:52 -04:00
|
|
|
else
|
2023-02-25 01:27:30 -04:00
|
|
|
./waf
|
2022-01-15 20:35:52 -04:00
|
|
|
fi
|
2023-02-25 01:27:30 -04:00
|
|
|
cp -r $BIN_SRC/* "$NO_VERSIONS_DIR"
|
2022-01-15 20:35:52 -04:00
|
|
|
|
|
|
|
echo [`date`] Built PR with no versions
|
|
|
|
|
2021-09-13 23:51:51 -03:00
|
|
|
# build MatekF405 Plane without quadplane
|
|
|
|
if [ "${{matrix.config}}" = "MatekF405" ]; then
|
|
|
|
PLANE_BINARY="build/MatekF405/bin/arduplane.bin"
|
|
|
|
echo "normal size"
|
|
|
|
ls -l "$PLANE_BINARY"
|
|
|
|
EXTRA_HWDEF="/tmp/extra-options.def"
|
|
|
|
echo "define HAL_QUADPLANE_ENABLED 0" >"$EXTRA_HWDEF"
|
|
|
|
./waf configure --board ${{matrix.config}} --extra-hwdef="$EXTRA_HWDEF"
|
|
|
|
./waf plane
|
|
|
|
rm "$EXTRA_HWDEF"
|
|
|
|
echo "non-quadplane size:"
|
|
|
|
ls -l "$PLANE_BINARY"
|
|
|
|
fi
|
|
|
|
|
2022-10-02 05:25:51 -03:00
|
|
|
- name: Full size compare with base branch
|
2021-02-10 07:39:43 -04:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd pr/
|
2022-10-02 05:25:51 -03:00
|
|
|
Tools/scripts/pretty_diff_size.py -m $GITHUB_WORKSPACE/base_branch_bin -s $GITHUB_WORKSPACE/pr_bin
|
2021-10-07 01:34:48 -03:00
|
|
|
|
2022-10-04 00:20:53 -03:00
|
|
|
- name: Feature compare with ${{ github.event.pull_request.base.ref }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-02-10 10:26:17 -04:00
|
|
|
set -ex
|
2022-10-04 00:20:53 -03:00
|
|
|
cd pr/
|
2023-02-03 18:05:36 -04:00
|
|
|
BIN_PREFIX="arm-none-eabi-"
|
|
|
|
if [ "${{matrix.toolchain}}" = "armhf" ]; then
|
|
|
|
BIN_PREFIX="arm-linux-gnueabihf-"
|
|
|
|
fi
|
2023-02-25 01:27:30 -04:00
|
|
|
BOOTLOADER=0
|
|
|
|
AP_PERIPH=0
|
2023-02-09 19:04:09 -04:00
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
2023-02-25 01:27:30 -04:00
|
|
|
AP_PERIPH=1
|
2023-04-19 02:35:32 -03:00
|
|
|
elif [ "${{matrix.config}}" = "MatekF405-CAN" ] ||
|
|
|
|
[ "${{matrix.config}}" = "DrotekP3Pro" ]; then
|
2023-02-25 01:27:30 -04:00
|
|
|
BOOTLOADER=1
|
|
|
|
fi
|
|
|
|
if [ $AP_PERIPH -eq 1 ]; then
|
2023-02-09 19:04:09 -04:00
|
|
|
EF_BINARY_NAME="AP_Periph"
|
2023-02-25 01:27:30 -04:00
|
|
|
elif [ $BOOTLOADER -eq 1 ]; then
|
|
|
|
EF_BINARY_NAME="AP_Bootloader"
|
2023-02-09 19:04:09 -04:00
|
|
|
else
|
|
|
|
EF_BINARY_NAME="arduplane"
|
|
|
|
fi
|
|
|
|
EF_BASE_BRANCH_BINARY="$GITHUB_WORKSPACE/base_branch_bin/$EF_BINARY_NAME"
|
|
|
|
EF_PR_BRANCH_BINARY="$GITHUB_WORKSPACE/pr_bin/$EF_BINARY_NAME"
|
|
|
|
|
|
|
|
Tools/scripts/extract_features.py "$EF_BASE_BRANCH_BINARY" -nm "${BIN_PREFIX}nm" >features-base_branch.txt
|
|
|
|
Tools/scripts/extract_features.py "$EF_PR_BRANCH_BINARY" -nm "${BIN_PREFIX}nm" >features-pr.txt
|
2022-10-04 00:20:53 -03:00
|
|
|
diff -u features-base_branch.txt features-pr.txt || true
|
|
|
|
|
2022-10-02 05:25:51 -03:00
|
|
|
- name: Checksum compare with ${{ github.event.pull_request.base.ref }}
|
2022-01-15 20:35:52 -04:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-10-02 05:25:51 -03:00
|
|
|
diff -r $GITHUB_WORKSPACE/base_branch_bin_no_versions $GITHUB_WORKSPACE/pr_bin_no_versions --exclude=*.elf --exclude=*.apj || true
|