Skip to content

Commit de7cb6a

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

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

.github/workflows/twister.yaml

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,103 @@ 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+
if: github.event_name == 'pull_request'
68+
uses: zephyrproject-rtos/action-zephyr-setup@f7b70269a8eb01f70c8e710891e4c94972a2f6b4 # v1.0.6
69+
with:
70+
app-path: zephyr
71+
toolchains: all
72+
73+
- name: Environment Setup
74+
working-directory: zephyr
75+
if: github.event_name == 'pull_request'
76+
run: |
77+
git config --global user.email "[email protected]"
78+
git config --global user.name "Zephyr Bot"
79+
rm -fr ".git/rebase-apply"
80+
rm -fr ".git/rebase-merge"
81+
git rebase origin/${BASE_REF}
82+
git clean -f -d
83+
git log --pretty=oneline | head -n 10
84+
85+
- name: Generate Test Plan with Twister
86+
working-directory: zephyr
87+
if: github.event_name == 'pull_request'
88+
id: test-plan
89+
run: |
90+
export ZEPHYR_BASE=${PWD}
91+
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
92+
python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --no-detailed-test-id --pull-request -t $TESTS_PER_BUILDER
93+
if [ -s .testplan ]; then
94+
cat .testplan >> $GITHUB_ENV
95+
else
96+
echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV
97+
fi
98+
rm -f testplan.json .testplan
99+
100+
- name: Determine matrix size
101+
working-directory: zephyr
102+
id: output-services
103+
run: |
104+
if [ "${{github.event_name}}" = "push" ]; then
105+
subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]"
106+
size=${MATRIX_SIZE}
107+
elif [ "${{github.event_name}}" = "pull_request" ]; then
108+
if [ -n "${TWISTER_NODES}" ]; then
109+
subset="[$(seq -s',' 1 ${TWISTER_NODES})]"
110+
else
111+
subset="[$(seq -s',' 1 ${MATRIX_SIZE})]"
112+
fi
113+
size=${TWISTER_NODES}
114+
elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then
115+
subset="[$(seq -s',' 1 ${WEEKLY_MATRIX_SIZE})]"
116+
size=${WEEKLY_MATRIX_SIZE}
117+
else
118+
size=0
119+
fi
120+
121+
echo "subset=${subset}" >> $GITHUB_OUTPUT
122+
echo "size=${size}" >> $GITHUB_OUTPUT
123+
echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT
28124
29125
twister-build:
30126
runs-on:

0 commit comments

Comments
 (0)