Skip to content

Commit 452c3b8

Browse files
committed
add workflow
Signed-off-by: Anas Nashif <[email protected]>
1 parent 1265c84 commit 452c3b8

File tree

3 files changed

+119
-8
lines changed

3 files changed

+119
-8
lines changed

.github/workflows/db.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Create Test and Source DB
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- v*-branch
8+
- collab-*
9+
pull_request:
10+
branches:
11+
- main
12+
- v*-branch
13+
- collab-*
14+
schedule:
15+
# Run at 17:00 UTC on every Saturday
16+
- cron: '0 17 * * 6'
17+
18+
permissions:
19+
contents: read
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
test-source-db:
27+
runs-on: ubuntu-24.04
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
subset: [1,2,3,4,5,6,7,8,9,10 ,11,12,13,14,15,16,17,18,19,20]
32+
timeout-minutes: 1440
33+
env:
34+
TWISTER_COMMON: ' --test-config tests/test_config_ci.yaml --no-detailed-test-id --force-color --inline-logs -v -N -M --cmake-only -j 8'
35+
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
36+
BASE_REF: ${{ github.base_ref }}
37+
LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
with:
42+
ref: ${{ github.event.pull_request.head.sha }}
43+
path: zephyr
44+
fetch-depth: 0
45+
persist-credentials: false
46+
47+
- name: Set Up Python 3.12
48+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
49+
with:
50+
python-version: 3.12
51+
cache: pip
52+
cache-dependency-path: scripts/requirements-actions.txt
53+
54+
- name: install-packages
55+
working-directory: zephyr
56+
run: |
57+
pip install -r scripts/requirements-actions.txt --require-hashes
58+
sudo apt-get update -y
59+
sudo apt-get install -y lcov gperf
60+
61+
- name: Setup Zephyr project
62+
uses: zephyrproject-rtos/action-zephyr-setup@f7b70269a8eb01f70c8e710891e4c94972a2f6b4 # v1.0.6
63+
with:
64+
app-path: zephyr
65+
toolchains: all
66+
67+
- name: Run Tests with Twister
68+
working-directory: zephyr
69+
id: run_twister
70+
run: |
71+
export ZEPHYR_BASE=${PWD}
72+
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
73+
./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS}
74+
python ./scripts/ci/db/gen_test_database.py --directory twister-out/ --output db_${{matrix.subset}}.json
75+
76+
- name: Upload Database
77+
if: always()
78+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
79+
with:
80+
name: Test and Source DB (Subset ${{ matrix.subset }})
81+
if-no-files-found: ignore
82+
path: |
83+
zephyr/db_${{matrix.subset}}.json
84+
85+
test-db-results:
86+
name: "Publish Merged DB"
87+
needs:
88+
- test-source-db
89+
runs-on: ubuntu-22.04
90+
permissions:
91+
checks: write # to create the check run entry with Twister test results
92+
# the build-and-test job might be skipped, we don't need to run this job then
93+
if: success() || failure()
94+
95+
steps:
96+
- name: Install packages
97+
run: |
98+
sudo apt-get update -y
99+
sudo apt install -y jq
100+
101+
- name: Download Artifacts
102+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
103+
with:
104+
path: artifacts
105+
106+
- name: Merge DB files
107+
run: |
108+
jq -s '.' artifacts/*/*.json > db.json
109+
110+
- name: Upload Merged DB
111+
if: always()
112+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
113+
with:
114+
name: Merged DB
115+
if-no-files-found: ignore
116+
path: |
117+
db.json

.github/workflows/twister.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,7 @@ jobs:
168168
run: |
169169
export ZEPHYR_BASE=${PWD}
170170
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
171-
./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${WEEKLY_OPTIONS}
172-
if [ "${{matrix.subset}}" = "1" ]; then
173-
./scripts/zephyr_module.py --twister-out module_tests.args
174-
if [ -s module_tests.args ]; then
175-
./scripts/twister +module_tests.args --outdir module_tests ${TWISTER_COMMON} ${WEEKLY_OPTIONS}
176-
fi
177-
fi
171+
./scripts/twister --cmake-only --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${WEEKLY_OPTIONS}
178172
179173
- name: Print ccache stats
180174
if: always()

scripts/ci/db/gen_test_database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ def generate_testsuite_database(directory, output_file):
3737
args = parser.parse_args()
3838

3939
generate_testsuite_database(args.directory, args.output)
40-
print(f"Database generated and saved to {args.output}")
40+
print(f"Database generated and saved to {args.output}")

0 commit comments

Comments
 (0)