forked from open-telemetry/otel-arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataflow-engine-binary-size.yml
More file actions
121 lines (108 loc) · 4.16 KB
/
dataflow-engine-binary-size.yml
File metadata and controls
121 lines (108 loc) · 4.16 KB
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
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@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
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: |
SIZE=$(docker run --rm --entrypoint stat df_engine:${{ matrix.platform.name }} -c %s /home/dataflow/df_engine)
SIZE_HR=$(numfmt --to=iec-i --suffix=B $SIZE)
SIZE_MB=$(echo "scale=2; $SIZE / 1048576" | bc)
echo "Binary size for ${{ matrix.platform.name }}: $SIZE_HR ($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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
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%"