Skip to content

Commit 0b9d839

Browse files
Damian-Nordicktaborowski
authored andcommitted
workflows: fix PR config and size comparison
The workflow should specify the artifact name to ensure that the build metadata and not doc artifact is downloaded before the comparison is attempted. Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
1 parent a741fb4 commit 0b9d839

2 files changed

Lines changed: 39 additions & 12 deletions

File tree

.github/workflows/compare_config.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
uses: dawidd6/action-download-artifact@v6
3030
with:
3131
run_id: ${{inputs.current_run_id}}
32+
name: sample-artifacts-meta
3233
path: current
3334

3435
- name: Get artifacts from base
@@ -37,41 +38,54 @@ jobs:
3738
with:
3839
commit: ${{inputs.base_commit_sha}}
3940
workflow: on-commit.yml
41+
workflow_conclusion: success
42+
name: sample-artifacts-meta
43+
search_artifacts: true
44+
check_artifacts: true
4045
path: old
4146

4247
- name: Get artifacts from base
4348
if: ${{inputs.base_commit_sha}} == ""
4449
uses: dawidd6/action-download-artifact@v6
4550
with:
4651
workflow: on-commit.yml
52+
workflow_conclusion: success
53+
name: sample-artifacts-meta
54+
search_artifacts: true
55+
check_artifacts: true
4756
path: old
4857

4958
- name: Generate .config diff
5059
shell: bash {0}
5160
id: config_diff
5261
run: |
53-
cd current
54-
configs=$(find . -name .config)
55-
cd ..
62+
configs=$(find current -name .config)
5663
echo "\`\`\`" >> config_diff.md
5764
for cfg in ${configs}
5865
do
59-
echo "compare ${cfg}"
66+
rel_cfg="${cfg#current/}"
67+
old_cfg="old/${rel_cfg}"
68+
if [ ! -f "${old_cfg}" ]; then
69+
echo "Skipping ${rel_cfg} - no baseline .config"
70+
continue
71+
fi
6072
61-
grep -v "CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION" old/${cfg} > tmp_old.1
73+
echo "compare ${rel_cfg}"
74+
75+
grep -v "CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION" "${old_cfg}" > tmp_old.1
6276
grep -v "#" tmp_old.1 > tmp_old.2
6377
sort tmp_old.2 > tmp_old.3
64-
tr -s '\n' < tmp_old.3 > old/${cfg}
78+
tr -s '\n' < tmp_old.3 > tmp_old.4
6579
66-
grep -v "CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION" current/${cfg} > tmp_current.1
80+
grep -v "CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION" "${cfg}" > tmp_current.1
6781
grep -v "#" tmp_current.1 > tmp_current.2
6882
sort tmp_current.2 > tmp_current.3
69-
tr -s '\n' < tmp_current.3 > current/${cfg}
83+
tr -s '\n' < tmp_current.3 > tmp_current.4
7084
7185
rm -rf tmp_*
7286
73-
printf "\n%s\n%-62s| %s\n" "${cfg}" "old" "new" > cfg_diff.md
74-
diff --text --report-identical-files --suppress-common-lines --side-by-side --label old --label new old/${cfg} current/${cfg} >> cfg_diff.md
87+
printf "\n%s\n%-62s| %s\n" "${rel_cfg}" "old" "new" > cfg_diff.md
88+
diff --text --report-identical-files --suppress-common-lines --side-by-side --label old --label new tmp_old.4 tmp_current.4 >> cfg_diff.md
7589
if [ $? -eq 1 ]; then cat cfg_diff.md >> config_diff.md; fi
7690
done
7791
echo "\`\`\`" >> config_diff.md

.github/workflows/on-pr_publish_comment.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
pull-requests: write
2222
contents: read
2323
checks: write
24+
actions: read
2425

2526
steps:
2627
- name: Checkout
@@ -30,13 +31,25 @@ jobs:
3031
uses: dawidd6/action-download-artifact@v6
3132
with:
3233
run_id: ${{github.event.workflow_run.id}}
34+
name: sample-artifacts-meta
3335
path: current
3436

37+
- name: Get PR number
38+
uses: dawidd6/action-download-artifact@v6
39+
with:
40+
run_id: ${{github.event.workflow_run.id}}
41+
name: PR_number
42+
path: current/PR_number
43+
3544
- name: Get artifacts from PR base
3645
uses: dawidd6/action-download-artifact@v6
3746
with:
3847
commit: ${{github.event.workflow_run.event.pull_request.base.sha}}
3948
workflow: on-commit.yml
49+
workflow_conclusion: success
50+
name: sample-artifacts-meta
51+
search_artifacts: true
52+
check_artifacts: true
4053
path: old
4154

4255
- name: Unpack PR number
@@ -48,11 +61,11 @@ jobs:
4861
- name: Generage memory diff
4962
run: |
5063
shopt -s extglob
51-
pr_reports=$(ls current/sample-artifacts-meta/subsets/*/twister.json)
64+
pr_reports=$(ls current/subsets/*/twister.json)
5265
python3 scripts/ci/combine_twister_reports.py $pr_reports new.json
5366
cat new.json
5467
55-
base_reports=$(ls old/sample-artifacts-meta/subsets/*/twister.json)
68+
base_reports=$(ls old/subsets/*/twister.json)
5669
python3 scripts/ci/combine_twister_reports.py $base_reports old.json
5770
cat old.json
5871

0 commit comments

Comments
 (0)