-
Notifications
You must be signed in to change notification settings - Fork 17.7k
170 lines (153 loc) · 6.77 KB
/
test_size.yml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: test size
on: [pull_request]
# paths:
# - "*"
# - "!README.md" <-- don't rebuild on doc change
concurrency:
group: ci-${{github.workflow}}-${{ github.ref }}
cancel-in-progress: true
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,
Pixhawk1-1M,
Hitec-Airspeed, # see special code for Periph below (3 places!)
f103-GPS # see special code for Periph below (3 places!)
]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.ref }}
path: base_branch
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}}
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 }}
env:
CI_BUILD_TARGET: ${{matrix.config}}
shell: bash
run: |
PATH="/github/home/.local/bin:$PATH"
cd base_branch
./waf configure --board ${{matrix.config}}
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
[ "${{matrix.config}}" = "f103-GPS" ]; then
./waf AP_Periph
else
./waf
fi
mkdir -p $GITHUB_WORKSPACE/base_branch_bin
cp -r build/${{matrix.config}}/bin/* $GITHUB_WORKSPACE/base_branch_bin/
# build a set of binaries without symbols so we can check if
# the binaries have changed.
echo [`date`] Building ${{ github.event.pull_request.base.ref }} with no versions
NO_VERSIONS_DIR="$GITHUB_WORKSPACE/base_branch_bin_no_versions"
mkdir "$NO_VERSIONS_DIR"
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
[ "${{matrix.config}}" = "f103-GPS" ]; then
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf AP_Periph
else
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf
fi
cp -r build/${{matrix.config}}/bin/* "$NO_VERSIONS_DIR"
echo [`date`] Built ${{ github.event.pull_request.base.ref }} with no versions
- 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 "[email protected]"
git config user.name "ArduPilot CI"
git remote add ardupilot https://github.com/ArduPilot/ardupilot.git
git fetch --no-tags --prune --progress ardupilot ${{ github.event.pull_request.base.ref }}
git rebase ardupilot/${{ github.event.pull_request.base.ref }}
git submodule update --init --recursive --depth=1
./waf configure --board ${{matrix.config}}
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
[ "${{matrix.config}}" = "f103-GPS" ]; then
./waf AP_Periph
else
./waf
fi
mkdir $GITHUB_WORKSPACE/pr_bin
cp -r build/${{matrix.config}}/bin/* $GITHUB_WORKSPACE/pr_bin/
# 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
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf AP_Periph
else
CHIBIOS_GIT_VERSION="12345678" GIT_VERSION="abcdef" GIT_VERSION_INT="15" ./waf
fi
cp -r build/${{matrix.config}}/bin/* "$NO_VERSIONS_DIR"
echo [`date`] Built PR with no versions
# 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
- name: Full size compare with base branch
shell: bash
run: |
cd pr/
python3 -m pip install -U tabulate
Tools/scripts/pretty_diff_size.py -m $GITHUB_WORKSPACE/base_branch_bin -s $GITHUB_WORKSPACE/pr_bin
- name: Checksum compare with ${{ github.event.pull_request.base.ref }}
shell: bash
run: |
diff -r $GITHUB_WORKSPACE/base_branch_bin_no_versions $GITHUB_WORKSPACE/pr_bin_no_versions --exclude=*.elf --exclude=*.apj || true
- name: elf_diff compare with ${{ github.event.pull_request.base.ref }}
shell: bash
run: |
python3 -m pip install -U weasyprint elf_diff anytree
mkdir elf_diff
if [ "${{matrix.config}}" = "Hitec-Airspeed" ] ||
[ "${{matrix.config}}" = "f103-GPS" ]; then
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
else
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
fi
zip -r elf_diff.zip elf_diff
- name: Archive elf_diff output
uses: actions/upload-artifact@v2
with:
name: ELF_DIFF_${{matrix.config}}
path: elf_diff.zip
retention-days: 14