Skip to content

Commit 2e0b029

Browse files
committed
github: optimize CI
- Pass filter:tree=0 to reduce download size - Initialize and use ccache - Run CI on PRs and on 'arduino' branch pushes only
1 parent bd3a17b commit 2e0b029

File tree

4 files changed

+47
-22
lines changed

4 files changed

+47
-22
lines changed

.github/workflows/build.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Build native Zephyr samples
22

33
on: [push, pull_request]
44

@@ -8,17 +8,18 @@ jobs:
88
container: zephyrprojectrtos/ci:latest
99
env:
1010
CMAKE_PREFIX_PATH: /opt/toolchains
11-
PR_NUMBER: ${{ github.event.number }}
11+
CCACHE_IGNOREOPTIONS: -specs=*
1212
steps:
1313
- name: Initialize
1414
run: |
1515
mkdir build && cd build
16-
west init -m https://github.com/${{ github.repository }}
17-
cd modules/lib/ArduinoCore-zephyr/
18-
git fetch origin ${{ github.ref }}
19-
git checkout FETCH_HEAD
20-
cd -
21-
west update
16+
west init -m https://github.com/${{ github.repository }} --mr ${{ env.GITHUB_REF }}
17+
west update -o=--filter=tree:0
18+
19+
- name: ccache
20+
uses: hendrikmuhs/[email protected]
21+
with:
22+
verbose: 1
2223

2324
- name: Build fade
2425
working-directory: build
@@ -33,4 +34,4 @@ jobs:
3334
- name: Build adc
3435
working-directory: build
3536
run: |
36-
west build -p -b arduino_nano_33_ble/nrf52840/sense modules/lib/ArduinoCore-zephyr/samples/analog_input
37+
west build -p -b arduino_nano_33_ble/nrf52840/sense modules/lib/ArduinoCore-zephyr/samples/analog_input

.github/workflows/package_core.yml

+35-11
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,59 @@
1-
name: Package core
1+
name: Package, test and upload core
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- arduino
7+
pull_request:
48

59
jobs:
6-
build:
10+
11+
package-core:
12+
name: Build and package core
713
runs-on: ubuntu-latest
814
env:
915
ZEPHYR_SDK_INSTALL_DIR: /opt/zephyr-sdk-0.16.8
16+
CCACHE_IGNOREOPTIONS: -specs=*
1017
steps:
1118
- name: Install toolchain
1219
working-directory: /opt
1320
run: |
1421
sudo apt-get update
15-
sudo apt-get install -y --no-install-recommends git cmake wget python3-pip ninja-build
16-
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.8/zephyr-sdk-0.16.8_linux-x86_64_minimal.tar.xz
22+
sudo apt-get install -y --no-install-recommends git cmake wget python3-pip ninja-build ccache
23+
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
1724
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
1825
1926
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
persist-credentials: false
2030

2131
- name: Initialize
2232
run: |
23-
./extra/bootstrap.sh
24-
./extra/build_all.sh
25-
./extra/package.sh `git describe --always`
26-
mv ../arduino-core-zephyr-llext* .
33+
./extra/bootstrap.sh -o=--filter=tree:0
34+
echo "CORE_TAG=$(git describe --always)" >> "$GITHUB_ENV"
35+
echo "CORE_ARTIFACT=ArduinoCore-zephyr-$(git describe --always)" >> "$GITHUB_ENV"
36+
echo "BOARD_NAMES=[ $(cat boards.txt | grep '^[^#]*\.build\.variant' | cut -d '.' -f 1 | xargs printf '"%s",' | sed -e 's/,$//') ]" >> "$GITHUB_ENV"
37+
38+
- name: ccache
39+
uses: hendrikmuhs/[email protected]
40+
with:
41+
verbose: 1
42+
43+
- name: Build variants
44+
run: |
45+
./extra/build_all.sh -f
46+
47+
- name: Package
48+
run: |
49+
./extra/package.sh ${{ env.CORE_TAG }}
50+
mv ../${{ env.CORE_ARTIFACT }}.tar.bz2 .
2751
2852
- name: Archive core
2953
uses: actions/upload-artifact@v4
3054
with:
31-
name: Core
32-
path: arduino-core-zephyr-llext*
55+
name: ${{ env.CORE_ARTIFACT }}
56+
path: ${{ env.CORE_ARTIFACT }}.tar.bz2
3357

3458
- name: Create Blink sketch
3559
run: |

extra/bootstrap.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ python3 -m venv venv
99
source venv/bin/activate
1010
pip install west
1111
west init -l .
12-
west update
12+
west update "$@"
1313
west zephyr-export
1414
pip install -r ../zephyr/scripts/requirements-base.txt
1515
# download slim toolchain from https://github.com/zephyrproject-rtos/sdk-ng/releases/tag/v0.16.8

extra/package.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ FOLDER=`basename $PWD`
1010
VERSION=$1
1111

1212
cd ..
13-
tar --exclude=extras/** --exclude=.git* --exclude=build --exclude=venv --exclude=samples -cjhf arduino-core-zephyr-llext-${VERSION}.tar.bz2 $FOLDER
13+
tar --exclude=extras/** --exclude=.git* --exclude=build --exclude=venv --exclude=samples -cjhf ArduinoCore-zephyr-${VERSION}.tar.bz2 $FOLDER

0 commit comments

Comments
 (0)