Skip to content

Commit d7191d9

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 d7191d9

File tree

4 files changed

+50
-22
lines changed

4 files changed

+50
-22
lines changed

Diff for: .github/workflows/build.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
name: Build
1+
name: Build native Zephyr samples
22

33
on: [push, pull_request]
44

55
jobs:
66
build:
7+
name: Build native Zephyr samples
78
runs-on: ubuntu-latest
89
container: zephyrprojectrtos/ci:latest
910
env:
1011
CMAKE_PREFIX_PATH: /opt/toolchains
11-
PR_NUMBER: ${{ github.event.number }}
12+
CCACHE_IGNOREOPTIONS: -specs=*
13+
REPOSITORY: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
14+
BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}
1215
steps:
1316
- name: Initialize
1417
run: |
1518
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
19+
west init -m https://github.com/${{ env.REPOSITORY }} --mr ${{ env.BRANCH }}
20+
west update -o=--filter=tree:0
21+
22+
- name: ccache
23+
uses: hendrikmuhs/[email protected]
24+
with:
25+
verbose: 1
2226

2327
- name: Build fade
2428
working-directory: build
@@ -33,4 +37,4 @@ jobs:
3337
- name: Build adc
3438
working-directory: build
3539
run: |
36-
west build -p -b arduino_nano_33_ble/nrf52840/sense modules/lib/ArduinoCore-zephyr/samples/analog_input
40+
west build -p -b arduino_nano_33_ble/nrf52840/sense modules/lib/ArduinoCore-zephyr/samples/analog_input

Diff for: .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: |

Diff for: 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

Diff for: 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)