From 44f715213fdb8876da6a9cf21777c340422ed760 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Thu, 15 Aug 2024 01:07:34 -0600 Subject: [PATCH] Add revised Memory deltas workflow (#1239) * Initial test * Fix syntax * Fix platform names * Fix platforms order * Add sketch-paths * Add verbose * Disable fail fast * Attempt compile only top level file * Update compile-sketches action version * Try mega2560 compile with native core * Try blank source-url * Change to array for platform * Change formatting * Last try * Use scalar multiline strings for paltform * Use string literals for newline * Formatting * Try mega2560 without library * Add stm32f407 * Add library board property * Fixes * Fix mega platform * Change Time to TimeLib * Try different escaping * Use individual lines for build extra-flags * Try without escaping * Try only single build flag * Add 2nd -D for mega * Add all mega build options back * Match stm32 build option format * Remove HWSERIAL 2 and 3 for stm32 * Lock stm32 to v2.7.1 * Enable reporting on PR * Disable verbose * Add workflow name * Dummy test data to verify memory change * Revert "Dummy test data to verify memory change" This reverts commit e83609ec9ef93c15dabeedc48d4d7464d30e0813. * Dummy memory increase for Teensy and stm32 * Revert "Dummy memory increase for Teensy and stm32" This reverts commit 830b255e75fa70cd8c20d4e935f78e582b2d27de. * Only run on PRs * Revert "Only run on PRs" This reverts commit 24d61e50698aa3c8942e6ece674712c61d6158ec. * Split memory deltas workflow into calculating and reporting * Force v3 of upload-artifact * Lock report deltas version * Use latest example as reference --- .../workflows/pr-memory-deltas-generate.yml | 90 +++++++++++++++++++ .../workflows/pr-memory-deltas-report.yaml | 24 +++++ 2 files changed, 114 insertions(+) create mode 100644 .github/workflows/pr-memory-deltas-generate.yml create mode 100644 .github/workflows/pr-memory-deltas-report.yaml diff --git a/.github/workflows/pr-memory-deltas-generate.yml b/.github/workflows/pr-memory-deltas-generate.yml new file mode 100644 index 00000000..60ad1abc --- /dev/null +++ b/.github/workflows/pr-memory-deltas-generate.yml @@ -0,0 +1,90 @@ +name: Calculate memory deltas + +on: + - push + - pull_request + +env: + # It's convenient to set variables for values used multiple times in the workflow. + SKETCHES_REPORTS_PATH: sketches-reports + +jobs: + compile: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + board: + # Each element in the sequence produces a matrix job: + - fqbn: arduino:avr:mega + # This suffix will be used to define a unique name for the sketches report artifact. + artifact-name-suffix: arduino-avr-mega + family-name: arduino:avr + platform: | + - name: arduino:avr + compile-flags: | + - --build-property + - build.extra_flags=-DPLATFORMIO -DUSE_LIBDIVIDE -O3 -ffast-math -fshort-enums -funroll-loops -Wall -Wextra -std=c99 + lib_deps: | + - name: Time + - fqbn: teensy:avr:teensy35 + artifact-name-suffix: teensy-avr-teensy35 + platform: | + - source-url: https://www.pjrc.com/teensy/package_teensy_index.json + name: teensy:avr + compile-flags: | + - --build-property + - build..extra_flags="-Wall" + lib_deps: | + - name: SDfat + - fqbn: teensy:avr:teensy41 + artifact-name-suffix: teensy-avr-teensy41 + platform: | + - source-url: https://www.pjrc.com/teensy/package_teensy_index.json + name: teensy:avr + compile-flags: | + - --build-property + - build..extra_flags="-Wall" + lib_deps: | + - name: SDfat + - fqbn: STMicroelectronics:stm32:GenF4 + artifact-name-suffix: stm32-avr-stm32f4 + platform: | + - source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json + name: STMicroelectronics:stm32 + version: 2.7.1 + compile-flags: | + - --build-property + - build.extra_flags=-DUSE_LIBDIVIDE -DUSBCON -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED -DHAL_CAN_MODULE_ENABLED -DSERIAL_TX_BUFFER_SIZE=128 -DSERIAL_RX_BUFFER_SIZE=128 -std=gnu++11 -UBOARD_MAX_IO_PINS + lib_deps: | + - name: "STM32duino RTC" + version: 1.2.0 + - name: SdFat + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Compile platforms + uses: arduino/compile-sketches@v1.1.2 + with: + fqbn: ${{ matrix.board.fqbn }} + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + github-token: ${{ secrets.GITHUB_TOKEN }} + sketch-paths: | + - speeduino/speeduino.ino + platforms: | + ${{ matrix.board.platform }} + cli-compile-flags: | + ${{ matrix.board.compile-flags }} + libraries: | + ${{ matrix.board.lib_deps }} + + # This step is needed to pass the size data to the report job. + - name: Upload sketches report to workflow artifact + uses: actions/upload-artifact@v4 + with: + name: sketches-report-${{ matrix.board.artifact-name-suffix }} + path: ${{ env.SKETCHES_REPORTS_PATH }} \ No newline at end of file diff --git a/.github/workflows/pr-memory-deltas-report.yaml b/.github/workflows/pr-memory-deltas-report.yaml new file mode 100644 index 00000000..7840f216 --- /dev/null +++ b/.github/workflows/pr-memory-deltas-report.yaml @@ -0,0 +1,24 @@ +name: Report Size Deltas + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/pr-memory-deltas-report.yaml" + schedule: + # Run at the minimum interval allowed by GitHub Actions. + # Note: GitHub Actions periodically has outages which result in workflow failures. + # In this event, the workflows will start passing again once the service recovers. + - cron: "*/5 * * * *" + workflow_dispatch: + repository_dispatch: + +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 sketch compilation workflow + sketches-reports-source: ^sketches-report-.+ \ No newline at end of file