summaryrefslogtreecommitdiff
path: root/.github/workflows/code_size.yml
blob: aed416767883d544864b1786e9681c65231f2655 (plain)
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
name: Check code size

on:
  pull_request:
    paths:
      - '.github/workflows/*.yml'
      - 'tools/**'
      - 'py/**'
      - 'extmod/**'
      - 'shared/**'
      - 'lib/**'
      - 'ports/bare-arm/**'
      - 'ports/mimxrt/**'
      - 'ports/minimal/**'
      - 'ports/rp2/**'
      - 'ports/samd/**'
      - 'ports/stm32/**'
      - 'ports/unix/**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 100
    - name: Install packages
      run: tools/ci.sh code_size_setup
    - name: Build
      run: tools/ci.sh code_size_build
    - name: Compute code size difference
      run: source tools/ci.sh && ci_code_size_report
    - name: Save PR number
      if: github.event_name == 'pull_request'
      env:
        PR_NUMBER: ${{ github.event.number }}
      run: echo $PR_NUMBER > pr_number
    - name: Upload diff
      if: github.event_name == 'pull_request'
      uses: actions/upload-artifact@v4
      with:
        name: code-size-report
        path: |
          diff
          pr_number
        retention-days: 1