Skip to content

Commit f47d393

Browse files
ci: Synchronize with sdk-nrf
This commit is dedicated to checking synchronization between ncs-matter and the newest sdk-nrf and sdk-connectedhomeip. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent cce83b9 commit f47d393

11 files changed

Lines changed: 1105 additions & 0 deletions

.github/workflows/on_sync_pr.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: SDK sync PR build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
branches:
7+
- sdk-nrf
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ncs-matter-sdk-sync-${{ github.event.pull_request.number }}
14+
cancel-in-progress: true
15+
16+
env:
17+
CCACHE_DIR: ${{ github.workspace }}/.ccache
18+
CCACHE_COMPILERCHECK: content
19+
CCACHE_MAXSIZE: 2G
20+
CCACHE_SLOPPINESS: file_macro,time_macros,include_file_mtime,include_file_ctime
21+
WEST_PATH_CACHE: ${{ github.workspace }}/west-path-cache
22+
23+
jobs:
24+
template-twister:
25+
if: |
26+
github.event.pull_request.head.ref == 'sdk-sync/test' &&
27+
github.event.pull_request.base.ref == 'sdk-nrf'
28+
runs-on: ubuntu-24.04
29+
container: ghcr.io/nrfconnect/sdk-nrf-toolchain:v3.4.0
30+
defaults:
31+
run:
32+
shell: bash
33+
steps:
34+
- name: Checkout pull request
35+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
36+
with:
37+
ref: ${{ github.event.pull_request.head.sha }}
38+
fetch-depth: 0
39+
path: ncs-matter
40+
41+
- name: Restore west module path cache
42+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
43+
with:
44+
path: west-path-cache
45+
key: west-path-cache-${{ hashFiles('ncs-matter/west.yml') }}
46+
restore-keys: |
47+
west-path-cache-
48+
49+
- name: Restore ccache
50+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
51+
with:
52+
path: .ccache
53+
key: ccache-ncs-matter-${{ hashFiles('ncs-matter/west.yml') }}-${{ github.base_ref }}
54+
restore-keys: |
55+
ccache-ncs-matter-${{ hashFiles('ncs-matter/west.yml') }}-
56+
ccache-ncs-matter-
57+
58+
- name: Restore pip cache
59+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
60+
with:
61+
path: ~/.cache/pip
62+
key: pip-ncs-matter-${{ hashFiles('ncs-matter/west.yml') }}
63+
64+
- name: Prepare west workspace
65+
run: |
66+
rm -rf .west
67+
west --version
68+
west init -l ncs-matter --mf west.yml
69+
west update -n -o=--depth=1 --path-cache "${WEST_PATH_CACHE}"
70+
71+
- name: Install Python deps for Matter
72+
run: |
73+
pip3 install -r nrf/scripts/requirements-extra.txt
74+
pip3 install -r modules/lib/matter/scripts/setup/requirements.nrfconnect.txt
75+
76+
- name: Set up ccache
77+
run: |
78+
mkdir -p "${CCACHE_DIR}"
79+
ccache -z
80+
ccache -s
81+
82+
- name: Twister build Matter template sample
83+
run: |
84+
source zephyr/zephyr-env.sh
85+
zephyr/scripts/twister \
86+
--inline-logs \
87+
--build-only \
88+
-N \
89+
--verbose \
90+
-T ncs-matter/samples/template \
91+
--scenario sample.matter.template.debug \
92+
--all
93+
94+
- name: Print ccache statistics
95+
if: always()
96+
run: ccache -s

.github/workflows/sdk-sync.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: SDK Sync
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0'
6+
workflow_dispatch:
7+
inputs:
8+
nrf_repo:
9+
description: 'sdk-nrf repository (owner/name)'
10+
required: false
11+
default: 'ArekBalysNordic/sdk-nrf'
12+
chip_repo:
13+
description: 'sdk-connectedhomeip repository (owner/name)'
14+
required: false
15+
default: 'ArekBalysNordic/sdk-connectedhomeip'
16+
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
21+
jobs:
22+
sdk-sync:
23+
runs-on: ubuntu-24.04
24+
env:
25+
SDK_SYNC_PAT: ${{ secrets.SDK_SYNC_PAT }}
26+
GH_TOKEN: ${{ secrets.SDK_SYNC_PAT }}
27+
SDK_SYNC_NRF_REPO: ${{ inputs.nrf_repo || 'ArekBalysNordic/sdk-nrf' }}
28+
SDK_SYNC_CHIP_REPO: ${{ inputs.chip_repo || 'ArekBalysNordic/sdk-connectedhomeip' }}
29+
steps:
30+
- name: Checkout the code
31+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
32+
with:
33+
fetch-depth: 0
34+
persist-credentials: false
35+
36+
- name: Set state file path
37+
run: echo "STATE_FILE=${RUNNER_TEMP}/sdk_sync_state.json" >> "$GITHUB_ENV"
38+
39+
- name: Set up Python
40+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
41+
with:
42+
python-version: '3.12'
43+
cache: pip
44+
cache-dependency-path: scripts/sdk_sync/requirements.txt
45+
46+
- name: Install dependencies
47+
run: pip install -r scripts/sdk_sync/requirements.txt
48+
49+
- name: Configure git credentials
50+
run: |
51+
git remote set-url origin "https://x-access-token:${SDK_SYNC_PAT}@github.com/${{ github.repository }}.git"
52+
git config --global user.email "sdk-sync-bot@users.noreply.github.com"
53+
git config --global user.name "sdk-sync-bot"
54+
55+
- name: Synchronize sdk-nrf with main
56+
run: python scripts/sdk_sync/sync_integration_branch.py --main-branch main --integration-branch sdk-nrf
57+
58+
- name: Synchronize sdk-connectedhomeip sdk-nrf with master
59+
run: python scripts/sdk_sync/sync_chip_branch.py
60+
61+
- name: Collect upstream revision report
62+
run: python scripts/sdk_sync/chip_sync_report.py --state-file "${STATE_FILE}"
63+
64+
- name: Prepare test branch from sdk-nrf
65+
run: python scripts/sdk_sync/prepare_pr.py --command prepare-branch --source-branch sdk-nrf --state-file "${STATE_FILE}"
66+
67+
- name: Update west.yml on test branch
68+
run: |
69+
git checkout sdk-sync/test
70+
python scripts/sdk_sync/update_manifest.py --state-file "${STATE_FILE}" --branch sdk-sync/test
71+
72+
- name: Open sync pull request
73+
run: python scripts/sdk_sync/prepare_pr.py --command open-pr --base-branch sdk-nrf --state-file "${STATE_FILE}"
74+
75+
- name: Post sync summary comment
76+
run: python scripts/sdk_sync/build_report.py --state-file "${STATE_FILE}"

scripts/sdk_sync/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2026 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Scripts for weekly sdk-nrf / sdk-connectedhomeip synchronization."""

0 commit comments

Comments
 (0)