Skip to content

Commit c9c619b

Browse files
committed
redo twister workflow
Signed-off-by: Anas Nashif <[email protected]>
1 parent af46c36 commit c9c619b

File tree

1 file changed

+96
-1
lines changed

1 file changed

+96
-1
lines changed

.github/workflows/twister.yaml

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,102 @@ concurrency:
2424

2525
jobs:
2626
twister-build-prep:
27-
uses: ./.github/workflows/twister-prep.yaml
27+
if: github.repository_owner == 'zephyrproject-rtos'
28+
runs-on: ubuntu-24.04
29+
outputs:
30+
subset: ${{ steps.output-services.outputs.subset }}
31+
size: ${{ steps.output-services.outputs.size }}
32+
fullrun: ${{ steps.output-services.outputs.fullrun }}
33+
env:
34+
MATRIX_SIZE: 10
35+
PUSH_MATRIX_SIZE: 20
36+
WEEKLY_MATRIX_SIZE: 200
37+
BSIM_OUT_PATH: /opt/bsim/
38+
BSIM_COMPONENTS_PATH: /opt/bsim/components
39+
TESTS_PER_BUILDER: 900
40+
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
41+
BASE_REF: ${{ github.base_ref }}
42+
steps:
43+
- name: Checkout
44+
if: github.event_name == 'pull_request'
45+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
with:
47+
ref: ${{ github.event.pull_request.head.sha }}
48+
fetch-depth: 0
49+
path: zephyr
50+
persist-credentials: false
51+
52+
- name: Set up Python
53+
if: github.event_name == 'pull_request'
54+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
55+
with:
56+
python-version: 3.12
57+
cache: pip
58+
cache-dependency-path: scripts/requirements-actions.txt
59+
60+
- name: install-packages
61+
working-directory: zephyr
62+
if: github.event_name == 'pull_request'
63+
run: |
64+
pip install -r scripts/requirements-actions.txt --require-hashes
65+
66+
- name: Setup Zephyr project
67+
uses: zephyrproject-rtos/action-zephyr-setup@f7b70269a8eb01f70c8e710891e4c94972a2f6b4 # v1.0.6
68+
with:
69+
app-path: zephyr
70+
toolchains: all
71+
72+
- name: Environment Setup
73+
working-directory: zephyr
74+
if: github.event_name == 'pull_request'
75+
run: |
76+
git config --global user.email "[email protected]"
77+
git config --global user.name "Zephyr Bot"
78+
rm -fr ".git/rebase-apply"
79+
rm -fr ".git/rebase-merge"
80+
git rebase origin/${BASE_REF}
81+
git clean -f -d
82+
git log --pretty=oneline | head -n 10
83+
84+
- name: Generate Test Plan with Twister
85+
working-directory: zephyr
86+
if: github.event_name == 'pull_request'
87+
id: test-plan
88+
run: |
89+
export ZEPHYR_BASE=${PWD}
90+
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
91+
python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --no-detailed-test-id --pull-request -t $TESTS_PER_BUILDER
92+
if [ -s .testplan ]; then
93+
cat .testplan >> $GITHUB_ENV
94+
else
95+
echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV
96+
fi
97+
rm -f testplan.json .testplan
98+
99+
- name: Determine matrix size
100+
working-directory: zephyr
101+
id: output-services
102+
run: |
103+
if [ "${{github.event_name}}" = "push" ]; then
104+
subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]"
105+
size=${MATRIX_SIZE}
106+
elif [ "${{github.event_name}}" = "pull_request" ]; then
107+
if [ -n "${TWISTER_NODES}" ]; then
108+
subset="[$(seq -s',' 1 ${TWISTER_NODES})]"
109+
else
110+
subset="[$(seq -s',' 1 ${MATRIX_SIZE})]"
111+
fi
112+
size=${TWISTER_NODES}
113+
elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then
114+
subset="[$(seq -s',' 1 ${WEEKLY_MATRIX_SIZE})]"
115+
size=${WEEKLY_MATRIX_SIZE}
116+
else
117+
size=0
118+
fi
119+
120+
echo "subset=${subset}" >> $GITHUB_OUTPUT
121+
echo "size=${size}" >> $GITHUB_OUTPUT
122+
echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT
28123
29124
twister-build:
30125
runs-on:

0 commit comments

Comments
 (0)