mirror of
https://github.com/Tencent/ncnn.git
synced 2026-10-27 11:17:39 +08:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
101 lines
3.2 KiB
YAML
101 lines
3.2 KiB
YAML
name: compare-binary-size
|
|
on:
|
|
pull_request:
|
|
branches: [master]
|
|
paths:
|
|
- '.github/workflows/compare-binary-size.yml'
|
|
- 'toolchains/**'
|
|
- 'CMakeLists.txt'
|
|
- 'cmake/**'
|
|
- 'src/**'
|
|
- 'glslang'
|
|
|
|
concurrency:
|
|
group: compare-binary-size-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
|
|
jobs:
|
|
compare-size:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout-pr-branch
|
|
uses: actions/checkout@v7
|
|
with:
|
|
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
|
submodules: true
|
|
path: pr
|
|
|
|
- name: checkout-base-branch
|
|
uses: actions/checkout@v7
|
|
with:
|
|
ref: ${{ github.event.pull_request.base.ref }}
|
|
repository: ${{ github.event.pull_request.base.repo.full_name }}
|
|
submodules: true
|
|
path: base
|
|
|
|
- name: install-toolchain
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install g++-arm-linux-gnueabihf g++-aarch64-linux-gnu
|
|
|
|
- name: compare-sizes
|
|
env:
|
|
COMMON_CMAKE_ARGS: -DNCNN_SHARED_LIB=ON -DNCNN_VULKAN=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF
|
|
run: |
|
|
# define target architectures
|
|
archs=("x86_64" "armhf" "aarch64")
|
|
|
|
# generate table
|
|
echo "The binary size change of libncnn.so (bytes)" >> compare-binary-size.md
|
|
echo "| architecture | base size | pr size | difference |" >> compare-binary-size.md
|
|
echo "|--------------|-----------|---------|------------|" >> compare-binary-size.md
|
|
|
|
for arch in "${archs[@]}"; do
|
|
|
|
mkdir -p pr/build_$arch
|
|
pushd pr/build_$arch
|
|
if [ "$arch" = "armhf" ]; then
|
|
cmake ${{env.COMMON_CMAKE_ARGS}} -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabihf.toolchain.cmake ..
|
|
elif [ "$arch" = "aarch64" ]; then
|
|
cmake ${{env.COMMON_CMAKE_ARGS}} -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.toolchain.cmake ..
|
|
else
|
|
cmake ${{env.COMMON_CMAKE_ARGS}} ..
|
|
fi
|
|
cmake --build . -j $(nproc)
|
|
PR_SIZE=$(stat -c%s $(readlink -f src/libncnn.so))
|
|
popd
|
|
|
|
mkdir -p base/build_$arch
|
|
pushd base/build_$arch
|
|
if [ "$arch" = "armhf" ]; then
|
|
cmake ${{env.COMMON_CMAKE_ARGS}} -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabihf.toolchain.cmake ..
|
|
elif [ "$arch" = "aarch64" ]; then
|
|
cmake ${{env.COMMON_CMAKE_ARGS}} -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.toolchain.cmake ..
|
|
else
|
|
cmake ${{env.COMMON_CMAKE_ARGS}} ..
|
|
fi
|
|
cmake --build . -j $(nproc)
|
|
BASE_SIZE=$(stat -c%s $(readlink -f src/libncnn.so))
|
|
popd
|
|
|
|
DIFF=$(($PR_SIZE - $BASE_SIZE))
|
|
if [ $DIFF -gt 0 ]; then
|
|
DIFF_STR="+$DIFF :warning:"
|
|
else
|
|
DIFF_STR="$DIFF :kissing_heart:"
|
|
fi
|
|
|
|
echo "| $arch | $BASE_SIZE | $PR_SIZE | $DIFF_STR |" >> compare-binary-size.md
|
|
done
|
|
|
|
cat compare-binary-size.md
|
|
|
|
- name: upload-compare-binary-size-md
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: compare-binary-size.md
|
|
path: compare-binary-size.md
|