|
| 1 | +name: Sizes Test |
| 2 | + |
| 3 | +# The workflow will run labeled pull requests |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + types: [opened, reopened, synchronize, labeled] |
| 7 | + |
| 8 | +env: |
| 9 | + # It's convenient to set variables for values used multiple times in the workflow |
| 10 | + SKETCHES_REPORTS_PATH: sizes-report |
| 11 | + SKETCHES_REPORTS_ARTIFACT_NAME: sizes-report |
| 12 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 13 | + |
| 14 | +jobs: |
| 15 | + compile-sketch: |
| 16 | + if: | |
| 17 | + contains(github.event.pull_request.labels.*.name, 'sizes_test') |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + env: |
| 21 | + REPOSITORY: | |
| 22 | + - source-path: '.' |
| 23 | + name: "espressif:esp32" |
| 24 | +
|
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + target: |
| 28 | + - esp32 |
| 29 | + - esp32s2 |
| 30 | + - esp32c3 |
| 31 | + - esp32s3 |
| 32 | + - esp32c6 |
| 33 | + - esp32h2 |
| 34 | + |
| 35 | + include: |
| 36 | + - target: esp32 |
| 37 | + fqbn: espressif:esp32:esp32 |
| 38 | + - target: esp32s2 |
| 39 | + fqbn: espressif:esp32:esp32s2 |
| 40 | + - target: esp32c3 |
| 41 | + fqbn: espressif:esp32:esp32c3 |
| 42 | + - target: esp32s3 |
| 43 | + fqbn: espressif:esp32:esp32s3 |
| 44 | + - target: esp32c6 |
| 45 | + fqbn: espressif:esp32:esp32c6 |
| 46 | + - target: esp32h2 |
| 47 | + fqbn: espressif:esp32:esp32h2 |
| 48 | + |
| 49 | + |
| 50 | + steps: |
| 51 | + # This step makes the contents of the repository available to the workflow |
| 52 | + - name: Checkout repository |
| 53 | + uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: Compile sketch |
| 56 | + uses: P-R-O-C-H-Y/compile-sketches@sizes |
| 57 | + with: |
| 58 | + platforms: | |
| 59 | + ${{ env.REPOSITORY }} |
| 60 | + target: ${{ matrix.target }} |
| 61 | + fqbn: ${{ matrix.fqbn }} |
| 62 | + use-json-file: false |
| 63 | + enable-deltas-report: true |
| 64 | + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 65 | + enable-warnings-report: false |
| 66 | + cli-compile-flags: | |
| 67 | + - --warnings="all" |
| 68 | +
|
| 69 | + - name: Upload artifact |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-${{ matrix.target }} |
| 73 | + path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 74 | + |
| 75 | + report-comment: |
| 76 | + needs: compile-sketch # Wait for the compile job to finish to get the data for the report |
| 77 | + runs-on: ubuntu-latest |
| 78 | + steps: |
| 79 | + # Check out repository |
| 80 | + - name: Checkout repository |
| 81 | + uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + token: ${{ env.GITHUB_TOKEN }} |
| 84 | + fetch-depth: '0' |
| 85 | + |
| 86 | + # This step is needed to get the size data produced by the compile jobs |
| 87 | + - name: Download sketches reports artifact |
| 88 | + uses: actions/download-artifact@v4 |
| 89 | + with: |
| 90 | + pattern: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-* |
| 91 | + merge-multiple: true |
| 92 | + path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 93 | + |
| 94 | + - name: Report results |
| 95 | + uses: P-R-O-C-H-Y/report-size-deltas@sizes |
| 96 | + with: |
| 97 | + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} |
0 commit comments