|
60 | 60 | path: ${{ env.CORE_ARTIFACT }}.tar.bz2
|
61 | 61 |
|
62 | 62 | test-core:
|
63 |
| - name: Test arduino:zephyr:${{ matrix.board }} |
| 63 | + name: Test ${{ matrix.board }} board |
64 | 64 | runs-on: ubuntu-latest
|
65 | 65 | needs: package-core
|
66 | 66 | strategy:
|
|
69 | 69 | fail-fast: false
|
70 | 70 | env:
|
71 | 71 | FQBN: arduino:zephyr:${{ matrix.board }}
|
| 72 | + REPORT_FILE: arduino-zephyr-${{ matrix.board }}.json |
72 | 73 | steps:
|
73 | 74 | - uses: actions/download-artifact@v4
|
74 | 75 | with:
|
|
83 | 84 | mkdir Blink/
|
84 | 85 | wget -nv https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino -P Blink/
|
85 | 86 |
|
86 |
| - - name: Compile Blink for ${{ env.FQBN }} |
87 |
| - uses: arduino/compile-sketches@main |
| 87 | + - name: Compile Blink for ${{ matrix.board }} |
| 88 | + uses: pillo79/compile-sketches@main |
88 | 89 | with:
|
89 | 90 | fqbn: ${{ env.FQBN }}
|
90 | 91 | platforms: |
|
|
96 | 97 | sketch-paths: Blink
|
97 | 98 | verbose: 'false'
|
98 | 99 | enable-deltas-report: 'false'
|
| 100 | + enable-warnings-report: 'true' |
| 101 | + enable-warnings-log: 'true' |
| 102 | + |
| 103 | + - name: Get job ID |
| 104 | + id: job_id |
| 105 | + uses: actions/github-script@main |
| 106 | + with: |
| 107 | + script: | |
| 108 | + const { data: workflow_run } = await github.rest.actions.listJobsForWorkflowRun({ |
| 109 | + owner: context.repo.owner, |
| 110 | + repo: context.repo.repo, |
| 111 | + run_id: context.runId |
| 112 | + }); |
| 113 | + const job_name = `Test ${{ matrix.board }} board` |
| 114 | + return workflow_run.jobs.find((job) => job.name === job_name).id; |
| 115 | +
|
| 116 | + - name: Prepare log |
| 117 | + run: | |
| 118 | + sed -i -e 's!/home/runner/.arduino15/packages/arduino/hardware/zephyr/[^/]*/!!g' sketches-reports/${REPORT_FILE} |
| 119 | + cat sketches-reports/${REPORT_FILE} | jq -cr ".boards[0].sketches[0] += { job_id: ${{ steps.job_id.outputs.result }} }" > ${REPORT_FILE} && mv ${REPORT_FILE} sketches-reports/ |
| 120 | +
|
| 121 | + - uses: actions/upload-artifact@v4 |
| 122 | + with: |
| 123 | + name: test-report-${{ needs.package-core.outputs.CORE_TAG }}-${{ matrix.board }} |
| 124 | + path: sketches-reports/* |
| 125 | + |
| 126 | + collect-logs: |
| 127 | + name: Collect logs |
| 128 | + runs-on: ubuntu-latest |
| 129 | + needs: |
| 130 | + - package-core |
| 131 | + - test-core |
| 132 | + if: ${{ !cancelled() && needs.package-core.result == 'success' }} |
| 133 | + env: |
| 134 | + BOARD_NAMES: ${{ needs.package-core.outputs.BOARD_NAMES }} |
| 135 | + steps: |
| 136 | + - uses: actions/download-artifact@v4 |
| 137 | + with: |
| 138 | + path: . |
| 139 | + pattern: test-report-* |
| 140 | + merge-multiple: true |
| 141 | + |
| 142 | + - run: | |
| 143 | + echo "### Core test results:" >> "$GITHUB_STEP_SUMMARY" |
| 144 | + for BOARD in $(echo $BOARD_NAMES | jq -cr '.[]'); do |
| 145 | + FQBN="arduino:zephyr:$BOARD" |
| 146 | + REPORT_FILE="arduino-zephyr-$BOARD.json" |
| 147 | + if [ ! -f $REPORT_FILE ]; then |
| 148 | + echo ":x: $BOARD - No report found?" >> "$GITHUB_STEP_SUMMARY" |
| 149 | + else |
| 150 | + REPORT=$(jq -cr '.boards[0].sketches[0]' $REPORT_FILE) |
| 151 | + JOB_ID=$(echo $REPORT | jq -cr '.job_id') |
| 152 | + JOB_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${JOB_ID}#step:5:2" |
| 153 | + if ! $(echo $REPORT | jq -cr '.compilation_success') ; then |
| 154 | + echo ":x: [$BOARD]($JOB_URL) - **Build failed**" >> "$GITHUB_STEP_SUMMARY" |
| 155 | + else |
| 156 | + WARNINGS=$(echo $REPORT | jq -cr '.warnings.current.absolute // 0') |
| 157 | + if [ $WARNINGS -eq 0 ]; then |
| 158 | + echo ":white_check_mark: [$BOARD]($JOB_URL) - Build successful" >> "$GITHUB_STEP_SUMMARY" |
| 159 | + else |
| 160 | + echo "<details><summary>:warning: <a href=\"$JOB_URL\">$BOARD</a> - $WARNINGS warnings:</summary>" >> "$GITHUB_STEP_SUMMARY" |
| 161 | + echo >> "$GITHUB_STEP_SUMMARY" |
| 162 | + echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY" |
| 163 | + echo $REPORT | jq -cr '.warnings_log[]' >> "$GITHUB_STEP_SUMMARY" |
| 164 | + echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY" |
| 165 | + echo >> "$GITHUB_STEP_SUMMARY" |
| 166 | + echo "</details>" >> "$GITHUB_STEP_SUMMARY" |
| 167 | + fi |
| 168 | + fi |
| 169 | + fi |
| 170 | + done |
| 171 | +
|
| 172 | + - name: Clean up intermediate artifacts |
| 173 | + |
| 174 | + with: |
| 175 | + name: test-report-* |
| 176 | + failOnError: false |
0 commit comments