From 836771a7a4a2d49758bf7e977f68fa2b124a5941 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 21 Feb 2024 06:41:49 +0100 Subject: [PATCH] Fix regression: report size delta size on PR. (#429) The necessary steps have in fact been documented here: https://github.com/arduino/report-size-deltas/blob/main/docs/FAQ.md#workflow-triggered-by-pull_request-event but I have overlooked them when I fixed the upload issue. With this PR the size deltas are - once again - reported within the PR. --- .github/workflows/compile-examples.yml | 26 ++++++++++++++++++++++-- .github/workflows/report-size-deltas.yml | 14 ------------- .gitignore | 1 + 3 files changed, 25 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 46837b40..e482cfec 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -12,8 +12,12 @@ on: - "examples/**" - "src/**" +env: + # It's convenient to set variables for values used multiple times in the workflow. + SKETCHES_REPORTS_PATH: sketches-reports + jobs: - build: + compile: runs-on: ubuntu-latest env: @@ -31,7 +35,6 @@ jobs: - examples/ArduinoIoTCloud-Callbacks - examples/ArduinoIoTCloud-Schedule - examples/utility/ArduinoIoTCloud_Travis_CI - SKETCHES_REPORTS_PATH: sketches-reports strategy: fail-fast: false @@ -292,9 +295,28 @@ jobs: google-key-file: ${{ secrets.GOOGLE_KEY_FILE }} spreadsheet-id: 1I6NZkpZpf8KugBkE92adB1Z3_b7ZepOpCdYTOigJpN4 + # This step is needed to pass the size data to the report job. - name: Save memory usage change report as artifact if: github.event_name == 'pull_request' uses: actions/upload-artifact@v4 with: name: sketches-report-${{ matrix.board.artifact-name-suffix }} path: ${{ env.SKETCHES_REPORTS_PATH }} + + # When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report + report: + needs: compile # Wait for the compile job to finish to get the data for the report + if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request + runs-on: ubuntu-latest + + steps: + # This step is needed to get the size data produced by the compile jobs + - name: Download sketches reports artifacts + uses: actions/download-artifact@v4 + with: + # All workflow artifacts will be downloaded to this location. + path: ${{ env.SKETCHES_REPORTS_PATH }} + + - uses: arduino/report-size-deltas@v1 + with: + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml deleted file mode 100644 index 9b0f2cdb..00000000 --- a/.github/workflows/report-size-deltas.yml +++ /dev/null @@ -1,14 +0,0 @@ -on: - schedule: - - cron: '*/5 * * * *' - -jobs: - report: - runs-on: ubuntu-latest - - steps: - - name: Comment size deltas reports to PRs - uses: arduino/report-size-deltas@v1 - with: - # The name of the workflow artifact created by the "Compile Examples" workflow - sketches-reports-source: sketches-reports diff --git a/.gitignore b/.gitignore index 16e30d98..7704f888 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.orig .vs build +.idea/