-
Notifications
You must be signed in to change notification settings - Fork 27
136 lines (121 loc) · 4.49 KB
/
samples_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build Sidewalk samples
on:
workflow_call:
inputs:
nrf_revision:
type: string
required: false
default: "main"
save_images:
type: boolean
required: false
default: true
boards_to_test:
type: string
required: true
default: '["nrf52840dk/nrf52840", "nrf5340dk/nrf5340/cpuapp", "nrf54l15dk/nrf54l15/cpuapp", "nrf54l15dk/nrf54l15/cpuapp/ns", "nrf54l15dk/nrf54l10/cpuapp"]'
jobs:
build_samples:
strategy:
fail-fast: false
matrix:
subset: [1, 2, 3]
board: ${{ fromJson(inputs.boards_to_test) }}
env:
MAX_SUBSETS: 3
runs-on: ubuntu-24.04
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2
defaults:
run:
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: sidewalk
- name: update NRF
run: |
rm -rf .west nrf;
cp -r /workdir/nrf nrf;
cd sidewalk && git rev-parse HEAD > /workdir/sidewalk_hash && cd .. &&
west init -l nrf &&
cd nrf &&
git fetch origin ${{inputs.nrf_revision}}:PR-branch &&
git checkout PR-branch &&
cd .. &&
west config manifest.group-filter +sidewalk &&
west update -n -o=--depth=1 --path-cache /workdir/ &&
cd sidewalk && git checkout `cat /workdir/sidewalk_hash` && rm -rf /workdir/sidewalk_hash
- name: Install Python dependencies
run: |
python3 -m pip install -r nrf/scripts/requirements.txt -r zephyr/scripts/requirements.txt -r sidewalk/scripts/ci/requirements.txt
- name: Replace slash with underscore
id: replace
run: |
TARGET_BOARD=${{ matrix.board }}
TARGET_BOARD=${TARGET_BOARD//\//_}
echo "target_board=$TARGET_BOARD" >> $GITHUB_OUTPUT
- name: Ccache
id: ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-samples-${{ matrix.subset }}-${{ steps.replace.outputs.target_board}}-${{ github.run_id }}
restore-keys: ccache-samples-${{ matrix.subset }}-${{ steps.replace.outputs.target_board}}-
- name: Twister build samples
run: |
source zephyr/zephyr-env.sh
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --platform ${{ matrix.board }} --inline-logs --overflow-as-errors --enable-size-report --show-footprint -vvv --build-only --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }}
- name: Print ccache stats
run: |
ccache -ps;
- name: Prepare artifacts for upload
run: |
mkdir -p subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}_${{ steps.replace.outputs.target_board}}
cp twister-out/twister.json subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}_${{ steps.replace.outputs.target_board}}
- name: Upload build metadata
uses: actions/upload-artifact@v4
if: always()
with:
name: sample-artifacts-meta-${{ matrix.subset }}-${{ steps.replace.outputs.target_board}}
path: |
subsets
twister-out/**/build.log
twister-out/**/.config
twister-out/**/runners.yaml
twister-out/**/*.dts
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.save_images }}
with:
name: sample-artifacts-build-${{ matrix.subset }}-${{ steps.replace.outputs.target_board}}
path: |
subsets
twister-out/**/zephyr.elf
twister-out/**/zephyr.hex
twister-out/**/merged.hex
twister-out/**/merged_domains.hex
twister-out/**/dfu_multi_image.bin
twister-out/**/dfu_application.zip
merge_sample_artifacts:
needs: build_samples
runs-on: ubuntu-24.04
if: always()
permissions: write-all
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
delete-merged: true
name: sample-artifacts-meta
pattern: sample-artifacts-meta-*
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
if: ${{ inputs.save_images }}
with:
delete-merged: true
name: sample-artifacts
pattern: sample-artifacts-build-*