1name: Footprint Delta
2
3on: pull_request
4
5concurrency:
6  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
7  cancel-in-progress: true
8
9jobs:
10  footprint-delta:
11    runs-on: ubuntu-22.04
12    if: github.repository == 'zephyrproject-rtos/zephyr'
13    container:
14      image: ghcr.io/zephyrproject-rtos/ci:v0.26.4
15      options: '--entrypoint /bin/bash'
16    strategy:
17      fail-fast: false
18    env:
19      ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1
20      ZEPHYR_TOOLCHAIN_VARIANT: zephyr
21    steps:
22      - name: Apply container owner mismatch workaround
23        run: |
24          # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
25          #        match the container user UID because of the way GitHub
26          #        Actions runner is implemented. Remove this workaround when
27          #        GitHub comes up with a fundamental fix for this problem.
28          git config --global --add safe.directory ${GITHUB_WORKSPACE}
29
30      - name: Update PATH for west
31        run: |
32          echo "$HOME/.local/bin" >> $GITHUB_PATH
33
34      - name: checkout
35        uses: actions/checkout@v3
36        with:
37          ref: ${{ github.event.pull_request.head.sha }}
38          fetch-depth: 0
39
40      - name: west setup
41        run: |
42          west init -l . || true
43          west config --global update.narrow true
44          west update 2>&1 1> west.update.log || west update 2>&1 1> west.update.log
45
46      - name: Detect Changes in Footprint
47        env:
48          BASE_REF: ${{ github.base_ref }}
49        run: |
50          export ZEPHYR_BASE=${PWD}
51          git config --global user.email "actions@zephyrproject.org"
52          git config --global user.name "Github Actions"
53          git remote -v
54          git rebase origin/${BASE_REF}
55          git checkout -b this_pr
56          west update
57          west build -b frdm_k64f  tests/benchmarks/footprints -t ram_report
58          cp build/ram.json ram2.json
59          west build -b frdm_k64f  tests/benchmarks/footprints -t rom_report
60          cp build/rom.json rom2.json
61
62          git checkout origin/${BASE_REF}
63          west update
64          west build -p always -b frdm_k64f  tests/benchmarks/footprints -t ram_report
65          west build -b frdm_k64f  tests/benchmarks/footprints -t rom_report
66          cp build/ram.json ram1.json
67          cp build/rom.json rom1.json
68
69          git checkout this_pr
70          ./scripts/footprint/fpdiff.py ram1.json ram2.json
71          ./scripts/footprint/fpdiff.py rom1.json rom2.json
72