From ceddd90164d1f0935496b818ad5675adc33d0441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 19 Apr 2023 15:11:11 +0200 Subject: [PATCH 1/4] Create allboards.yml for all boards test --- .github/scripts/find_all_boards.sh | 35 +++++++++ .github/workflows/allboards.yml | 117 +++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100755 .github/scripts/find_all_boards.sh create mode 100644 .github/workflows/allboards.yml diff --git a/.github/scripts/find_all_boards.sh b/.github/scripts/find_all_boards.sh new file mode 100755 index 00000000000..ce88c8e355e --- /dev/null +++ b/.github/scripts/find_all_boards.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Get all boards +boards_array=() + +for line in `grep '.tarch=' boards.txt`; do + board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1) + boards_array+=("espressif:esp32:$board_name") + echo "Added 'espressif:esp32:$board_name' to array" +done + +# Create JSON like string with all boards found and pass it to env variable +board_count=${#boards_array[@]} +echo "Boards found: $board_count" +echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV + +if [ $board_count -gt 0 ] +then + json_matrix='[' + for board in ${boards_array[@]} + do + json_matrix+='"'$board'"' + if [ $board_count -gt 1 ] + then + json_matrix+="," + fi + board_count=$(($board_count - 1)) + done + json_matrix+=']' + + echo $json_matrix + echo "FQBNS=${json_matrix}" >> $GITHUB_ENV +else + echo "FQBNS=" >> $GITHUB_ENV +fi \ No newline at end of file diff --git a/.github/workflows/allboards.yml b/.github/workflows/allboards.yml new file mode 100644 index 00000000000..7e0d1731506 --- /dev/null +++ b/.github/workflows/allboards.yml @@ -0,0 +1,117 @@ +name: Boards Test - Remote trigger + +# The workflow will run on schedule and labeled pull requests +on: + repository_dispatch: + types: [test-boards] + +jobs: + find-boards: + runs-on: ubuntu-latest + + outputs: + fqbns: ${{ env.FQBNS }} + board-count: ${{ env.BOARD-COUNT }} + + steps: + # This step makes the contents of the repository available to the workflow + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ github.event.client_payload.branch }} + + - name: Get boards fqbns + run: + bash .github/scripts/find_all_boards.sh + + setup-chunks: + needs: find-boards + runs-on: ubuntu-latest + if: needs.find-boards.outputs.fqbns != '' + + outputs: + test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} + test-chunk-ids: ${{ steps['set-test-chunks-ids'].outputs['test-chunks-ids'] }} + + steps: + - uses: actions/checkout@v3 + - run: npm install + - name: Setup jq + uses: dcarbone/install-jq-action@v1.0.1 + + - id: set-test-chunks + name: Set Chunks + run: + echo "test-chunks<> $GITHUB_OUTPUT + + echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT + + echo "EOF" >> $GITHUB_OUTPUT + + - id: set-test-chunks-ids + name: Set Chunk IDs + run: + echo "$(echo $CHUNKS | jq -M 'to_entries | map(.key)')" + + echo "test-chunks-ids<> $GITHUB_OUTPUT + + echo "$(echo $CHUNKS | jq -M 'to_entries | map(.key)')" >> $GITHUB_OUTPUT + + echo "EOF" >> $GITHUB_OUTPUT + env: + CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} + + - name: Echo chunks + run: + echo $CHUNK + env: + CHUNK: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} + + - name: Echo chunks ids + run: + echo $CHUNKID + env: + CHUNKID: ${{ steps['set-test-chunks-ids'].outputs['test-chunks-ids'] }} + + + test-boards: + needs: setup-chunks + runs-on: ubuntu-latest + + env: + REPOSITORY: | + - source-path: '.' + name: "espressif:esp32" + + strategy: + fail-fast: false + matrix: + chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }} + + steps: + # This step makes the contents of the repository available to the workflow + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Echo FQBNS to file + run: + echo "$FQBN" > fqbns.json + env: + FQBN: ${{ toJSON(matrix.chunk) }} + + - name: Compile sketch + uses: P-R-O-C-H-Y/compile-sketches@development + with: + platforms: | + ${{ env.REPOSITORY }} + multiple-fqbn: true + multiple-fqbn-path: "fqbns.json" + use-json-file: false + enable-deltas-report: false + enable-warnings-report: false + cli-compile-flags: | + - --warnings="all" + sketch-paths: + "- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino" + + #jq -nc '["espressif:esp32:esp32s3","espressif:esp32:esp32c3","espressif:esp32:esp32s2","espressif:esp32:esp32","espressif:esp32:esp32da"] | _nwise(15)' \ No newline at end of file From ec1cf4dbf105ee60d6aaedc989f689f6060e04a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:23:02 +0200 Subject: [PATCH 2/4] Clean workflow from unused stuff --- .github/workflows/allboards.yml | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/.github/workflows/allboards.yml b/.github/workflows/allboards.yml index 7e0d1731506..00556ecdc21 100644 --- a/.github/workflows/allboards.yml +++ b/.github/workflows/allboards.yml @@ -1,6 +1,6 @@ name: Boards Test - Remote trigger -# The workflow will run on schedule and labeled pull requests +# The workflow will run on remote dispath with event-type set to "test-boards" on: repository_dispatch: types: [test-boards] @@ -14,7 +14,6 @@ jobs: board-count: ${{ env.BOARD-COUNT }} steps: - # This step makes the contents of the repository available to the workflow - name: Checkout repository uses: actions/checkout@v3 with: @@ -31,7 +30,6 @@ jobs: outputs: test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} - test-chunk-ids: ${{ steps['set-test-chunks-ids'].outputs['test-chunks-ids'] }} steps: - uses: actions/checkout@v3 @@ -48,32 +46,6 @@ jobs: echo "EOF" >> $GITHUB_OUTPUT - - id: set-test-chunks-ids - name: Set Chunk IDs - run: - echo "$(echo $CHUNKS | jq -M 'to_entries | map(.key)')" - - echo "test-chunks-ids<> $GITHUB_OUTPUT - - echo "$(echo $CHUNKS | jq -M 'to_entries | map(.key)')" >> $GITHUB_OUTPUT - - echo "EOF" >> $GITHUB_OUTPUT - env: - CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} - - - name: Echo chunks - run: - echo $CHUNK - env: - CHUNK: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} - - - name: Echo chunks ids - run: - echo $CHUNKID - env: - CHUNKID: ${{ steps['set-test-chunks-ids'].outputs['test-chunks-ids'] }} - - test-boards: needs: setup-chunks runs-on: ubuntu-latest @@ -89,7 +61,6 @@ jobs: chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }} steps: - # This step makes the contents of the repository available to the workflow - name: Checkout repository uses: actions/checkout@v3 @@ -113,5 +84,3 @@ jobs: - --warnings="all" sketch-paths: "- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino" - - #jq -nc '["espressif:esp32:esp32s3","espressif:esp32:esp32c3","espressif:esp32:esp32s2","espressif:esp32:esp32","espressif:esp32:esp32da"] | _nwise(15)' \ No newline at end of file From 44189074390908f2ffe6b6a1b98dca4badd03223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:32:42 +0200 Subject: [PATCH 3/4] Use compile-sketch main --- .github/workflows/allboards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/allboards.yml b/.github/workflows/allboards.yml index 00556ecdc21..ddd631b1bf8 100644 --- a/.github/workflows/allboards.yml +++ b/.github/workflows/allboards.yml @@ -71,7 +71,7 @@ jobs: FQBN: ${{ toJSON(matrix.chunk) }} - name: Compile sketch - uses: P-R-O-C-H-Y/compile-sketches@development + uses: P-R-O-C-H-Y/compile-sketches@main with: platforms: | ${{ env.REPOSITORY }} From 08cb8486f90af5d673808344aab71801d7ac9668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:33:52 +0200 Subject: [PATCH 4/4] Update find_all_boards.sh --- .github/scripts/find_all_boards.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/find_all_boards.sh b/.github/scripts/find_all_boards.sh index ce88c8e355e..a2c53c212c5 100755 --- a/.github/scripts/find_all_boards.sh +++ b/.github/scripts/find_all_boards.sh @@ -32,4 +32,4 @@ then echo "FQBNS=${json_matrix}" >> $GITHUB_ENV else echo "FQBNS=" >> $GITHUB_ENV -fi \ No newline at end of file +fi