Skip to content

Commit 81b884a

Browse files
committed
wip2
1 parent e876b7b commit 81b884a

File tree

2 files changed

+61
-28
lines changed

2 files changed

+61
-28
lines changed

.github/workflows/package_core.yml

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
name: Package core
1+
name: Package, test and upload
22

33
on: [push, pull_request]
44

55
jobs:
6+
67
package-core:
78
runs-on: ubuntu-latest
89
env:
910
ZEPHYR_SDK_INSTALL_DIR: /opt/zephyr-sdk-0.16.8
11+
outputs:
12+
CORE_TAG: ${{ env.CORE_TAG }}
13+
ARTIFACT_NAME: ${{ env.ARTIFACT_NAME }}
14+
FQBNS: ${{ env.FQBNS }}
1015
steps:
1116
- name: Install toolchain
1217
working-directory: /opt
@@ -19,51 +24,78 @@ jobs:
1924
- uses: actions/checkout@v4
2025

2126
- name: Initialize
27+
id: init
2228
run: |
2329
./extra/bootstrap.sh
2430
echo "CORE_TAG=$(git describe --always)" >> "$GITHUB_ENV"
31+
echo "ARTIFACT_NAME=ArduinoCore-zephyr-$(git describe --always)" >> "$GITHUB_ENV"
32+
echo "FQBNS=[ $(cat boards.txt | grep '^[^#]*\.build\.variant' | cut -d '.' -f 1 | xargs printf '"%s",' | sed -e 's/,$//') ]" >> "$GITHUB_ENV"
2533
2634
- name: Build
2735
run: ./extra/build_all.sh -f
2836

2937
- name: Package
3038
run: |
3139
./extra/package.sh ${{ env.CORE_TAG }}
32-
mv ../ArduinoCore-zephyr-* .
40+
mv ../${{ env.ARTIFACT_NAME }}.tar.bz2 .
3341
34-
- name: Archive core
35-
uses: actions/upload-artifact@v4
42+
- uses: actions/upload-artifact@v4
3643
with:
37-
name: ArduinoCore-zephyr-${{ env.CORE_TAG }}
38-
path: ArduinoCore-zephyr-${{ env.CORE_TAG }}.*
44+
name: ${{ env.ARTIFACT_NAME }}
45+
path: ${{ env.ARTIFACT_NAME }}.tar.bz2
46+
3947
test-core:
4048
runs-on: ubuntu-latest
49+
needs: package-core
50+
strategy:
51+
matrix:
52+
fqbn: ${{ fromJSON( needs.package-core.outputs.FQBNS ) }}
53+
fail-fast: false
4154
steps:
4255
- uses: actions/download-artifact@v4
4356

44-
- name: Prepare core
57+
- name: Set up core
4558
run: |
46-
unzip ArduinoCore-zephyr-${{ github.event.inputs.CORE_TAG }}.zip
47-
tar xf ArduinoCore-zephyr-${{ github.event.inputs.CORE_TAG }}.*
48-
cd ArduinoCore-zephyr
59+
unzip ArduinoCore-zephyr-${{ needs.package-core.outputs.CORE_TAG }}.zip
60+
tar xf ArduinoCore-zephyr-${{ needs.package-core.outputs.CORE_TAG }}.tar.bz2
4961
5062
- name: Create Blink sketch
5163
run: |
52-
mkdir extra/Blink/
53-
wget https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino
54-
mv Blink.ino extra/Blink/
64+
mkdir Blink/
65+
wget https://raw.githubusercontent.com/arduino/arduino-examples/refs/heads/main/examples/01.Basics/Blink/Blink.ino -P Blink/
5566
56-
- name: Compile Blink
67+
- name: Compile Blink for ${{ matrix.fqbn }}
5768
uses: arduino/compile-sketches@main
5869
with:
59-
fqbn: arduino:zephyr:giga
70+
fqbn: arduino:zephyr:${{ matrix.fqbn }}
6071
platforms: |
6172
# Use Board Manager to install the latest release of Arduino Zephyr Boards to get the toolchain
6273
- name: "arduino:zephyr"
6374
source-url: "https://downloads.arduino.cc/packages/package_zephyr_index.json"
64-
- source-path: "./"
65-
name: "arduino:zephyr"
66-
sketch-paths: |
67-
extra/Blink
75+
- name: "arduino:zephyr"
76+
source-path: "ArduinoCore-zephyr"
77+
sketch-paths: Blink
6878
verbose: 'false'
6979
enable-deltas-report: 'false'
80+
81+
publish-artifacts:
82+
runs-on: ubuntu-latest
83+
needs:
84+
- package-core
85+
- test-core
86+
steps:
87+
- uses: actions/download-artifact@v4
88+
89+
- name: Extract artifact
90+
run: |
91+
unzip ArduinoCore-zephyr-${{ needs.package-core.outputs.CORE_TAG }}.zip
92+
93+
- name: Configure AWS credentials
94+
uses: aws-actions/configure-aws-credentials@v4
95+
with:
96+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
97+
role-session-name: "github_${{ env.PROJECT_NAME }}"
98+
aws-region: ${{ env.AWS_REGION }}
99+
100+
- name: Upload to Arduino download server
101+
run: aws s3 sync ArduinoCore-zephyr-${{ needs.package-core.outputs.CORE_TAG }}.tar.bz2 s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}nightly

extra/build_all.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,28 @@ jq -cr '.[]' < ./extra/targets.json | while read -r item; do
3030
args=$(jq -cr '.args // ""' <<< "$item")
3131

3232
variant=$(extra/get_variant_name.sh "$board" || echo "$board")
33-
if [ -z "$GITHUB_STEP_SUMMARY" ] ; then
34-
echo && echo && echo
35-
echo ${variant}
36-
echo ${variant} | sed -e 's/./=/g'
37-
echo
38-
else
39-
echo "::group::Building for ${variant}"
33+
echo && echo && echo
34+
echo ${variant}
35+
echo ${variant} | sed -e 's/./=/g'
36+
if [ ! -z "$GITHUB_STEP_SUMMARY" ] ; then
37+
echo "::group::Build log"
4038
fi
4139

4240
./extra/build.sh "$board" $args
4341
result=$?
4442

4543
if [ ! -z "$GITHUB_STEP_SUMMARY" ] ; then
4644
if [ $result -eq 0 ] ; then
47-
echo "- :heavy_check_mark: ${variant}" >> "$GITHUB_STEP_SUMMARY"
45+
echo ":heavy_check_mark: ${variant}" >> "$GITHUB_STEP_SUMMARY"
4846
else
4947
echo "::error::Build failure for ${variant}"
50-
echo "- :x: ${variant}" >> "$GITHUB_STEP_SUMMARY"
48+
echo ":x: ${variant}" >> "$GITHUB_STEP_SUMMARY"
5149
fi
5250
echo "::endgroup::"
5351
fi
5452

53+
echo "${variant} result: $result"
5554
[ $result -ne 0 ] && ! $FORCE && exit $result
5655
done
56+
57+
exit 0

0 commit comments

Comments
 (0)