Skip to content

Dataflow Engine Binary Size Tracking #191

Dataflow Engine Binary Size Tracking

Dataflow Engine Binary Size Tracking #191

name: Dataflow Engine Binary Size Tracking
permissions:
contents: read
on:
workflow_dispatch:
schedule:
# Run daily at 00:00 UTC
- cron: "0 0 * * *"
jobs:
build-multiarch:
strategy:
fail-fast: false
matrix:
platform:
- name: linux-amd64
runner: ubuntu-24.04
docker-platform: linux/amd64
rustflags: "-C target-cpu=x86-64 -C strip=symbols"
- name: linux-arm64
runner: ubuntu-24.04-arm
docker-platform: linux/arm64
rustflags: "-C target-cpu=generic -C strip=symbols"
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Build dataflow_engine for ${{ matrix.platform.name }}
run: |
git submodule init
git submodule update
cd rust/otap-dataflow
docker buildx build \
--platform ${{ matrix.platform.docker-platform }} \
--build-context otel-arrow=../../ \
--build-arg RUSTFLAGS="${{ matrix.platform.rustflags }}" \
-f Dockerfile \
-t df_engine:${{ matrix.platform.name }} \
--load \
.
cd ../..
- name: Get binary size and create report
run: |
cid=$(docker create df_engine:${{ matrix.platform.name }})
SIZE_MB=$(docker cp "$cid":/home/nonroot/df_engine - | wc -c | numfmt --to-unit=1048576 --format='%.2f')
docker container rm "$cid"
echo "Binary size for ${{ matrix.platform.name }}: $SIZE_MB MB"
mkdir -p size-reports
cat > size-reports/${{ matrix.platform.name }}.json << EOF
[
{
"name": "${{ matrix.platform.name }}-binary-size",
"unit": "MB",
"value": $SIZE_MB
}
]
EOF
- name: Upload size report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: size-report-${{ matrix.platform.name }}
path: size-reports/${{ matrix.platform.name }}.json
summary:
runs-on: ubuntu-24.04
needs: build-multiarch
if: always()
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download all size reports
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: size-report-*
merge-multiple: true
path: all-reports
- name: Consolidate and display results
run: |
# Merge all JSON files into a single array using jq
jq -s 'map(.[0])' all-reports/*.json > consolidated-sizes.json
echo "## Dataflow Engine Binary Size"
echo "| Platform | Size |"
echo "|----------|------|"
for json in all-reports/*.json; do
PLATFORM=$(jq -r '.[0].name' "$json" | sed 's/-binary-size//')
SIZE_MB=$(jq -r '.[0].value' "$json")
echo "| $PLATFORM | ${SIZE_MB} MB |"
done
- name: Update binary size benchmarks
uses: benchmark-action/github-action-benchmark@a60cea5bc7b49e15c1f58f411161f99e0df48372 # v1.22.0
with:
tool: "customSmallerIsBetter"
output-file-path: consolidated-sizes.json
gh-pages-branch: benchmarks
github-token: ${{ secrets.GITHUB_TOKEN }}
benchmark-data-dir-path: "docs/benchmarks/binary-size"
auto-push: ${{ github.event_name == 'schedule' }}
comment-on-alert: true
alert-threshold: "110%"