Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/on_sync_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: SDK sync PR build

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- sdk-nrf

permissions:
contents: read

concurrency:
group: ncs-matter-sdk-sync-${{ github.event.pull_request.number }}
cancel-in-progress: true

env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_MAXSIZE: 2G
CCACHE_SLOPPINESS: file_macro,time_macros,include_file_mtime,include_file_ctime
WEST_PATH_CACHE: ${{ github.workspace }}/west-path-cache

jobs:
template-twister:
if: |
github.event.pull_request.head.ref == 'sdk-sync/test' &&
github.event.pull_request.base.ref == 'sdk-nrf'
runs-on: ubuntu-24.04
container: ghcr.io/nrfconnect/sdk-nrf-toolchain:v3.4.0
defaults:
run:
shell: bash
steps:
- name: Checkout pull request
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
path: ncs-matter

- name: Restore west module path cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: west-path-cache
key: west-path-cache-${{ hashFiles('ncs-matter/west.yml') }}
restore-keys: |
west-path-cache-

- name: Restore ccache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: .ccache
key: ccache-ncs-matter-${{ hashFiles('ncs-matter/west.yml') }}-${{ github.base_ref }}
restore-keys: |
ccache-ncs-matter-${{ hashFiles('ncs-matter/west.yml') }}-
ccache-ncs-matter-

- name: Restore pip cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: ~/.cache/pip
key: pip-ncs-matter-${{ hashFiles('ncs-matter/west.yml') }}

- name: Prepare west workspace
run: |
rm -rf .west
west --version
west init -l ncs-matter --mf west.yml
west update -n -o=--depth=1 --path-cache "${WEST_PATH_CACHE}"

- name: Install Python deps for Matter
run: |
pip3 install -r nrf/scripts/requirements-extra.txt
pip3 install -r modules/lib/matter/scripts/setup/requirements.nrfconnect.txt

- name: Set up ccache
run: |
mkdir -p "${CCACHE_DIR}"
ccache -z
ccache -s

- name: Twister build Matter template sample
run: |
source zephyr/zephyr-env.sh
zephyr/scripts/twister \
--inline-logs \
--build-only \
-N \
--verbose \
-T ncs-matter/samples/template \
--scenario sample.matter.template.debug \
--all

- name: Print ccache statistics
if: always()
run: ccache -s
76 changes: 76 additions & 0 deletions .github/workflows/sdk-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: SDK Sync

on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
inputs:
nrf_repo:
description: 'sdk-nrf repository (owner/name)'
required: false
default: 'ArekBalysNordic/sdk-nrf'
chip_repo:
description: 'sdk-connectedhomeip repository (owner/name)'
required: false
default: 'ArekBalysNordic/sdk-connectedhomeip'

permissions:
contents: write
pull-requests: write

jobs:
sdk-sync:
runs-on: ubuntu-24.04
env:
SDK_SYNC_PAT: ${{ secrets.SDK_SYNC_PAT }}
GH_TOKEN: ${{ secrets.SDK_SYNC_PAT }}
SDK_SYNC_NRF_REPO: ${{ inputs.nrf_repo || 'ArekBalysNordic/sdk-nrf' }}
SDK_SYNC_CHIP_REPO: ${{ inputs.chip_repo || 'ArekBalysNordic/sdk-connectedhomeip' }}
steps:
- name: Checkout the code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
persist-credentials: false

- name: Set state file path
run: echo "STATE_FILE=${RUNNER_TEMP}/sdk_sync_state.json" >> "$GITHUB_ENV"

- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: scripts/sdk_sync/requirements.txt

- name: Install dependencies
run: pip install -r scripts/sdk_sync/requirements.txt

- name: Configure git credentials
run: |
git remote set-url origin "https://x-access-token:${SDK_SYNC_PAT}@github.com/${{ github.repository }}.git"
git config --global user.email "sdk-sync-bot@users.noreply.github.com"
git config --global user.name "sdk-sync-bot"

- name: Synchronize sdk-nrf with main
run: python scripts/sdk_sync/sync_integration_branch.py --main-branch main --integration-branch sdk-nrf

- name: Synchronize sdk-connectedhomeip sdk-nrf with master
run: python scripts/sdk_sync/sync_chip_branch.py

- name: Collect upstream revision report
run: python scripts/sdk_sync/chip_sync_report.py --state-file "${STATE_FILE}"

- name: Prepare test branch from sdk-nrf
run: python scripts/sdk_sync/prepare_pr.py --command prepare-branch --source-branch sdk-nrf --state-file "${STATE_FILE}"

- name: Update west.yml on test branch
run: |
git checkout sdk-sync/test
python scripts/sdk_sync/update_manifest.py --state-file "${STATE_FILE}" --branch sdk-sync/test

- name: Open sync pull request
run: python scripts/sdk_sync/prepare_pr.py --command open-pr --base-branch sdk-nrf --state-file "${STATE_FILE}"

- name: Post sync summary comment
run: python scripts/sdk_sync/build_report.py --state-file "${STATE_FILE}"
4 changes: 4 additions & 0 deletions scripts/sdk_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2026 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

"""Scripts for weekly sdk-nrf / sdk-connectedhomeip synchronization."""
Loading
Loading