Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fd0ea3e
ci: add integration train workflow
nashif Aug 23, 2026
e46d4ff
add integration to twister workflow
nashif Aug 25, 2026
5eed5fa
do not link/mention folks
nashif Aug 26, 2026
73dd58f
run on integration branches...
nashif Aug 31, 2026
22fa4a5
fix typo
nashif Aug 31, 2026
f05d932
remove metadata check for now
nashif Sep 14, 2026
49b8aa7
ci: merge_criteria: report merge criteria as a check run
nashif Sep 14, 2026
71a5167
scripts: get_maintainer: add requires-maintainer-approval area key
nashif Sep 14, 2026
8596394
ci: merge_criteria: add criteria based on MAINTAINERS.yml
nashif Sep 14, 2026
70a6513
MAINTAINERS: Kernel: require maintainer approval
nashif Sep 14, 2026
a3108a5
scripts: twister: pack subsets by test suite instead of slicing
kartben Aug 31, 2026
af1a342
fix rebase
nashif Nov 3, 2026
f711292
ci: github: add an AI review workflow for pull requests
nashif Nov 5, 2026
5c7af86
ci: assigner: only run on zephyrproject-rtos/zephyr
nashif Nov 5, 2026
3da73ea
ci: assigner: add PR size labels
nashif Nov 5, 2026
86fa518
lib: os: add 64-by-32 division by reciprocal
npitre Oct 28, 2026
c3a6f4a
tests: lib: div64: test division by a constant
npitre Oct 28, 2026
f8412fb
lib: os: div64: add reciprocals of run-time divisors
npitre Oct 28, 2026
1e558bb
tests: lib: div64: test reciprocals of run-time divisors
npitre Oct 28, 2026
651fa7f
sys: time_units: divide by reciprocal on 32-bit targets
npitre Oct 26, 2026
686612d
tests: unit: time_units: check conversions divided by reciprocal
npitre Oct 26, 2026
9551a6f
lib: os: clock: divide by reciprocal on 32-bit targets
npitre Oct 26, 2026
fc91142
lib: utils: timeutil: divide the year by reciprocal
npitre Oct 26, 2026
2490b18
shell: kernel_service: uptime: divide by reciprocal
npitre Oct 26, 2026
c36ed2b
lib: os: div64: share the reciprocals of common divisors
npitre Oct 27, 2026
4897525
tests: lib: div64: check constant folding and reciprocal use
npitre Oct 27, 2026
e0bf72d
doc: kernel: add a page on 64-bit division by reciprocal
npitre Oct 28, 2026
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
72 changes: 72 additions & 0 deletions .github/workflows/ai_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Zephyr AI Review

on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review, labeled]
workflow_dispatch:
inputs:
pr_number:
description: "Pull request number to review"
required: true
type: string
publish:
description: "post the review, or ask (save it as an artifact only)"
required: false
default: "post"
type: choice
options: [post, ask]

permissions:
contents: read
pull-requests: write
checks: read # ci_status: check runs on the head commit
actions: read # ci_failure_logs: failed job logs

concurrency:
group: ai-review-${{ github.event.pull_request.number || inputs.pr_number }}
cancel-in-progress: true

jobs:
review:
name: Review
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out the base branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.base.ref || github.ref }}
fetch-depth: 200
persist-credentials: false

# The action fetches the head commit and the merge base by SHA itself when they are missing,
# so a shallow checkout is enough. A deeper fetch-depth only improves file_history and blame.

- name: Review
id: review
uses: zephyrproject-rtos/zephyr-review-agent@v0.1 # main
with:
openrouter_api_key: ${{ secrets.OPENROUTER_API_KEY }}
pr_number: ${{ inputs.pr_number }}
pipeline: multi-stage
# Models come from repository variables so they can change without a workflow edit:
# AI_REVIEW_MODEL verifies and finalizes, AI_REVIEW_DRAFT_ENSEMBLE (comma-separated) runs
# the specialist passes. The literals are the defaults when a variable is unset.
model: ${{ vars.AI_REVIEW_MODEL || 'google/gemini-3.8-flash' }}
draft_ensemble: ${{ vars.AI_REVIEW_DRAFT_ENSEMBLE || 'deepseek/deepseek-v4.1-flash,z-ai/glm-5.3-flash' }}
provider: '{"data_collection": "deny"}'
specialist_max_steps: "25"
# Label-gated on pull request events; a manual run reviews the given PR regardless.
required_labels: ${{ github.event_name == 'workflow_dispatch' && '' || 'ai-review' }}
skip_reviewed: same-head
publish: ${{ inputs.publish || 'post' }}
quiet: "true"

- name: Upload review artifacts
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ai-review-${{ github.event.pull_request.number || inputs.pr_number }}-${{ github.run_id }}
path: review-output/
retention-days: 30
4 changes: 3 additions & 1 deletion .github/workflows/assigner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ permissions:
jobs:
assignment:
name: Pull Request/Issue Assignment
if: github.event.pull_request.draft == false
if: github.event.pull_request.draft == false &&
github.repository == 'zephyrproject-rtos/zephyr'
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
Expand Down Expand Up @@ -66,6 +67,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }}
run: |
FLAGS="--size-labels"
FLAGS="-v"
FLAGS+=" -o ${{ github.event.repository.owner.login }}"
FLAGS+=" -r ${{ github.event.repository.name }}"
Expand Down
156 changes: 156 additions & 0 deletions .github/workflows/integration-train.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Integration Train

# Build a branch containing every pull request the merge list reports as
# ready for a target branch, push it, and open (or refresh) a draft PR so the
# full CI suite runs on the combined result before the PRs are merged
# individually.
#
# The PRs and the target branch are fetched from `source_repo`; the train
# branch and the draft PR are created in the repository running this
# workflow. That lets the workflow run from a staging repository such as
# zephyr-testing against the PR queue of zephyrproject-rtos/zephyr. The
# draft PR is opened against this repository's own `<target>` branch, which
# is assumed to be kept in sync with the source repository.

on:
workflow_dispatch:
inputs:
target:
description: Target branch to build the train for
type: string
default: main
source_repo:
description: Repository (owner/name) the PRs and target branch come from
type: string
default: zephyrproject-rtos/zephyr
max_prs:
description: Cap on the number of PRs in the train (0 = no cap)
type: number
default: 0
prs:
description: Explicit PR numbers (space separated) instead of the merge list
type: string
default: ''

permissions:
contents: write
pull-requests: write

concurrency:
group: integration-train-${{ inputs.target || 'main' }}
cancel-in-progress: false

jobs:
build-train:
name: Build integration branch
runs-on: ubuntu-latest
timeout-minutes: 30
env:
TARGET: ${{ inputs.target || 'main' }}
SOURCE_REPO: ${{ inputs.source_repo || 'zephyrproject-rtos/zephyr' }}
# A PR opened with the default GITHUB_TOKEN does not trigger CI on
# itself. Use a token with contents+pull-requests write from a bot
# account or GitHub App so the draft PR gets a real CI verdict.
GH_TOKEN: ${{ secrets.INTEGRATION_TRAIN_TOKEN || secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
token: ${{ secrets.INTEGRATION_TRAIN_TOKEN || secrets.GITHUB_TOKEN }}
persist-credentials: true

- name: Configure git
run: |
git config user.name "Zephyr Integration Train"
git config user.email "integration-train@users.noreply.github.com"

- name: Build the integration branch
id: train
run: |
BRANCH="integration/${TARGET}"
EXTRA=()
if [ -n "${{ inputs.prs }}" ]; then
EXTRA+=(--prs ${{ inputs.prs }})
fi
python3 scripts/ci/integration_train.py \
--target "${TARGET}" \
--remote "${{ github.server_url }}/${SOURCE_REPO}.git" \
--repo "${SOURCE_REPO}" \
--branch "${BRANCH}" \
--max-prs "${{ inputs.max_prs || 0 }}" \
--report integration-report.json \
--body integration-body.md \
"${EXTRA[@]}"
{
echo "branch=${BRANCH}"
python3 - <<'PY'
import json
r = json.load(open("integration-report.json"))
print(f"empty={str(r.get('empty', False)).lower()}")
print(f"base={r.get('base', '')}")
print(f"merged={len(r.get('merged', []))}")
print(f"failed={len(r.get('failed', []))}")
PY
} >> "$GITHUB_OUTPUT"

- name: Upload report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: integration-train-${{ env.TARGET }}
path: |
integration-report.json
integration-body.md

- name: Push the train branch
if: steps.train.outputs.empty != 'true'
run: |
git push --force origin "HEAD:refs/heads/${{ steps.train.outputs.branch }}"

- name: Open or refresh the draft PR
if: steps.train.outputs.empty != 'true'
env:
BRANCH: ${{ steps.train.outputs.branch }}
REPO: ${{ github.repository }}
run: |
BASE="${TARGET}"
DATE=$(date -u +%Y-%m-%d)
TITLE="[DNM] integration: ${TARGET} ${DATE} (${{ steps.train.outputs.merged }} PRs)"
{
cat integration-body.md
echo
echo "_Source: ${SOURCE_REPO} \`${TARGET}\` at \`${{ steps.train.outputs.base }}\`. Built by [${{ github.workflow }} #${{ github.run_number }}](${{ github.server_url }}/${REPO}/actions/runs/${{ github.run_id }})._"
} > body.md

EXISTING=$(gh pr list --repo "$REPO" --head "$BRANCH" --base "$BASE" \
--state open --json number --jq '.[0].number // empty')
if [ -n "$EXISTING" ]; then
echo "refreshing draft PR #$EXISTING"
gh pr edit "$EXISTING" --repo "$REPO" --title "$TITLE" --body-file body.md
gh pr comment "$EXISTING" --repo "$REPO" \
--body "Train rebuilt: ${{ steps.train.outputs.merged }} merged, ${{ steps.train.outputs.failed }} skipped. See the updated description."
else
if gh label list --repo "$REPO" --search DNM --json name --jq '.[].name' | grep -qx DNM; then
LABEL=(--label DNM)
else
LABEL=()
fi
gh pr create --repo "$REPO" --draft \
--base "$BASE" --head "$BRANCH" \
--title "$TITLE" --body-file body.md "${LABEL[@]}"
fi

- name: Summary
if: always()
run: |
{
echo "## Integration train: ${SOURCE_REPO} ${TARGET}"
if [ "${{ steps.train.outputs.empty }}" = "true" ]; then
echo "No ready PRs; nothing built."
else
echo "- merged: ${{ steps.train.outputs.merged }}"
echo "- could not merge: ${{ steps.train.outputs.failed }}"
echo
cat integration-body.md
fi
} >> "$GITHUB_STEP_SUMMARY"
148 changes: 148 additions & 0 deletions .github/workflows/merge_criteria.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Merge Criteria

# Reports the "Merge Criteria" check run on the pull request head: in progress
# until every criterion in scripts/ci/merge_criteria.py is met, completed
# successfully afterwards. Its output lists every criterion and what is still
# needed. Mark that check run, not this job, as required in branch protection.
#
# All triggers run the workflow and script from the base branch with a token
# that can write check runs, also for pull requests from forks. Pull request
# code is never checked out. Review events only reach this workflow through
# the "Merge Criteria Review" workflow, because pull_request_review runs get a
# read-only token for forks. The schedule re-evaluates all open non-draft pull
# requests so that ended review periods are reported without another event.
# Draft pull requests are skipped by every trigger.
#
# Repository variables:
# MERGE_CRITERIA_USE_MAINTAINERS: "true" enables the criteria based on
# MAINTAINERS.yml (system wide change label, area approvals).
# MERGE_CRITERIA_SYSTEM_WIDE_AREAS: changed areas above which a pull request
# is a system wide change.
# MERGE_CRITERIA_SYSTEM_WIDE_REVIEW_DAYS: review period of a system wide
# change in business days.

on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- assigned
- unassigned
- labeled
- unlabeled
- ready_for_review
workflow_run:
workflows:
- Merge Criteria Review
types:
- completed
schedule:
- cron: '17 * * * *'
workflow_dispatch:

permissions:
checks: write
contents: read
pull-requests: write

concurrency:
# Serialize runs for the same head commit so the check run written last is
# computed from the latest reviews, labels and assignees. Scheduled and
# manual runs share one group.
group: >-
${{ github.workflow }}-${{ github.event.pull_request.head.sha ||
github.event.workflow_run.head_sha || 'all' }}
cancel-in-progress: false

jobs:
update-check:
name: Update check run
if: >-
(github.event_name == 'pull_request_target' && !github.event.pull_request.draft) ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
(github.repository_owner == 'zephyrproject-rtos' &&
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'))
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
USE_MAINTAINERS: ${{ vars.MERGE_CRITERIA_USE_MAINTAINERS == 'true' }}
steps:
- name: Checkout
if: env.USE_MAINTAINERS != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
sparse-checkout: |
scripts/ci/merge_criteria.py
scripts/requirements-actions-basic.txt
sparse-checkout-cone-mode: false

# Loading MAINTAINERS.yml checks its file patterns against the tree.
- name: Checkout with maintainers file
if: env.USE_MAINTAINERS == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.12
cache: pip
cache-dependency-path: scripts/requirements-actions-basic.txt

- name: Install Python dependencies
run: |
pip install -r scripts/requirements-actions-basic.txt --require-hashes

- name: Select criteria
env:
SYSTEM_WIDE_AREAS: ${{ vars.MERGE_CRITERIA_SYSTEM_WIDE_AREAS }}
SYSTEM_WIDE_REVIEW_DAYS: ${{ vars.MERGE_CRITERIA_SYSTEM_WIDE_REVIEW_DAYS }}
run: |
FLAGS=""
if [ "$USE_MAINTAINERS" = "true" ]; then
FLAGS+=" -M MAINTAINERS.yml"
fi
if [ -n "$SYSTEM_WIDE_AREAS" ]; then
FLAGS+=" --system-wide-areas $SYSTEM_WIDE_AREAS"
fi
if [ -n "$SYSTEM_WIDE_REVIEW_DAYS" ]; then
FLAGS+=" --system-wide-review-days $SYSTEM_WIDE_REVIEW_DAYS"
fi
echo "MERGE_CRITERIA_FLAGS=$FLAGS" >> "$GITHUB_ENV"

- name: Update check run for pull request event
if: github.event_name == 'pull_request_target'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
ORG: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}
run: |
python -u scripts/ci/merge_criteria.py -p "$PR_NUMBER" -o "$ORG" -r "$REPO" \
$MERGE_CRITERIA_FLAGS

- name: Update check run for review event
if: github.event_name == 'workflow_run'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_OWNER: ${{ github.event.workflow_run.head_repository.owner.login }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
ORG: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}
run: |
python -u scripts/ci/merge_criteria.py \
--head "$HEAD_OWNER:$HEAD_BRANCH" --sha "$HEAD_SHA" -o "$ORG" -r "$REPO" \
$MERGE_CRITERIA_FLAGS

- name: Update check runs for all open pull requests
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
run: |
python -u scripts/ci/merge_criteria.py --all \
-o "${REPOSITORY%%/*}" -r "${REPOSITORY#*/}" $MERGE_CRITERIA_FLAGS
Loading
Loading