2021-02-10 07:39:43 -04:00
|
|
|
name: test size
|
|
|
|
|
2022-10-07 19:26:08 -03:00
|
|
|
on: [pull_request]
|
2021-02-10 07:39:43 -04:00
|
|
|
# paths:
|
|
|
|
# - "*"
|
|
|
|
# - "!README.md" <-- don't rebuild on doc change
|
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:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
container: ardupilot/ardupilot-dev-chibios:latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # don't cancel if a job from the matrix fails
|
|
|
|
matrix:
|
|
|
|
toolchain: [
|
|
|
|
base, # GCC
|
|
|
|
]
|
|
|
|
config: [
|
|
|
|
Durandal,
|
|
|
|
MatekF405,
|
2022-01-08 07:16:48 -04:00
|
|
|
Pixhawk1-1M,
|
|
|
|
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
|
|
|
]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
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")
|
|
|
|
echo "::set-output name=timestamp::${NOW}"
|
|
|
|
- name: ccache cache files
|
|
|
|
uses: actions/cache@v2
|
|
|
|
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
|
|
|
|
- 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: |
|
|
|
|
PATH="/github/home/.local/bin:$PATH"
|
2022-10-02 05:25:51 -03:00
|
|
|
cd base_branch
|
2021-02-10 07:39:43 -04:00
|
|
|
./waf configure --board ${{matrix.config}}
|
2022-01-08 07:16:48 -04:00
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
|
|
|
./waf AP_Periph
|
|
|
|
else
|
|
|
|
./waf
|
|
|
|
fi
|
2022-10-02 05:25:51 -03:00
|
|
|
mkdir -p $GITHUB_WORKSPACE/base_branch_bin
|
|
|
|
cp -r build/${{matrix.config}}/bin/* $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"
|
|
|
|
|
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
2022-04-09 11:36:38 -03:00
|
|
|
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf AP_Periph
|
2022-01-15 20:35:52 -04:00
|
|
|
else
|
2022-04-09 11:36:38 -03:00
|
|
|
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf
|
2022-01-15 20:35:52 -04:00
|
|
|
fi
|
|
|
|
cp -r build/${{matrix.config}}/bin/* "$NO_VERSIONS_DIR"
|
|
|
|
|
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
|
|
|
|
2021-02-10 07:39:43 -04:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
path: 'pr'
|
|
|
|
|
|
|
|
- name: Build PR rebased ${{matrix.config}} ${{ matrix.toolchain }}
|
|
|
|
env:
|
|
|
|
CI_BUILD_TARGET: ${{matrix.config}}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
PATH="/github/home/.local/bin:$PATH"
|
|
|
|
cd pr/
|
|
|
|
git config user.email "ardupilot-ci@ardupilot.org"
|
|
|
|
git config user.name "ArduPilot CI"
|
|
|
|
git remote add ardupilot https://github.com/ArduPilot/ardupilot.git
|
2022-10-02 05:25:51 -03:00
|
|
|
git fetch --no-tags --prune --progress ardupilot ${{ github.event.pull_request.base.ref }}
|
|
|
|
git rebase ardupilot/${{ github.event.pull_request.base.ref }}
|
2021-02-10 07:39:43 -04:00
|
|
|
git submodule update --init --recursive --depth=1
|
|
|
|
./waf configure --board ${{matrix.config}}
|
2022-01-08 07:16:48 -04:00
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
|
|
|
./waf AP_Periph
|
|
|
|
else
|
|
|
|
./waf
|
|
|
|
fi
|
2021-02-10 07:39:43 -04:00
|
|
|
mkdir $GITHUB_WORKSPACE/pr_bin
|
|
|
|
cp -r build/${{matrix.config}}/bin/* $GITHUB_WORKSPACE/pr_bin/
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
2022-04-09 11:36:38 -03:00
|
|
|
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf AP_Periph
|
2022-01-15 20:35:52 -04:00
|
|
|
else
|
2022-04-09 11:36:38 -03:00
|
|
|
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf
|
2022-01-15 20:35:52 -04:00
|
|
|
fi
|
|
|
|
cp -r build/${{matrix.config}}/bin/* "$NO_VERSIONS_DIR"
|
|
|
|
|
|
|
|
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/
|
|
|
|
python3 -m pip install -U tabulate
|
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-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
|
2022-01-15 20:35:52 -04:00
|
|
|
|
2022-10-02 05:25:51 -03:00
|
|
|
- name: elf_diff compare with ${{ github.event.pull_request.base.ref }}
|
2021-10-07 01:34:48 -03:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-11-05 20:09:36 -03:00
|
|
|
python3 -m pip install -U weasyprint elf_diff anytree
|
2021-11-04 05:46:58 -03:00
|
|
|
mkdir elf_diff
|
2022-01-08 07:16:48 -04:00
|
|
|
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
|
|
|
|
[ "${{matrix.config}}" = "f103-GPS" ]; then
|
2022-10-02 05:25:51 -03:00
|
|
|
python3 -m elf_diff --bin_prefix=arm-none-eabi- --html_dir=elf_diff/AP_Periph $GITHUB_WORKSPACE/base_branch_bin/AP_Periph $GITHUB_WORKSPACE/pr_bin/AP_Periph
|
2022-01-08 07:16:48 -04:00
|
|
|
else
|
2022-10-02 05:25:51 -03:00
|
|
|
python3 -m elf_diff --bin_prefix=arm-none-eabi- --html_dir=elf_diff/plane $GITHUB_WORKSPACE/base_branch_bin/arduplane $GITHUB_WORKSPACE/pr_bin/arduplane
|
|
|
|
python3 -m elf_diff --bin_prefix=arm-none-eabi- --html_dir=elf_diff/copter $GITHUB_WORKSPACE/base_branch_bin/arducopter $GITHUB_WORKSPACE/pr_bin/arducopter
|
2022-01-08 07:16:48 -04:00
|
|
|
fi
|
2021-12-09 04:54:00 -04:00
|
|
|
zip -r elf_diff.zip elf_diff
|
2021-10-07 01:34:48 -03:00
|
|
|
|
|
|
|
- name: Archive elf_diff output
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-11-04 05:46:58 -03:00
|
|
|
name: ELF_DIFF_${{matrix.config}}
|
2021-12-09 04:54:00 -04:00
|
|
|
path: elf_diff.zip
|
2021-10-07 01:34:48 -03:00
|
|
|
retention-days: 14
|