5
5
branches : ' *'
6
6
push :
7
7
branches : ' *'
8
+ workflow_dispatch :
9
+ inputs :
10
+ old-commit :
11
+ description : ' Base/old commit to compare against the branch HEAD or new-commit below'
12
+ required : true
13
+ new-commit :
14
+ description : ' (Optional) New commit to use instead of branch HEAD'
15
+ required : false
16
+ default : ' '
8
17
9
18
jobs :
10
19
size-diff :
39
48
with :
40
49
path : libraries/codal-microbit-v2
41
50
fetch-depth : ' 0'
51
+ # Unless manually triggered via workflow_dispatch this will be an empty
52
+ # string, checking out the default commit for the commit/branch/PR
53
+ ref : ${{ github.event.inputs.new-commit }}
42
54
# Changing the commit SHA might be unnecessary, as we've already cloned this
43
55
# repo, but could be useful to ensure codal.json points to the same commit
44
56
- name : Modify files to use BLE & this codal-microbit-v2 commit
@@ -79,15 +91,24 @@ jobs:
79
91
echo "${{ github.event.pull_request.base.sha }}"
80
92
echo "GIT_BASE_SHA=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV
81
93
echo "# Bloaty comparison with PR base commit" >> $GITHUB_STEP_SUMMARY
82
- echo "Base commit: ${{ github.event.pull_request.base.sha }}" >> $GITHUB_STEP_SUMMARY
94
+ echo "Base commit: [${{ github.event.pull_request.base.sha }}](https://github.com/${GITHUB_REPOSITORY}/commit/${{ github.event.pull_request.base.sha }})" >> $GITHUB_STEP_SUMMARY
95
+ - name : " Manual trigger only: Get input commits"
96
+ if : ${{ github.event_name == 'workflow_dispatch' }}
97
+ run : |
98
+ echo "${{ github.event.inputs.old-commit }}"
99
+ echo "GIT_BASE_SHA=${{ github.event.inputs.old-commit }}" >> $GITHUB_ENV
100
+ echo "# Bloaty comparison with input commit(s)" >> $GITHUB_STEP_SUMMARY
101
+ echo "Old commit: [${{ github.event.inputs.old-commit }}](https://github.com/${GITHUB_REPOSITORY}/commit/${{ github.event.inputs.old-commit }})" >> $GITHUB_STEP_SUMMARY
102
+ echo "New commit: [${{ github.event.inputs.new-commit || github.sha }}](https://github.com/${GITHUB_REPOSITORY}/commit/${{ github.event.inputs.new-commit || github.sha}})" >> $GITHUB_STEP_SUMMARY
103
+ echo "Full diff: https://github.com/${GITHUB_REPOSITORY}/compare/${{ github.event.inputs.old-commit }}...${{ github.event.inputs.new-commit || github.sha}}" >> $GITHUB_STEP_SUMMARY
83
104
- name : " Commit only: Get parent commit SHA"
84
- if : ${{ ! github.event.pull_request.base.sha }}
105
+ if : ${{ ! github.event.pull_request.base.sha && github.event_name != 'workflow_dispatch' }}
85
106
run : |
86
107
cd libraries/codal-microbit-v2
87
108
echo "$(git log --pretty=%P -n 1 HEAD^0)"
88
109
echo "GIT_BASE_SHA=$(git log --pretty=%P -n 1 HEAD^0)" >> $GITHUB_ENV
89
110
echo "# Bloaty comparison with parent commit" >> $GITHUB_STEP_SUMMARY
90
- echo "Parent commit: $(git log --pretty=%P -n 1 HEAD^0)" >> $GITHUB_STEP_SUMMARY
111
+ echo "Parent commit: [ $(git log --pretty=%P -n 1 HEAD^0)](https://github.com/${GITHUB_REPOSITORY}/commit/$(git log --pretty=%P -n 1 HEAD^0) )" >> $GITHUB_STEP_SUMMARY
91
112
# We don't need to update codal.json because we've kept the
92
113
# codal-microbit-v2 repo and we manually check out the right base commit
93
114
- name : Checkout parent/base commit of codal-microbit-v2
@@ -105,15 +126,26 @@ jobs:
105
126
id : bloaty-comparison
106
127
uses : carlosperate/bloaty-action@v1
107
128
with :
108
- bloaty-args : -s vm original-build/MICROBIT.elf -- build/MICROBIT
129
+ bloaty-args : -d compileunits --domain= vm original-build/MICROBIT.elf -- build/MICROBIT
109
130
output-to-summary : true
131
+ summary-title : " Bloaty diff between the two commits"
132
+ # Show total memory consumption of the main memory sections
133
+ - name : Show memory usage in summary using size
134
+ run : |
135
+ echo '# This commit total memory usage' >> $GITHUB_STEP_SUMMARY
136
+ echo '## GNU size' >> $GITHUB_STEP_SUMMARY
137
+ echo '```' >> $GITHUB_STEP_SUMMARY
138
+ echo '$ arm-none-eabi-size original-build/MICROBIT.elf' >> $GITHUB_STEP_SUMMARY
139
+ echo '' >> $GITHUB_STEP_SUMMARY
140
+ arm-none-eabi-size original-build/MICROBIT.elf >> $GITHUB_STEP_SUMMARY
141
+ echo '```' >> $GITHUB_STEP_SUMMARY
110
142
# Then show memory consumption of top 30 components for this build
111
143
- name : Run Bloaty to view ELF file full info
112
144
uses : carlosperate/bloaty-action@v1
113
145
with :
114
- bloaty-args : original-build/MICROBIT.elf - d compileunits -n 30 -s vm
146
+ bloaty-args : - d compileunits --domain=vm - n 30 original-build/MICROBIT.elf
115
147
output-to-summary : true
116
- - name : Add comment to PR with the bloaty diff
148
+ - name : " PR only: Add comment to PR with the bloaty diff"
117
149
if : ${{ github.event.pull_request }}
118
150
continue-on-error : true
119
151
uses : actions/github-script@v6
0 commit comments