From 49f78620b80ac592a5ec5bede6695e66ebdca98d Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:29:44 +0100 Subject: [PATCH 01/31] feat(eth): Support phy address auto detection --- libraries/Ethernet/src/ETH.cpp | 10 +++++----- libraries/Ethernet/src/ETH.h | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index 11d5d3cdea3..ca1eca3b82b 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -82,7 +82,7 @@ bool ETHClass::ethDetachBus(void * bus_pointer){ } #if CONFIG_ETH_USE_ESP32_EMAC -bool ETHClass::begin(eth_phy_type_t type, uint8_t phy_addr, int mdc, int mdio, int power, eth_clock_mode_t clock_mode) +bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, int power, eth_clock_mode_t clock_mode) { esp_err_t ret = ESP_OK; if(_esp_netif != NULL){ @@ -168,7 +168,7 @@ bool ETHClass::begin(eth_phy_type_t type, uint8_t phy_addr, int mdc, int mdio, i esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy); ret = esp_eth_driver_install(ð_config, &_eth_handle); if(ret != ESP_OK){ - log_e("SPI Ethernet driver install failed: %d", ret); + log_e("Ethernet driver install failed: %d", ret); return false; } if(_eth_handle == NULL){ @@ -340,7 +340,7 @@ esp_err_t ETHClass::eth_spi_write(uint32_t cmd, uint32_t addr, const void *data, } #endif -bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, int rst, +bool ETHClass::beginSPI(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, #if ETH_SPI_SUPPORTS_CUSTOM SPIClass *spi, #endif @@ -625,13 +625,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, } #if ETH_SPI_SUPPORTS_CUSTOM -bool ETHClass::begin(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz){ +bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz){ return beginSPI(type, phy_addr, cs, irq, rst, &spi, -1, -1, -1, SPI2_HOST, spi_freq_mhz); } #endif -bool ETHClass::begin(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, int rst, spi_host_device_t spi_host, int sck, int miso, int mosi, uint8_t spi_freq_mhz){ +bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, spi_host_device_t spi_host, int sck, int miso, int mosi, uint8_t spi_freq_mhz){ return beginSPI(type, phy_addr, cs, irq, rst, #if ETH_SPI_SUPPORTS_CUSTOM diff --git a/libraries/Ethernet/src/ETH.h b/libraries/Ethernet/src/ETH.h index 7159ebd4574..e3c28154932 100644 --- a/libraries/Ethernet/src/ETH.h +++ b/libraries/Ethernet/src/ETH.h @@ -87,6 +87,8 @@ typedef enum { ETH_CLOCK_GPIO0_IN, ETH_CLOCK_GPIO0_OUT, ETH_CLOCK_GPIO16_OUT, ET #define ETH_PHY_SPI_FREQ_MHZ 20 #endif /* ETH_PHY_SPI_FREQ_MHZ */ +#define ETH_PHY_ADDR_AUTO ESP_ETH_PHY_ADDR_AUTO + typedef enum { #if CONFIG_ETH_USE_ESP32_EMAC ETH_PHY_LAN8720, ETH_PHY_TLK110, ETH_PHY_RTL8201, ETH_PHY_DP83848, ETH_PHY_KSZ8041, ETH_PHY_KSZ8081, @@ -109,12 +111,12 @@ class ETHClass { ~ETHClass(); #if CONFIG_ETH_USE_ESP32_EMAC - bool begin(eth_phy_type_t type, uint8_t phy_addr, int mdc, int mdio, int power, eth_clock_mode_t clk_mode); + bool begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, int power, eth_clock_mode_t clk_mode); #endif /* CONFIG_ETH_USE_ESP32_EMAC */ #if ETH_SPI_SUPPORTS_CUSTOM - bool begin(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz=ETH_PHY_SPI_FREQ_MHZ); + bool begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, SPIClass &spi, uint8_t spi_freq_mhz=ETH_PHY_SPI_FREQ_MHZ); #endif - bool begin(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, int rst, spi_host_device_t spi_host, int sck=-1, int miso=-1, int mosi=-1, uint8_t spi_freq_mhz=ETH_PHY_SPI_FREQ_MHZ); + bool begin(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, spi_host_device_t spi_host, int sck=-1, int miso=-1, int mosi=-1, uint8_t spi_freq_mhz=ETH_PHY_SPI_FREQ_MHZ); bool begin(){ #if defined(ETH_PHY_TYPE) && defined(ETH_PHY_ADDR) @@ -208,7 +210,7 @@ class ETHClass { #endif /* CONFIG_ETH_USE_ESP32_EMAC */ static bool ethDetachBus(void * bus_pointer); - bool beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, int rst, + bool beginSPI(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, int rst, #if ETH_SPI_SUPPORTS_CUSTOM SPIClass * spi, #endif From c6ecba0d15da7957f1c22b6789b9ba88286deb10 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:40:10 +0100 Subject: [PATCH 02/31] fix(eth): add phy_address check --- libraries/Ethernet/src/ETH.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index ca1eca3b82b..f60ed55e3aa 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -88,6 +88,10 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i if(_esp_netif != NULL){ return true; } + if(phy_addr < ETH_PHY_ADDR_AUTO){ + log_e("Invalid PHY address: %d, set to ETH_PHY_ADDR_AUTO for auto detection", phy_addr); + return false; + } perimanSetBusDeinit(ESP32_BUS_TYPE_ETHERNET_RMII, ETHClass::ethDetachBus); perimanSetBusDeinit(ESP32_BUS_TYPE_ETHERNET_CLK, ETHClass::ethDetachBus); perimanSetBusDeinit(ESP32_BUS_TYPE_ETHERNET_MCD, ETHClass::ethDetachBus); @@ -360,6 +364,10 @@ bool ETHClass::beginSPI(eth_phy_type_t type, int32_t phy_addr, int cs, int irq, #endif return false; } + if(phy_addr < ETH_PHY_ADDR_AUTO){ + log_e("Invalid PHY address: %d, set to ETH_PHY_ADDR_AUTO for auto detection", phy_addr); + return false; + } perimanSetBusDeinit(ESP32_BUS_TYPE_ETHERNET_SPI, ETHClass::ethDetachBus); From 9d85f27cad0a1b62afb1b812bf4262c5482055fd Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:49:10 +0200 Subject: [PATCH 03/31] Create sizes.yml --- .github/workflows/sizes.yml | 99 +++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/sizes.yml diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml new file mode 100644 index 00000000000..04730f76571 --- /dev/null +++ b/.github/workflows/sizes.yml @@ -0,0 +1,99 @@ +name: Sizes Test +# Comment +# The workflow will run labeled pull requests +on: + pull_request: + types: [opened, reopened, synchronize, labeled] + +env: + # It's convenient to set variables for values used multiple times in the workflow + SKETCHES_REPORTS_PATH: sizes-report + SKETCHES_REPORTS_ARTIFACT_NAME: sizes-report + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + +jobs: + compile-sketch: + if: | + contains(github.event.pull_request.labels.*.name, 'sizes_test') + runs-on: ubuntu-latest + + env: + REPOSITORY: | + - source-path: '.' + name: "espressif:esp32" + + strategy: + matrix: + target: + - esp32 + - esp32s2 + - esp32c3 + - esp32s3 + - esp32c6 + - esp32h2 + + include: + - target: esp32 + fqbn: espressif:esp32:esp32 + - target: esp32s2 + fqbn: espressif:esp32:esp32s2 + - target: esp32c3 + fqbn: espressif:esp32:esp32c3 + - target: esp32s3 + fqbn: espressif:esp32:esp32s3 + - target: esp32c6 + fqbn: espressif:esp32:esp32c6 + - target: esp32h2 + fqbn: espressif:esp32:esp32h2 + + + steps: + # This step makes the contents of the repository available to the workflow + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Compile sketch + uses: P-R-O-C-H-Y/compile-sketches@sizes + with: + platforms: | + ${{ env.REPOSITORY }} + target: ${{ matrix.target }} + fqbn: ${{ matrix.fqbn }} + sketch-paths: | + ${{ env.REPOSITORY }} + use-json-file: false + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + enable-warnings-report: false + cli-compile-flags: | + - --warnings="all" + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-${{ matrix.target }} + path: ${{ env.SKETCHES_REPORTS_PATH }} + + report-comment: + needs: compile-sketch # Wait for the compile job to finish to get the data for the report + runs-on: ubuntu-latest + steps: + # Check out repository + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ env.GITHUB_TOKEN }} + fetch-depth: '0' + + # This step is needed to get the size data produced by the compile jobs + - name: Download sketches reports artifact + uses: actions/download-artifact@v4 + with: + pattern: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-* + merge-multiple: true + path: ${{ env.SKETCHES_REPORTS_PATH }} + + - name: Report results + uses: P-R-O-C-H-Y/report-size-deltas@sizes + with: + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} From ccd520297f3eb1ff7da2da44d0d31507991d70e4 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:57:17 +0200 Subject: [PATCH 04/31] Update sizes.yml --- .github/workflows/sizes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 65035acfed2..53fa1c62eb9 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -61,7 +61,7 @@ jobs: target: ${{ matrix.target }} fqbn: ${{ matrix.fqbn }} sketch-paths: | - ${{ env.REPOSITORY }} + - libraries/ use-json-file: false enable-deltas-report: true sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} From 9382bdb22c6ea78485effb44a903fd9e646209a1 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:41:28 +0200 Subject: [PATCH 05/31] Update sizes.yml --- .github/workflows/sizes.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 53fa1c62eb9..0a009689b5d 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -60,8 +60,9 @@ jobs: ${{ env.REPOSITORY }} target: ${{ matrix.target }} fqbn: ${{ matrix.fqbn }} + # The path to the libraries folder TODO: Change this to the correct path sketch-paths: | - - libraries/ + - libraries/SD/ use-json-file: false enable-deltas-report: true sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} From 936cad018fe24366205eff14e6a8565cacf4bd9c Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:51:39 +0200 Subject: [PATCH 06/31] Update sizes.yml --- .github/workflows/sizes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 0a009689b5d..2610101b7be 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -63,6 +63,7 @@ jobs: # The path to the libraries folder TODO: Change this to the correct path sketch-paths: | - libraries/SD/ + - libraries/ESP_SR/ use-json-file: false enable-deltas-report: true sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} From ab29736754b3fe2cace94e2f09d446315e770b52 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:44:07 +0200 Subject: [PATCH 07/31] Update sizes.yml --- .github/workflows/sizes.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 2610101b7be..fe22c94fcfd 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -38,14 +38,14 @@ jobs: fqbn: espressif:esp32:esp32 - target: esp32s2 fqbn: espressif:esp32:esp32s2 - - target: esp32c3 - fqbn: espressif:esp32:esp32c3 - - target: esp32s3 - fqbn: espressif:esp32:esp32s3 - - target: esp32c6 - fqbn: espressif:esp32:esp32c6 - - target: esp32h2 - fqbn: espressif:esp32:esp32h2 + # - target: esp32c3 + # fqbn: espressif:esp32:esp32c3 + # - target: esp32s3 + # fqbn: espressif:esp32:esp32s3 + # - target: esp32c6 + # fqbn: espressif:esp32:esp32c6 + # - target: esp32h2 + # fqbn: espressif:esp32:esp32h2 steps: From 25e31f215494bbb5d2bfed12617bde3cb782bcfd Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:46:30 +0200 Subject: [PATCH 08/31] Update sizes.yml --- .github/workflows/sizes.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index fe22c94fcfd..2bf5b479332 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -28,10 +28,10 @@ jobs: target: - esp32 - esp32s2 - - esp32c3 - - esp32s3 - - esp32c6 - - esp32h2 + # - esp32c3 + # - esp32s3 + # - esp32c6 + # - esp32h2 include: - target: esp32 From a3a8c965e1b82269f6847bbcf0d7fe1f9f5d92db Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:22:23 +0200 Subject: [PATCH 09/31] Update sizes.yml --- .github/workflows/sizes.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 2bf5b479332..2610101b7be 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -28,24 +28,24 @@ jobs: target: - esp32 - esp32s2 - # - esp32c3 - # - esp32s3 - # - esp32c6 - # - esp32h2 + - esp32c3 + - esp32s3 + - esp32c6 + - esp32h2 include: - target: esp32 fqbn: espressif:esp32:esp32 - target: esp32s2 fqbn: espressif:esp32:esp32s2 - # - target: esp32c3 - # fqbn: espressif:esp32:esp32c3 - # - target: esp32s3 - # fqbn: espressif:esp32:esp32s3 - # - target: esp32c6 - # fqbn: espressif:esp32:esp32c6 - # - target: esp32h2 - # fqbn: espressif:esp32:esp32h2 + - target: esp32c3 + fqbn: espressif:esp32:esp32c3 + - target: esp32s3 + fqbn: espressif:esp32:esp32s3 + - target: esp32c6 + fqbn: espressif:esp32:esp32c6 + - target: esp32h2 + fqbn: espressif:esp32:esp32h2 steps: From ea3baacc623b6e693098863aac3b5f6ff60d8809 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:01:41 +0200 Subject: [PATCH 10/31] update workflows --- .github/workflows/publishlib.yml | 4 ++- .github/workflows/publishsizes.yml | 41 ++++++++++++++++++++++++++++++ .github/workflows/sizes.yml | 31 ++++++++-------------- 3 files changed, 54 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/publishsizes.yml diff --git a/.github/workflows/publishlib.yml b/.github/workflows/publishlib.yml index e4c75aefe34..9e9b2ef6f24 100644 --- a/.github/workflows/publishlib.yml +++ b/.github/workflows/publishlib.yml @@ -30,7 +30,9 @@ jobs: do IFS=$'\t' read name url <<< "$artifact" gh api $url > "$name.zip" - unzip -d "$name" "$name.zip" + unzip -j "$name.zip" -d "temp_$name" + mv "temp_$name"/* libraries-report/ + rm -r "temp_$name" done - name: Report results diff --git a/.github/workflows/publishsizes.yml b/.github/workflows/publishsizes.yml new file mode 100644 index 00000000000..7dfcb5fef79 --- /dev/null +++ b/.github/workflows/publishsizes.yml @@ -0,0 +1,41 @@ +name: Sizes Results + +on: + workflow_run: + workflows: [Sizes Test] + types: + - completed + + workflow_dispatch: +env: + # It's convenient to set variables for values used multiple times in the workflow + SKETCHES_REPORTS_PATH: artifacts/sizes-report + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + PR_EVENT_PATH: artifacts/Event File/event.json + +jobs: + lib-test-results: + name: Sizes Test Results + runs-on: ubuntu-latest + if: | + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + + steps: + - name: Download and Extract Artifacts + run: | + mkdir -p artifacts && cd artifacts + artifacts_url=${{ github.event.workflow_run.artifacts_url }} + gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact + do + IFS=$'\t' read name url <<< "$artifact" + gh api $url > "$name.zip" + unzip -d "$name" "$name.zip" + done + + - name: Report results + uses: P-R-O-C-H-Y/report-size-deltas@sizes + with: + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} + github-token: ${{ env.GITHUB_TOKEN }} + pr-event-path: ${{ env.PR_EVENT_PATH }} diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 2610101b7be..9f726397703 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -77,26 +77,15 @@ jobs: name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-${{ matrix.target }} path: ${{ env.SKETCHES_REPORTS_PATH }} - report-comment: - needs: compile-sketch # Wait for the compile job to finish to get the data for the report + event_file: + name: "Event File" + if: | + contains(github.event.pull_request.labels.*.name, 'sizes_test') + needs: compile-sketch runs-on: ubuntu-latest steps: - # Check out repository - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ env.GITHUB_TOKEN }} - fetch-depth: '0' - - # This step is needed to get the size data produced by the compile jobs - - name: Download sketches reports artifact - uses: actions/download-artifact@v4 - with: - pattern: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-* - merge-multiple: true - path: ${{ env.SKETCHES_REPORTS_PATH }} - - - name: Report results - uses: P-R-O-C-H-Y/report-size-deltas@sizes - with: - sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: Event File + path: ${{github.event_path}} \ No newline at end of file From e706068f460eb76ca1eaf54f09224d980d4f98e9 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:45:37 +0200 Subject: [PATCH 11/31] Update publishlib.yml --- .github/workflows/publishlib.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publishlib.yml b/.github/workflows/publishlib.yml index 9e9b2ef6f24..c351b249585 100644 --- a/.github/workflows/publishlib.yml +++ b/.github/workflows/publishlib.yml @@ -34,6 +34,10 @@ jobs: mv "temp_$name"/* libraries-report/ rm -r "temp_$name" done + echo "Contents of 'libraries-report':" + ls -R libraries-report + echo "Contents of parent directory:" + ls -R .. - name: Report results uses: P-R-O-C-H-Y/report-size-deltas@main From 3241f139b360fa047cbe561c57a8f97bf74b926b Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:07:29 +0200 Subject: [PATCH 12/31] update bash --- .github/workflows/publishlib.yml | 1 + .github/workflows/publishsizes.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/publishlib.yml b/.github/workflows/publishlib.yml index 0be820c8763..f3c2423afe2 100644 --- a/.github/workflows/publishlib.yml +++ b/.github/workflows/publishlib.yml @@ -25,6 +25,7 @@ jobs: - name: Download and Extract Artifacts run: | mkdir -p artifacts && cd artifacts + mkdir -p libraries-report artifacts_url=${{ github.event.workflow_run.artifacts_url }} gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact do diff --git a/.github/workflows/publishsizes.yml b/.github/workflows/publishsizes.yml index f5610ada33d..05952d21f3d 100644 --- a/.github/workflows/publishsizes.yml +++ b/.github/workflows/publishsizes.yml @@ -25,6 +25,7 @@ jobs: - name: Download and Extract Artifacts run: | mkdir -p artifacts && cd artifacts + mkdir -p sizes-report artifacts_url=${{ github.event.workflow_run.artifacts_url }} gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact do From 9a06727432024786f9471e3f24f3ba82bc1dfb43 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:31:13 +0200 Subject: [PATCH 13/31] Update publishlib.yml --- .github/workflows/publishlib.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publishlib.yml b/.github/workflows/publishlib.yml index f3c2423afe2..00b20d2c12d 100644 --- a/.github/workflows/publishlib.yml +++ b/.github/workflows/publishlib.yml @@ -9,6 +9,7 @@ on: workflow_dispatch: env: # It's convenient to set variables for values used multiple times in the workflow + #comment SKETCHES_REPORTS_PATH: artifacts/libraries-report GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} PR_EVENT_PATH: artifacts/Event File/event.json From c958919f222d02710bba586c5f2062544a481188 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Thu, 11 Apr 2024 07:54:54 +0200 Subject: [PATCH 14/31] Update publishlib.yml --- .github/workflows/publishlib.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publishlib.yml b/.github/workflows/publishlib.yml index 00b20d2c12d..4d2135a04a0 100644 --- a/.github/workflows/publishlib.yml +++ b/.github/workflows/publishlib.yml @@ -9,7 +9,6 @@ on: workflow_dispatch: env: # It's convenient to set variables for values used multiple times in the workflow - #comment SKETCHES_REPORTS_PATH: artifacts/libraries-report GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} PR_EVENT_PATH: artifacts/Event File/event.json @@ -42,7 +41,7 @@ jobs: ls -R .. - name: Report results - uses: P-R-O-C-H-Y/report-size-deltas@main + uses: P-R-O-C-H-Y/report-size-deltas@libs with: sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} github-token: ${{ env.GITHUB_TOKEN }} From d5307b9863763ec807643e434e3e413ec411f376 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:20:53 +0200 Subject: [PATCH 15/31] Update publishlib.yml --- .github/workflows/publishlib.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publishlib.yml b/.github/workflows/publishlib.yml index 4d2135a04a0..1c7cbd41b12 100644 --- a/.github/workflows/publishlib.yml +++ b/.github/workflows/publishlib.yml @@ -32,11 +32,13 @@ jobs: IFS=$'\t' read name url <<< "$artifact" gh api $url > "$name.zip" unzip -j "$name.zip" -d "temp_$name" - mv "temp_$name"/* ${{ env.SKETCHES_REPORTS_PATH }}/ + mv "temp_$name"/* libraries-report/ rm -r "temp_$name" + if [[ "$name" == "event.json" ]]; then + mkdir -p artifacts/Event\ file + mv libraries-report/event.json /Event\ file/ + fi done - echo "Contents of 'libraries-report':" - ls -R libraries-report echo "Contents of parent directory:" ls -R .. From a5ff9ca3e4989001c30f449cf4165a6787b95c8b Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:14:31 +0200 Subject: [PATCH 16/31] Compile all examples --- .github/workflows/sizes.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 9f726397703..57e757891ab 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -60,10 +60,9 @@ jobs: ${{ env.REPOSITORY }} target: ${{ matrix.target }} fqbn: ${{ matrix.fqbn }} - # The path to the libraries folder TODO: Change this to the correct path + # The path to the libraries folder sketch-paths: | - - libraries/SD/ - - libraries/ESP_SR/ + - libraries/ use-json-file: false enable-deltas-report: true sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} From c90fb0abe0e7e06a5f914b97b0684607d3dc0952 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:11:39 +0200 Subject: [PATCH 17/31] Add Huge_app partition to fqbn --- .github/workflows/sizes.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sizes.yml b/.github/workflows/sizes.yml index 57e757891ab..007427d48cd 100644 --- a/.github/workflows/sizes.yml +++ b/.github/workflows/sizes.yml @@ -35,17 +35,17 @@ jobs: include: - target: esp32 - fqbn: espressif:esp32:esp32 + fqbn: espressif:esp32:esp32:PartitionScheme=huge_app" - target: esp32s2 - fqbn: espressif:esp32:esp32s2 + fqbn: espressif:esp32:esp32s2:PartitionScheme=huge_app" - target: esp32c3 - fqbn: espressif:esp32:esp32c3 + fqbn: espressif:esp32:esp32c3:PartitionScheme=huge_app" - target: esp32s3 - fqbn: espressif:esp32:esp32s3 + fqbn: espressif:esp32:esp32s3:PartitionScheme=huge_app" - target: esp32c6 - fqbn: espressif:esp32:esp32c6 + fqbn: espressif:esp32:esp32c6:PartitionScheme=huge_app - target: esp32h2 - fqbn: espressif:esp32:esp32h2 + fqbn: espressif:esp32:esp32h2:PartitionScheme=huge_app" steps: From 312ecf701acef5689df2f957588880c0444dff89 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:30:24 +0200 Subject: [PATCH 18/31] save sizes in push workflow --- .github/scripts/on-push.sh | 2 ++ .github/scripts/sketch_utils.sh | 24 +++++++++++++++++++++++- .github/workflows/push.yml | 7 +++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index bf311b93166..714331e82e5 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -36,6 +36,8 @@ function build(){ ${BUILD_SKETCH} ${sargs} done fi + #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + mv "$HOME/.arduino/cli_compile_output.json" "$GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" } if [ -z "$GITHUB_WORKSPACE" ]; then diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 70a21a15452..a90ae3d5638 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -140,6 +140,9 @@ function build_sketch(){ # build_sketch [ex build_dir="$HOME/.arduino/tests/$sketchname/build.tmp" fi + log_file="$HOME/.arduino/cli_compile_output.txt" + sizes_file="$HOME/.arduino/cli_compile_output.json" + mkdir -p "$ARDUINO_CACHE_DIR" for i in `seq 0 $(($len - 1))` do @@ -164,13 +167,32 @@ function build_sketch(){ # build_sketch [ex --build-property "compiler.warning_flags.all=-Wall -Werror=all -Wextra" \ --build-cache-path "$ARDUINO_CACHE_DIR" \ --build-path "$build_dir" \ - $xtra_opts "${sketchdir}" + $xtra_opts "${sketchdir}" \ + > $log_file exit_status=$? if [ $exit_status -ne 0 ]; then echo ""ERROR: Compilation failed with error code $exit_status"" exit $exit_status fi + + #Extract the program storage space and dynamic memory usage in bytes and percentage in separate variables from the output, just the value without the string + flash_bytes=$(grep -oE 'Sketch uses ([0-9]+) bytes' $log_file | awk '{print $3}') + flash_percentage=$(grep -oE 'Sketch uses ([0-9]+) bytes \(([0-9]+)%\)' $log_file | awk '{print $5}' | tr -d '(%)') + ram_bytes=$(grep -oE 'Global variables use ([0-9]+) bytes' $log_file | awk '{print $4}') + ram_percentage=$(grep -oE 'Global variables use ([0-9]+) bytes \(([0-9]+)%\)' $log_file | awk '{print $6}' | tr -d '(%)') + + #append json file where key is fqbn, sketch name, sizes -> extracted values + echo "{\"fqbn\": \"$fqbn\", + \"sketch\": \"$sketch\", + \"sizes\": { + \"flash_bytes\": $flash_bytes, + \"flash_percentage\": $flash_percentage, + \"ram_bytes\": $ram_bytes, + \"ram_percentage\": $ram_percentage + } + }" >> $out_file + elif [ -f "$ide_path/arduino-builder" ]; then echo "Building $sketchname with arduino-builder and FQBN=$currfqbn" echo "Build path = $build_dir" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c7c48225ca4..6a91584d756 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -48,6 +48,13 @@ jobs: - name: Build Sketches run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} 15 + #Upload cli compile json as artifact + - name: Upload cli compile json + uses: actions/upload-artifact@v2 + with: + name: cli-compile-json-${{ matrix.chunk }} + path: cli-compile-${{ matrix.chunk }}.json + # Windows and MacOS build-arduino-win-mac: name: Arduino on ${{ matrix.os }} From 24816a0e3edec989b50560f59e36055f094b6338 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:41:10 +0200 Subject: [PATCH 19/31] fix sizes file name --- .github/scripts/sketch_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index a90ae3d5638..0e0fc81522e 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -191,7 +191,7 @@ function build_sketch(){ # build_sketch [ex \"ram_bytes\": $ram_bytes, \"ram_percentage\": $ram_percentage } - }" >> $out_file + }" >> "$sizes_file" elif [ -f "$ide_path/arduino-builder" ]; then echo "Building $sketchname with arduino-builder and FQBN=$currfqbn" From 4ff9518dcf5766a2a60b4761b094c5f7719b35da Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:10:55 +0200 Subject: [PATCH 20/31] Update on-push.sh --- .github/scripts/on-push.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 714331e82e5..302d2a1f533 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -36,8 +36,12 @@ function build(){ ${BUILD_SKETCH} ${sargs} done fi + sizes_file="$HOME/.arduino/cli_compile_output.json" #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" - mv "$HOME/.arduino/cli_compile_output.json" "$GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + ls -R $HOME/.arduino + mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + ls -R $GITHUB_WORKSPACE + } if [ -z "$GITHUB_WORKSPACE" ]; then From 69a927479a50f5922c709a7c83385713e00ece55 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:19:10 +0200 Subject: [PATCH 21/31] Update on-push.sh --- .github/scripts/on-push.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 302d2a1f533..e5f21d4b2ea 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -36,12 +36,6 @@ function build(){ ${BUILD_SKETCH} ${sargs} done fi - sizes_file="$HOME/.arduino/cli_compile_output.json" - #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" - ls -R $HOME/.arduino - mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" - ls -R $GITHUB_WORKSPACE - } if [ -z "$GITHUB_WORKSPACE" ]; then @@ -90,6 +84,13 @@ if [ "$BUILD_PIO" -eq 0 ]; then build "esp32c6" $FQBN_ESP32C6 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32h2" $FQBN_ESP32H2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 + + sizes_file="$HOME/.arduino/cli_compile_output.json" + #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + ls $HOME/.arduino + mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + ls $GITHUB_WORKSPACE + else source ${SCRIPTS_DIR}/install-platformio-esp32.sh # PlatformIO ESP32 Test From d8276dabb98fb54eb678032636537d4e251378ed Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:49:02 +0200 Subject: [PATCH 22/31] Update json file location --- .github/scripts/on-push.sh | 6 ++++-- .github/workflows/push.yml | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index e5f21d4b2ea..4d9c54fc101 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -87,10 +87,12 @@ if [ "$BUILD_PIO" -eq 0 ]; then sizes_file="$HOME/.arduino/cli_compile_output.json" #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + echo "Listings of $HOME/.arduino" ls $HOME/.arduino - mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" + mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_$chunk_index.json" + echo "Listings of $GITHUB_WORKSPACE" ls $GITHUB_WORKSPACE - + else source ${SCRIPTS_DIR}/install-platformio-esp32.sh # PlatformIO ESP32 Test diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6a91584d756..f26dc966620 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -52,8 +52,8 @@ jobs: - name: Upload cli compile json uses: actions/upload-artifact@v2 with: - name: cli-compile-json-${{ matrix.chunk }} - path: cli-compile-${{ matrix.chunk }}.json + name: cli_compile_${{ matrix.chunk }} + path: cli_compile_${{ matrix.chunk }}.json # Windows and MacOS build-arduino-win-mac: From 8c324601fbb678e48131e1d73da486bd62842fcf Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:59:49 +0200 Subject: [PATCH 23/31] fix chunk index in filename --- .github/scripts/on-push.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 4d9c54fc101..12cb245a51a 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -89,7 +89,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" echo "Listings of $HOME/.arduino" ls $HOME/.arduino - mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_$chunk_index.json" + mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json" echo "Listings of $GITHUB_WORKSPACE" ls $GITHUB_WORKSPACE From 3ad6ea7484e4eb61dad441061e79dbf6cab5b5b7 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:18:23 +0200 Subject: [PATCH 24/31] changed json format and removed moving the file --- .github/scripts/on-push.sh | 15 ++++++++------- .github/scripts/sketch_utils.sh | 31 +++++++++++++++++++++++++++---- .github/workflows/push.yml | 2 +- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 12cb245a51a..31f85485350 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -77,7 +77,11 @@ if [ "$BUILD_PIO" -eq 0 ]; then $ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino\ $ARDUINO_ESP32_PATH/libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino\ " + #create sizes_file and echo start of JSON array with "boards" key + sizes_file="$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json" + echo "{\"boards\": [" > $sizes_file + #build sketches for different targets build "esp32s3" $FQBN_ESP32S3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 @@ -85,13 +89,10 @@ if [ "$BUILD_PIO" -eq 0 ]; then build "esp32h2" $FQBN_ESP32H2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 - sizes_file="$HOME/.arduino/cli_compile_output.json" - #rename sizes_file="$HOME/.arduino/cli_compile_output.json" to sizes_file="GITHUB_WORKSPACE/cli_compile_output_${chunk_index}.json" - echo "Listings of $HOME/.arduino" - ls $HOME/.arduino - mv $sizes_file "$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json" - echo "Listings of $GITHUB_WORKSPACE" - ls $GITHUB_WORKSPACE + #remove last comma from the last JSON object + sed -i '' -e '$ s/,$//' $sizes_file + #echo end of JSON array + echo "]}" >> $sizes_file else source ${SCRIPTS_DIR}/install-platformio-esp32.sh diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 0e0fc81522e..98c2b362cbb 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -141,7 +141,12 @@ function build_sketch(){ # build_sketch [ex fi log_file="$HOME/.arduino/cli_compile_output.txt" - sizes_file="$HOME/.arduino/cli_compile_output.json" + sizes_file="$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json" + + #echo board,target and start of sketches to sizes_file json + echo "{ \"board\": \"$fqbn\", + \"target\": \"$target\", + \"sketches\": [" >> "$sizes_file" mkdir -p "$ARDUINO_CACHE_DIR" for i in `seq 0 $(($len - 1))` @@ -182,16 +187,28 @@ function build_sketch(){ # build_sketch [ex ram_bytes=$(grep -oE 'Global variables use ([0-9]+) bytes' $log_file | awk '{print $4}') ram_percentage=$(grep -oE 'Global variables use ([0-9]+) bytes \(([0-9]+)%\)' $log_file | awk '{print $6}' | tr -d '(%)') + # Define the constant part + constant_path="$HOME/Arduino/hardware/espressif/esp32/libraries/" + + # Extract the desired substring using awk + lib_sketch_name=$(echo "$sketch" | sed "s|$constant_part\([^/]*\)/.*|\1|") + + # Print the extracted substring + echo "Extracted Path: $lib_sketch_name" + #append json file where key is fqbn, sketch name, sizes -> extracted values - echo "{\"fqbn\": \"$fqbn\", - \"sketch\": \"$sketch\", + echo "{\"name\": \"$lib_sketch_name\", \"sizes\": { \"flash_bytes\": $flash_bytes, \"flash_percentage\": $flash_percentage, \"ram_bytes\": $ram_bytes, \"ram_percentage\": $ram_percentage } - }" >> "$sizes_file" + }," >> "$sizes_file" + #if i is the last index of the loop, remove the last comma + if [ $i -eq $(($len - 1)) ]; then + sed -i '$ s/.$//' "$sizes_file" + fi elif [ -f "$ide_path/arduino-builder" ]; then echo "Building $sketchname with arduino-builder and FQBN=$currfqbn" @@ -226,6 +243,12 @@ function build_sketch(){ # build_sketch [ex # $xtra_opts "${sketchdir}/${sketchname}.ino" fi done + + #echo end of sketches sizes_file json + echo "]}" >> "$sizes_file" + #echo end of board sizes_file json + echo "}," >> "$sizes_file" + unset fqbn unset xtra_opts unset options diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f26dc966620..3a3bf133ffd 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -50,7 +50,7 @@ jobs: #Upload cli compile json as artifact - name: Upload cli compile json - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: cli_compile_${{ matrix.chunk }} path: cli_compile_${{ matrix.chunk }}.json From 990a6e345522baef7a8741627df17a3998b039e0 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:37:52 +0200 Subject: [PATCH 25/31] add log messages --- .github/scripts/on-push.sh | 5 ++++- .github/scripts/sketch_utils.sh | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 31f85485350..444a20a9c20 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -89,8 +89,11 @@ if [ "$BUILD_PIO" -eq 0 ]; then build "esp32h2" $FQBN_ESP32H2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 + + echo "Debug(board) - removing last comma from the last JSON object" + #remove last comma from the last JSON object - sed -i '' -e '$ s/,$//' $sizes_file + sed -i '$ s/.$//' "$sizes_file" #echo end of JSON array echo "]}" >> $sizes_file diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 98c2b362cbb..815aa9a1ad4 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -140,9 +140,13 @@ function build_sketch(){ # build_sketch [ex build_dir="$HOME/.arduino/tests/$sketchname/build.tmp" fi + echo "Chunk index = $CHUNK_INDEX" + log_file="$HOME/.arduino/cli_compile_output.txt" sizes_file="$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json" + echo "Sizes file = $sizes_file" + #echo board,target and start of sketches to sizes_file json echo "{ \"board\": \"$fqbn\", \"target\": \"$target\", @@ -187,15 +191,15 @@ function build_sketch(){ # build_sketch [ex ram_bytes=$(grep -oE 'Global variables use ([0-9]+) bytes' $log_file | awk '{print $4}') ram_percentage=$(grep -oE 'Global variables use ([0-9]+) bytes \(([0-9]+)%\)' $log_file | awk '{print $6}' | tr -d '(%)') + # Extract the directory path excluding the filename + directory_path=$(dirname "$sketch") + echo "Debug (sketch)- directory path = $directory_path" # Define the constant part - constant_path="$HOME/Arduino/hardware/espressif/esp32/libraries/" - - # Extract the desired substring using awk - lib_sketch_name=$(echo "$sketch" | sed "s|$constant_part\([^/]*\)/.*|\1|") - - # Print the extracted substring - echo "Extracted Path: $lib_sketch_name" - + constant_part="/home/runner/Arduino/hardware/espressif/esp32/libraries/" + echo "Debug (sketch)- constant part = $constant_part" + # Extract the desired substring using sed + lib_sketch_name=$(echo "$directory_path" | sed "s|$constant_part||") + echo "Debug (sketch)- extracted path = $lib_sketch_name" #append json file where key is fqbn, sketch name, sizes -> extracted values echo "{\"name\": \"$lib_sketch_name\", \"sizes\": { @@ -206,6 +210,7 @@ function build_sketch(){ # build_sketch [ex } }," >> "$sizes_file" #if i is the last index of the loop, remove the last comma + echo "Debug (sketch)- removing last comma from the last JSON object" if [ $i -eq $(($len - 1)) ]; then sed -i '$ s/.$//' "$sizes_file" fi From 8651c52bb4c87ab4c6a089103057d7e72dab01fa Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:48:57 +0200 Subject: [PATCH 26/31] Update sketch_utils.sh --- .github/scripts/sketch_utils.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 815aa9a1ad4..b81b5ca38fd 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -27,6 +27,10 @@ function build_sketch(){ # build_sketch [ex shift sketchdir=$1 ;; + -i ) + shift + chunk_index=$1 + ;; * ) break ;; @@ -140,10 +144,10 @@ function build_sketch(){ # build_sketch [ex build_dir="$HOME/.arduino/tests/$sketchname/build.tmp" fi - echo "Chunk index = $CHUNK_INDEX" + echo "Chunk index = $chunk_index" log_file="$HOME/.arduino/cli_compile_output.txt" - sizes_file="$GITHUB_WORKSPACE/cli_compile_$CHUNK_INDEX.json" + sizes_file="$GITHUB_WORKSPACE/cli_compile_$chunk_index.json" echo "Sizes file = $sizes_file" @@ -391,7 +395,7 @@ function build_sketches(){ # build_sketches Date: Mon, 15 Apr 2024 14:07:34 +0200 Subject: [PATCH 27/31] Update sketch_utils.sh --- .github/scripts/sketch_utils.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index b81b5ca38fd..a2e74987628 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -151,11 +151,6 @@ function build_sketch(){ # build_sketch [ex echo "Sizes file = $sizes_file" - #echo board,target and start of sketches to sizes_file json - echo "{ \"board\": \"$fqbn\", - \"target\": \"$target\", - \"sketches\": [" >> "$sizes_file" - mkdir -p "$ARDUINO_CACHE_DIR" for i in `seq 0 $(($len - 1))` do @@ -213,11 +208,6 @@ function build_sketch(){ # build_sketch [ex \"ram_percentage\": $ram_percentage } }," >> "$sizes_file" - #if i is the last index of the loop, remove the last comma - echo "Debug (sketch)- removing last comma from the last JSON object" - if [ $i -eq $(($len - 1)) ]; then - sed -i '$ s/.$//' "$sizes_file" - fi elif [ -f "$ide_path/arduino-builder" ]; then echo "Building $sketchname with arduino-builder and FQBN=$currfqbn" @@ -252,11 +242,6 @@ function build_sketch(){ # build_sketch [ex # $xtra_opts "${sketchdir}/${sketchname}.ino" fi done - - #echo end of sketches sizes_file json - echo "]}" >> "$sizes_file" - #echo end of board sizes_file json - echo "}," >> "$sizes_file" unset fqbn unset xtra_opts @@ -394,6 +379,12 @@ function build_sketches(){ # build_sketches > "$sizes_file" + local sketchnum=0 args+=" -ai $ide_path -au $user_path -i $chunk_index" for sketch in $sketches; do @@ -412,6 +403,15 @@ function build_sketches(){ # build_sketches > "$sizes_file" + #echo end of board sizes_file json + echo "}," >> "$sizes_file" + return 0 } From 12d455cc1cce854fcee8a3236c983768688e3798 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:28:09 +0200 Subject: [PATCH 28/31] Update sketch_utils.sh --- .github/scripts/sketch_utils.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index a2e74987628..e6c588df30b 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -201,12 +201,12 @@ function build_sketch(){ # build_sketch [ex echo "Debug (sketch)- extracted path = $lib_sketch_name" #append json file where key is fqbn, sketch name, sizes -> extracted values echo "{\"name\": \"$lib_sketch_name\", - \"sizes\": { + \"sizes\": [{ \"flash_bytes\": $flash_bytes, \"flash_percentage\": $flash_percentage, \"ram_bytes\": $ram_bytes, \"ram_percentage\": $ram_percentage - } + }] }," >> "$sizes_file" elif [ -f "$ide_path/arduino-builder" ]; then @@ -408,10 +408,10 @@ function build_sketches(){ # build_sketches > "$sizes_file" + echo "]" >> "$sizes_file" #echo end of board sizes_file json echo "}," >> "$sizes_file" - + return 0 } From 904def56df47cce500e91cbae8fb8178b81c189b Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:36:31 +0200 Subject: [PATCH 29/31] 2nd build run --- .github/workflows/publishsizes.yml | 7 ++- .github/workflows/push.yml | 99 ++++++++++++++++++++---------- 2 files changed, 74 insertions(+), 32 deletions(-) diff --git a/.github/workflows/publishsizes.yml b/.github/workflows/publishsizes.yml index c0c08550693..3ad887d6dc6 100644 --- a/.github/workflows/publishsizes.yml +++ b/.github/workflows/publishsizes.yml @@ -2,7 +2,7 @@ name: Sizes Results on: workflow_run: - workflows: [Sizes Test] + workflows: [ESP32 Arduino CI] types: - completed @@ -26,6 +26,8 @@ jobs: run: | mkdir -p artifacts && cd artifacts mkdir -p sizes-report + mkdir -p sizes-report/master + mkdir -p sizes-report/pr artifacts_url=${{ github.event.workflow_run.artifacts_url }} gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact do @@ -33,6 +35,9 @@ jobs: gh api $url > "$name.zip" unzip -j "$name.zip" -d "temp_$name" mv "temp_$name"/* sizes-report/ + if [[ "$name" == "event.json" ]]; then + mv libraries-report/event.json /Event\ file/ + fi rm -r "temp_$name" done echo "Contents of 'sizes-report':" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 3a3bf133ffd..5c45864bc67 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -52,42 +52,42 @@ jobs: - name: Upload cli compile json uses: actions/upload-artifact@v4 with: - name: cli_compile_${{ matrix.chunk }} + name: pr_cli_compile_${{ matrix.chunk }} path: cli_compile_${{ matrix.chunk }}.json # Windows and MacOS - build-arduino-win-mac: - name: Arduino on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest, macOS-latest] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Build Sketches - run: bash ./.github/scripts/on-push.sh + #build-arduino-win-mac: + # name: Arduino on ${{ matrix.os }} + # runs-on: ${{ matrix.os }} + # strategy: + # fail-fast: false + # matrix: + # os: [windows-latest, macOS-latest] + # + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.x' + # - name: Build Sketches + # run: bash ./.github/scripts/on-push.sh # PlatformIO on Windows, Ubuntu and Mac - build-platformio: - name: PlatformIO on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Build Sketches - run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO + #build-platformio: + # name: PlatformIO on ${{ matrix.os }} + # runs-on: ${{ matrix.os }} + # strategy: + # fail-fast: false + # matrix: + # os: [ubuntu-latest, windows-latest, macOS-latest] + # + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: '3.x' + # - name: Build Sketches + # run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO build-esp-idf-component: name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} @@ -117,3 +117,40 @@ jobs: idf.py create-project test echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build + + # Ubuntu + build-arduino-master-linux: + name: Arduino Master ${{ matrix.chunk }} on ubuntu-latest + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + + # Checkout master branch + steps: + - uses: actions/checkout@v4 + with: + ref: master + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Cache tools + id: cache-linux + uses: actions/cache@v4 + with: + path: | + ./tools/dist + ~/arduino_ide + key: ${{ runner.os }}-${{ hashFiles('package/package_esp32_index.template.json', + 'tools/get.py', + '.github/scripts/install-arduino-ide.sh') }} + - name: Build Sketches + run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} 15 + + #Upload cli compile json as artifact + - name: Upload cli compile json + uses: actions/upload-artifact@v4 + with: + name: master_cli_compile_${{ matrix.chunk }} + path: cli_compile_${{ matrix.chunk }}.json From d2d37e4322e6b370e2c9141cc177e57ae6ad2441 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:54:04 +0200 Subject: [PATCH 30/31] Upload event file --- .github/workflows/push.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5c45864bc67..fb624db0f30 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -154,3 +154,14 @@ jobs: with: name: master_cli_compile_${{ matrix.chunk }} path: cli_compile_${{ matrix.chunk }}.json + + event_file: + name: "Event File" + needs: [build-arduino-linux, build-arduino-master-linux] + runs-on: ubuntu-latest + steps: + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: Event File + path: ${{github.event_path}} From f59f87f4c64c242103f6634157b6c6062ee95241 Mon Sep 17 00:00:00 2001 From: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:56:19 +0200 Subject: [PATCH 31/31] Update push.yml --- .github/workflows/push.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index fb624db0f30..1d459816c43 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -156,12 +156,12 @@ jobs: path: cli_compile_${{ matrix.chunk }}.json event_file: - name: "Event File" - needs: [build-arduino-linux, build-arduino-master-linux] - runs-on: ubuntu-latest - steps: - - name: Upload - uses: actions/upload-artifact@v4 - with: - name: Event File - path: ${{github.event_path}} + name: "Event File" + needs: [build-arduino-linux, build-arduino-master-linux] + runs-on: ubuntu-latest + steps: + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: Event File + path: ${{github.event_path}}