Skip to content

Commit e5284f7

Browse files
committed
wip2
1 parent e876b7b commit e5284f7

File tree

1 file changed

+49
-19
lines changed

1 file changed

+49
-19
lines changed

.github/workflows/package_core.yml

Lines changed: 49 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,76 @@ 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( jobs.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-${{ jobs.package-core.outputs.CORE_TAG }}.zip
60+
tar xf ArduinoCore-zephyr-${{ jobs.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: test-core
84+
steps:
85+
- uses: actions/download-artifact@v4
86+
87+
- name: Extract artifact
88+
run: |
89+
unzip ArduinoCore-zephyr-${{ jobs.package-core.outputs.CORE_TAG }}.zip
90+
91+
- name: Configure AWS credentials
92+
uses: aws-actions/configure-aws-credentials@v4
93+
with:
94+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
95+
role-session-name: "github_${{ env.PROJECT_NAME }}"
96+
aws-region: ${{ env.AWS_REGION }}
97+
98+
- name: Upload to Arduino download server
99+
run: aws s3 sync ArduinoCore-zephyr-${{ jobs.package-core.outputs.CORE_TAG }}.tar.bz2 s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}nightly

0 commit comments

Comments
 (0)