forked from numworks/epsilon
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (57 loc) · 3.51 KB
/
metrics.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
name: Metrics
on: [pull_request_target]
env:
MAKEFLAGS: ${{ (github.repository == 'numworks/epsilon-internal') && '-j32' || '-j2' }} EMBED_EXTRA_DATA=1
jobs:
binary-size:
runs-on: ${{ (github.repository == 'numworks/epsilon-internal') && 'self-hosted' || 'ubuntu-latest' }}
steps:
- name: Install ARM toolchain
uses: numworks/setup-arm-toolchain@latest
- name: Fetch target branch and PR branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find most recent ancestor of PR and target branch
id: common_ancestor
run: echo "commit_sha=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
- name: Checkout to most recent ancestor
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
submodules: true
ref: ${{ steps.common_ancestor.outputs.commit_sha }}
path: base
- name: Install dependencies
run: cd base && build/setup.sh
- name: Build common ancestor for N0110
# build the largest target
run: cd base && make bootloader.elf && make kernel.onboarding.beta.allow3rdparty.A.elf && make userland.onboarding.beta.allow3rdparty.A.elf
- name: Find head of PR
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
path: head
- name: Install dependencies
run: cd head && build/setup.sh
- name: Build head for N0110
run: cd head && make bootloader.elf && make kernel.onboarding.beta.allow3rdparty.A.elf && make userland.onboarding.beta.allow3rdparty.A.elf
- name: Binary size summary
id: binary_size_summary
run: echo "table=$(head/.venv/bin/python3 head/build/metrics/binary_size.py @Base base/output/release/device/n0110/kernel/kernel.onboarding.beta.allow3rdparty.A.elf base/output/release/device/n0110/userland/userland.onboarding.beta.allow3rdparty.A.elf @Head head/output/release/device/n0110/kernel/kernel.onboarding.beta.allow3rdparty.A.elf head/output/release/device/n0110/userland/userland.onboarding.beta.allow3rdparty.A.elf --sections @Flash .text .rodata .data @RAM .bss .data --summarize)" >> $GITHUB_OUTPUT
- name: Binary size N0110
id: binary_size_n0110
run: echo "table=$(head/.venv/bin/python3 head/build/metrics/binary_size.py @Base base/output/release/device/n0110/bootloader/bootloader.elf base/output/release/device/n0110/kernel/kernel.onboarding.beta.allow3rdparty.A.elf base/output/release/device/n0110/userland/userland.onboarding.beta.allow3rdparty.A.elf @Head head/output/release/device/n0110/bootloader/bootloader.elf head/output/release/device/n0110/kernel/kernel.onboarding.beta.allow3rdparty.A.elf head/output/release/device/n0110/userland/userland.onboarding.beta.allow3rdparty.A.elf --sections .text .rodata .bss .data)" >> $GITHUB_OUTPUT
- name: Add comment
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `# Binary size analysis\n\n${{ steps.binary_size_summary.outputs.table }}\n<details>\n<summary>Full details</summary>\n\n## N0110\n\n${{ steps.binary_size_n0110.outputs.table }}</details>`,
});