use full home #175
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package, test and upload core | |
on: | |
- push | |
- pull_request | |
jobs: | |
package-core: | |
name: Build and package core | |
runs-on: ubuntu-latest | |
env: | |
ZEPHYR_SDK_INSTALL_DIR: /opt/zephyr-sdk-0.16.8 | |
CCACHE_IGNOREOPTIONS: -specs=* | |
outputs: | |
CORE_TAG: ${{ env.CORE_TAG }} | |
CORE_ARTIFACT: ${{ env.CORE_ARTIFACT }} | |
BOARD_NAMES: ${{ env.BOARD_NAMES }} | |
steps: | |
- name: Install toolchain | |
working-directory: /opt | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends git cmake wget python3-pip ninja-build ccache | |
wget -nv https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.8/zephyr-sdk-0.16.8_linux-x86_64_minimal.tar.xz | |
tar xf zephyr-sdk-0.16.8_linux-x86_64_minimal.tar.xz && cd zephyr-sdk-0.16.8 && ./setup.sh -t arm-zephyr-eabi -c | |
- name: Use west repo cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: "~/**/.git" | |
key: west-git-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} | |
restore-keys: | | |
west-git- | |
- name: Dump | |
run: | | |
find /home/runner | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
verbose: 1 | |
- name: Initialize | |
run: | | |
./extra/bootstrap.sh -o=--filter=tree:0 | |
echo "CORE_TAG=$(git describe --always)" >> "$GITHUB_ENV" | |
echo "CORE_ARTIFACT=ArduinoCore-zephyr-$(git describe --always)" >> "$GITHUB_ENV" | |
echo "BOARD_NAMES=[ $(cat boards.txt | grep '^[^#]*\.build\.variant' | cut -d '.' -f 1 | sort | xargs printf '"%s",' | sed -e 's/,$//') ]" >> "$GITHUB_ENV" | |
- name: Build variants | |
run: | | |
./extra/build_all.sh -f | |
- name: Package | |
run: | | |
./extra/package.sh ${{ env.CORE_TAG }} | |
mv ../${{ env.CORE_ARTIFACT }}.tar.bz2 . | |
- name: Archive core | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.CORE_ARTIFACT }} | |
path: ${{ env.CORE_ARTIFACT }}.tar.bz2 | |
- name: Save west repo cache | |
uses: actions/cache/save@v4 | |
with: | |
path: "~/**/.git" | |
key: west-git-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} | |
test-core: | |
name: Test ${{ matrix.board }} board | |
runs-on: ubuntu-latest | |
needs: package-core | |
strategy: | |
matrix: | |
board: ${{ fromJSON( needs.package-core.outputs.BOARD_NAMES ) }} | |
fail-fast: false | |
env: | |
FQBN: arduino:zephyr:${{ matrix.board }} | |
REPORT_FILE: arduino-zephyr-${{ matrix.board }}.json | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.package-core.outputs.CORE_ARTIFACT }} | |
- name: Set up core | |
run: | | |
tar xf ${{ needs.package-core.outputs.CORE_ARTIFACT }}.tar.bz2 | |
- name: Create Blink sketch | |
run: | | |
mkdir Blink/ | |
wget -nv https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino -P Blink/ | |
- name: Compile Blink for ${{ matrix.board }} | |
uses: pillo79/compile-sketches@main | |
with: | |
fqbn: ${{ env.FQBN }} | |
platforms: | | |
# Use Board Manager to install the latest release of Arduino Zephyr Boards to get the toolchain | |
- name: "arduino:zephyr" | |
source-url: "https://downloads.arduino.cc/packages/package_zephyr_index.json" | |
- name: "arduino:zephyr" | |
source-path: "ArduinoCore-zephyr" | |
sketch-paths: Blink | |
cli-compile-flags: | | |
- '--build-property' | |
- 'compiler.c.extra_flags=-Wno-type-limits -Wno-missing-field-initializers' | |
- '--build-property' | |
- 'compiler.cpp.extra_flags=-Wno-type-limits -Wno-missing-field-initializers' | |
verbose: 'false' | |
enable-deltas-report: 'false' | |
enable-warnings-report: 'true' | |
enable-warnings-log: 'true' | |
- name: Get job ID | |
id: job_id | |
if: ${{ success() || failure() }} | |
uses: actions/github-script@main | |
with: | |
script: | | |
const { data: workflow_run } = await github.rest.actions.listJobsForWorkflowRun({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.runId | |
}); | |
const job_name = `Test ${{ matrix.board }} board` | |
return workflow_run.jobs.find((job) => job.name === job_name).id; | |
- name: Prepare log | |
if: ${{ success() || failure() }} | |
run: | | |
sed -i -e 's!/home/runner/.arduino15/packages/arduino/hardware/zephyr/[^/]*/!!g' sketches-reports/${REPORT_FILE} | |
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/ | |
- uses: actions/upload-artifact@v4 | |
if: ${{ success() || failure() }} | |
with: | |
name: test-report-${{ needs.package-core.outputs.CORE_TAG }}-${{ matrix.board }} | |
path: sketches-reports/* | |
collect-logs: | |
name: Collect logs | |
runs-on: ubuntu-latest | |
needs: | |
- package-core | |
- test-core | |
if: ${{ !cancelled() && needs.package-core.result == 'success' }} | |
env: | |
BOARD_NAMES: ${{ needs.package-core.outputs.BOARD_NAMES }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: test-report-* | |
merge-multiple: true | |
- run: | | |
echo "### Core test results:" >> "$GITHUB_STEP_SUMMARY" | |
for BOARD in $(echo $BOARD_NAMES | jq -cr '.[]'); do | |
FQBN="arduino:zephyr:$BOARD" | |
REPORT_FILE="arduino-zephyr-$BOARD.json" | |
if [ ! -f $REPORT_FILE ]; then | |
echo "* :x: $BOARD - No report found?" >> "$GITHUB_STEP_SUMMARY" | |
else | |
REPORT=$(jq -cr '.boards[0].sketches[0]' $REPORT_FILE) | |
JOB_ID=$(echo $REPORT | jq -cr '.job_id') | |
JOB_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${JOB_ID}#step:5:2" | |
if ! $(echo $REPORT | jq -cr '.compilation_success') ; then | |
echo "* :x: [$BOARD]($JOB_URL) - **Build failed**" >> "$GITHUB_STEP_SUMMARY" | |
else | |
WARNINGS=$(echo $REPORT | jq -cr '.warnings.current.absolute // 0') | |
if [ $WARNINGS -eq 0 ]; then | |
echo "* :white_check_mark: [$BOARD]($JOB_URL) - Build successful" >> "$GITHUB_STEP_SUMMARY" | |
else | |
echo >> "$GITHUB_STEP_SUMMARY" | |
echo "<details><summary>:warning: <a href=\"$JOB_URL\">$BOARD</a> - $WARNINGS warnings:</summary>" >> "$GITHUB_STEP_SUMMARY" | |
echo >> "$GITHUB_STEP_SUMMARY" | |
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY" | |
echo $REPORT | jq -cr '.warnings_log[]' >> "$GITHUB_STEP_SUMMARY" | |
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY" | |
echo >> "$GITHUB_STEP_SUMMARY" | |
echo "</details>" >> "$GITHUB_STEP_SUMMARY" | |
echo >> "$GITHUB_STEP_SUMMARY" | |
fi | |
fi | |
fi | |
done | |
- name: Clean up intermediate artifacts | |
uses: geekyeggo/[email protected] | |
with: | |
name: test-report-* | |
failOnError: false | |
publish-core: | |
name: Publish core | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' }} | |
needs: | |
- package-core | |
- test-core | |
environment: production | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
CORE_ARTIFACT: ${{ needs.package-core.outputs.CORE_ARTIFACT }} | |
ARTIFACT_FILE: ${{ needs.package-core.outputs.CORE_ARTIFACT }}.tar.bz2 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.CORE_ARTIFACT }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.IAM_ROLE }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Upload artifact | |
run: aws s3 cp ${{ env.ARTIFACT_FILE }} s3://${{ secrets.S3_BUCKET }}/ | |
publish-json: | |
name: Publish json | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' }} | |
needs: | |
- package-core | |
- publish-core | |
env: | |
CORE_ARTIFACT: ${{ needs.package-core.outputs.CORE_ARTIFACT }} | |
ARTIFACT_FILE: ${{ needs.package-core.outputs.CORE_ARTIFACT }}.tar.bz2 | |
CORE_TAG: ${{ needs.package-core.outputs.CORE_TAG }} | |
PACKAGE_INDEX_JSON: zephyr-core-${{ needs.package-core.outputs.CORE_TAG }}.json | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
sparse-checkout: | | |
extra/gen_package_index_json.sh | |
extra/zephyr-core-template.json | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.CORE_ARTIFACT }} | |
# uses: ARTIFACT_FILE CORE_TAG PACKAGE_INDEX_JSON | |
- name: Prepare package index snippet | |
run: ./extra/gen_package_index_json.sh | |
- name: Archive package index snippet | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PACKAGE_INDEX_JSON }} | |
path: ${{ env.PACKAGE_INDEX_JSON }} |