Skip to content

Commit b3cbb69

Browse files
GHA: experiment
try to remove configuration job from matrix Signed-off-by: Robert Gałat <[email protected]>
1 parent b59b1df commit b3cbb69

File tree

5 files changed

+40
-73
lines changed

5 files changed

+40
-73
lines changed

.github/workflows/on-commit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ jobs:
3434
reference_commit: "HEAD~${{needs.get_base_commit.outputs.commit_number}}"
3535

3636
build_samples:
37+
name: Build samples
3738
uses: ./.github/workflows/samples_build.yml
3839

3940
build_and_run_tests:
41+
name: Build and run unit tests
4042
uses: ./.github/workflows/run_tests.yml
4143

42-
4344
Post_fail_to_Teams:
4445
needs: [verify_changes, build_samples, build_and_run_tests]
4546
if: ${{ failure() }}

.github/workflows/run_tests.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
image: ghcr.io/nrfconnect/sdk-sidewalk:main
1515
options: --cpus 2 --privileged
1616
outputs:
17-
total_platforms_json: ${{ steps.platforms.outputs.total_platforms_json }}
17+
total_platforms_json: ${{ steps.subsets.outputs.total_platforms_json }}
1818
subset_matrix: ${{ steps.subsets.outputs.matrix }}
1919
subset_config: ${{ steps.subsets.outputs.config }}
2020
defaults:
@@ -35,30 +35,20 @@ jobs:
3535
west update -n -o=--depth=1 --path-cache /workdir/ &&
3636
ln -s sidewalk_tmp sidewalk
3737
38-
- name: dry_run
39-
run: |
40-
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="Github_tests" --exclude-platform native_sim --exclude-platform native_posix --exclude-platform unit_testing --dry-run
41-
42-
- name: get test targets
43-
id: platforms
44-
run: |
45-
total_platforms=$(jq -r '.testsuites |map({platform: .platform}) | unique | .[].platform' twister-out/testplan.json)
46-
total_platforms_json=$(printf '%s' "${total_platforms[@]}" | jq -R . | jq -s -c .)
47-
echo "total_platforms_json=$total_platforms_json" >> $GITHUB_OUTPUT;
48-
4938
- name: subsets configuration
5039
id: subsets
5140
run: |
5241
rm -rf twister-out* max max_sorted configuration
5342
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="Github_tests" --exclude-platform native_sim --exclude-platform native_posix --exclude-platform unit_testing --dry-run
5443
total_platforms=$(jq -r '.testsuites |map({platform: .platform}) | unique | .[].platform' twister-out/testplan.json)
55-
echo "[]" > configuration
44+
total_platforms_json=$(printf '%s' "${total_platforms[@]}" | jq -R . | jq -s -c .)
45+
echo "{}" > configuration
5646
for platform in $total_platforms; do
5747
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="Github_tests" --dry-run --platform $platform
5848
total_jobs=$(jq '.testsuites | length' twister-out/testplan.json)
5949
subsets=$(( ( total_jobs + ${{inputs.jobs_per_subset}}) / ${{inputs.jobs_per_subset}}))
6050
echo $subsets >> max
61-
cat configuration | jq -c --arg platform_name $platform --arg subsets $subsets '. += [{"platform": $platform_name, "subsets": $subsets}]' > configuration_new
51+
cat configuration | jq -c --arg platform_name $platform --arg subsets $subsets '. += {($platform_name): $subsets|tonumber }' > configuration_new
6252
mv configuration_new configuration
6353
done
6454
sort max > max_sorted
@@ -67,6 +57,7 @@ jobs:
6757
cat configuration
6858
echo $subset_matrix
6959
60+
echo "total_platforms_json=$total_platforms_json" >> $GITHUB_OUTPUT;
7061
echo "matrix=$subset_matrix" >> $GITHUB_OUTPUT;
7162
echo "config=`cat configuration`" >> $GITHUB_OUTPUT;
7263

.github/workflows/run_tests_dut.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,9 @@ on:
1818
default: true
1919

2020
jobs:
21-
parse_config:
22-
runs-on: ubuntu-24.04
23-
name: "Config ${{inputs.subset}} - ${{inputs.target}}"
24-
outputs:
25-
max_subset: ${{steps.subsets.outputs.max_subset}}
26-
steps:
27-
- name: subsets
28-
id: subsets
29-
run: |
30-
echo '${{inputs.subset_config}}' > configuration.json
31-
cat configuration.json
32-
max_subsets=$(jq --arg target_name "${{inputs.target}}" '.[] | select(.platform == $target_name).subsets | tonumber' configuration.json)
33-
echo "max_subset=$max_subsets"
34-
echo "max_subset=$max_subsets" >> $GITHUB_OUTPUT
35-
3621
build_dut_tests:
37-
needs: [parse_config]
38-
if: ${{ inputs.subset <= needs.parse_config.outputs.max_subset }}
39-
name: "Build ${{inputs.subset}} - ${{inputs.target}}"
22+
if: inputs.subset <= fromJson(inputs.subset_config)[inputs.target]
23+
name: "Build ${{inputs.subset}}/${{fromJson(inputs.subset_config)[inputs.target]}} - ${{inputs.target}}"
4024
runs-on: ubuntu-24.04
4125
container:
4226
image: ghcr.io/nrfconnect/sdk-sidewalk:main
@@ -46,6 +30,14 @@ jobs:
4630
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}
4731

4832
steps:
33+
- name: get_max_subset
34+
id: max_subset
35+
run: |
36+
echo '${{inputs.subset_config}}' > configuration.json
37+
max_subsets=$(jq --arg target_name "${{inputs.target}}" '.[($target_name)]' configuration.json)
38+
echo "max_subset=$max_subsets"
39+
echo "max_subset=$max_subsets" >> $GITHUB_OUTPUT
40+
4941
- name: Checkout
5042
uses: actions/checkout@v4
5143
with:
@@ -81,7 +73,7 @@ jobs:
8173
- name: Build DUT test artifacts
8274
run: |
8375
source zephyr/zephyr-env.sh
84-
west twister --test-config sidewalk/test_config.yaml --level="Github_tests" --platform ${{inputs.target}} --testsuite-root sidewalk --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2 --subset ${{ inputs.subset }}/${{needs.parse_config.outputs.max_subset}}
76+
west twister --test-config sidewalk/test_config.yaml --level="Github_tests" --platform ${{inputs.target}} --testsuite-root sidewalk --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2 --subset ${{ inputs.subset }}/${{steps.max_subset.outputs.max_subset}}
8577
8678
- name: Print ccache stats
8779
run: |
@@ -95,9 +87,9 @@ jobs:
9587
include-hidden-files: true
9688

9789
run_dut_ut:
98-
needs: [build_dut_tests, parse_config]
99-
if: ${{ fromJson(inputs.run_tests) }} and ${{ inputs.subset <= needs.parse_config.outputs.max_subset }}
100-
name: "Run ${{ inputs.subset }} - ${{inputs.target}}"
90+
needs: [build_dut_tests]
91+
if: ${{ fromJson(inputs.run_tests) }} and ${{ inputs.subset <= fromJson(inputs.subset_config)[inputs.target]}}
92+
name: "Run ${{inputs.subset}}/${{fromJson(inputs.subset_config)[inputs.target]}} - ${{inputs.target}}"
10193
runs-on: [self-hosted, linux, x64, "${{inputs.target}}"]
10294
container:
10395
image: ghcr.io/nrfconnect/sdk-sidewalk:main

.github/workflows/samples_build.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
image: ghcr.io/nrfconnect/sdk-sidewalk:main
2020
options: --cpus 2 --privileged
2121
outputs:
22-
total_platforms_json: ${{ steps.platforms.outputs.total_platforms_json }}
22+
total_platforms_json: ${{ steps.subsets.outputs.total_platforms_json }}
2323
subset_matrix: ${{ steps.subsets.outputs.matrix }}
2424
subset_config: ${{ steps.subsets.outputs.config }}
2525
defaults:
@@ -40,30 +40,20 @@ jobs:
4040
west update -n -o=--depth=1 --path-cache /workdir/ &&
4141
ln -s sidewalk_tmp sidewalk
4242
43-
- name: dry_run
44-
run: |
45-
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --dry-run
46-
47-
- name: get test targets
48-
id: platforms
49-
run: |
50-
total_platforms=$(jq -r '.testsuites |map({platform: .platform}) | unique | .[].platform' twister-out/testplan.json)
51-
total_platforms_json=$(printf '%s' "${total_platforms[@]}" | jq -R . | jq -s -c .)
52-
echo "total_platforms_json=$total_platforms_json" >> $GITHUB_OUTPUT;
53-
5443
- name: subsets configuration
5544
id: subsets
5645
run: |
5746
rm -rf twister-out* max max_sorted configuration
5847
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --dry-run
5948
total_platforms=$(jq -r '.testsuites |map({platform: .platform}) | unique | .[].platform' twister-out/testplan.json)
60-
echo "[]" > configuration
49+
total_platforms_json=$(printf '%s' "${total_platforms[@]}" | jq -R . | jq -s -c .)
50+
echo "{}" > configuration
6151
for platform in $total_platforms; do
6252
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --dry-run --platform $platform
6353
total_jobs=$(jq '.testsuites | length' twister-out/testplan.json)
6454
subsets=$(( ( total_jobs + ${{inputs.jobs_per_subset}}) / ${{inputs.jobs_per_subset}}))
6555
echo $subsets >> max
66-
cat configuration | jq -c --arg platform_name $platform --arg subsets $subsets '. += [{"platform": $platform_name, "subsets": $subsets}]' > configuration_new
56+
cat configuration | jq -c --arg platform_name $platform --arg subsets $subsets '. += {($platform_name): $subsets|tonumber }' > configuration_new
6757
mv configuration_new configuration
6858
done
6959
sort max > max_sorted
@@ -72,13 +62,14 @@ jobs:
7262
cat configuration
7363
echo $subset_matrix
7464
65+
echo "total_platforms_json=$total_platforms_json" >> $GITHUB_OUTPUT;
7566
echo "matrix=$subset_matrix" >> $GITHUB_OUTPUT;
7667
echo "config=`cat configuration`" >> $GITHUB_OUTPUT;
7768
7869
- name: clean
7970
if: always()
8071
run: |
81-
rm -rf twister* sidewalk*
72+
rm -rf twister* sidewalk* max max_sorted configuration
8273
8374
build_samples:
8475
needs: [discover_targets]

.github/workflows/samples_build_target.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,9 @@ on:
1717
required: true
1818

1919
jobs:
20-
parse_config:
21-
runs-on: ubuntu-24.04
22-
name: "Config ${{inputs.subset}} - ${{inputs.target}}"
23-
outputs:
24-
max_subset: ${{steps.subsets.outputs.max_subset}}
25-
steps:
26-
- name: subsets
27-
id: subsets
28-
run: |
29-
echo '${{inputs.subset_config}}' > configuration.json
30-
cat configuration.json
31-
max_subsets=$(jq --arg target_name "${{inputs.target}}" '.[] | select(.platform == $target_name).subsets | tonumber' configuration.json)
32-
echo "max_subset=$max_subsets"
33-
echo "max_subset=$max_subsets" >> $GITHUB_OUTPUT
34-
3520
build_samples:
36-
needs: [parse_config]
37-
name: "Build ${{inputs.subset}} - ${{inputs.target}}"
38-
if: ${{ inputs.subset <= needs.parse_config.outputs.max_subset }}
21+
name: "Build ${{inputs.subset}}/${{fromJson(inputs.subset_config)[inputs.target]}} - ${{inputs.target}}"
22+
if: inputs.subset <= fromJson(inputs.subset_config)[inputs.target]
3923
runs-on: ubuntu-24.04
4024
container:
4125
image: ghcr.io/nrfconnect/sdk-sidewalk:main
@@ -45,6 +29,14 @@ jobs:
4529
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}
4630

4731
steps:
32+
- name: get_max_subset
33+
id: max_subset
34+
run: |
35+
echo '${{inputs.subset_config}}' > configuration.json
36+
max_subsets=$(jq --arg target_name "${{inputs.target}}" '.[($target_name)]' configuration.json)
37+
echo "max_subset=$max_subsets"
38+
echo "max_subset=$max_subsets" >> $GITHUB_OUTPUT
39+
4840
- name: Checkout
4941
uses: actions/checkout@v4
5042
with:
@@ -80,16 +72,16 @@ jobs:
8072
- name: Twister build samples
8173
run: |
8274
source zephyr/zephyr-env.sh
83-
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --platform ${{ inputs.target}} --inline-logs --overflow-as-errors --enable-size-report --show-footprint -vvv --build-only --subset ${{inputs.subset}}/${{needs.parse_config.outputs.max_subset}}
75+
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --platform ${{ inputs.target}} --inline-logs --overflow-as-errors --enable-size-report --show-footprint -vvv --build-only --subset ${{inputs.subset}}/${{steps.max_subset.outputs.max_subset}}
8476
8577
- name: Print ccache stats
8678
run: |
8779
ccache -ps;
8880
8981
- name: Prepare artifacts for upload
9082
run: |
91-
mkdir -p subsets/${{inputs.subset}}_of_${{ needs.parse_config.outputs.max_subset }}_${{ steps.replace.outputs.target_board}}
92-
cp twister-out/twister.json subsets/${{inputs.subset}}_of_${{ needs.parse_config.outputs.max_subset }}_${{ steps.replace.outputs.target_board}}
83+
mkdir -p subsets/${{inputs.subset}}_of_${{ steps.max_subset.outputs.max_subset }}_${{ steps.replace.outputs.target_board}}
84+
cp twister-out/twister.json subsets/${{inputs.subset}}_of_${{ steps.max_subset.outputs.max_subset }}_${{ steps.replace.outputs.target_board}}
9385
9486
- name: Upload build metadata
9587
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)