Skip to content

Commit 93bb171

Browse files
authored
workflows: Improve build summary (#1204)
Turn build summary into a table. Summary takes less space this way and action page is easier to read.
2 parents 1cecc72 + 961f26b commit 93bb171

File tree

2 files changed

+47
-28
lines changed

2 files changed

+47
-28
lines changed

.github/actions/compile/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ runs:
102102
id: print-output
103103
run: |
104104
KERNEL_DIRNAME="${{ inputs.kernel_dirname }}"
105-
if [ -n "${KERNEL_DIRNAME}" ]; then
106-
KERNEL_DIRNAME="_${KERNEL_DIRNAME}"
107-
fi
108105
BUILDNAME="${{ inputs.machine }}_${{ inputs.distro_name }}${KERNEL_DIRNAME}"
109106
FILENAME="build-url_${BUILDNAME}"
110107
echo "${{ steps.upload_artifacts.outputs.url }}" > "${FILENAME}"

.github/workflows/build-yocto.yml

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -175,32 +175,54 @@ jobs:
175175
with:
176176
github-token: ${{ secrets.GITHUB_TOKEN }}
177177
pattern: build-url*
178+
path: urlfiles
179+
merge-multiple: true
178180

179181
- name: "Print output"
180-
shell: bash
182+
shell: python
181183
id: print-output
182184
run: |
183-
echo "## Download URLs" >> $GITHUB_STEP_SUMMARY
184-
export BUILD_URL=""
185-
for FILE in build-url*
186-
do
187-
# Extract build OS and machine name
188-
remainder="$FILE"
189-
BUILD_URL_STR="${remainder%%_*}"; remainder="${remainder#*_}"
190-
MACHINE="${remainder%%_*}"; remainder="${remainder#*_}"
191-
OS="${remainder%%_*}"
192-
BUILD_URL=$(cat "$FILE/$FILE")
193-
echo "### ${MACHINE} ${OS}" >> $GITHUB_STEP_SUMMARY
194-
echo "[${BUILD_URL}](${BUILD_URL})" >> $GITHUB_STEP_SUMMARY
195-
done
196-
# for backward compatibility only
197-
# This section should be removed once the patch is merged
198-
echo "${BUILD_URL}" > build_url
199-
- name: Upload build URL
200-
uses: actions/upload-artifact@v4
201-
with:
202-
overwrite: true
203-
name: build_url
204-
path: build_url
205-
206-
185+
import os
186+
ftable = {}
187+
oslist = set()
188+
machinelist = set()
189+
for fname in os.listdir("./urlfiles"):
190+
if fname.startswith("build-url"):
191+
b, m, o = fname.split("_", 2)
192+
oslist.add(o)
193+
machinelist.add(m)
194+
url = ""
195+
with open(f"./urlfiles/{fname}", "r") as urlfile:
196+
url = urlfile.read()
197+
if not o in ftable:
198+
ftable.update({o:{m: url}})
199+
else:
200+
ftable[o].update({m: url})
201+
202+
table_str = "| |"
203+
204+
for m in sorted(machinelist):
205+
table_str += f" {m} |"
206+
207+
table_str += "\n|"
208+
for i in range(len(machinelist) + 1):
209+
table_str += " ---- |"
210+
211+
table_str += "\n"
212+
213+
for o in sorted(ftable.keys()):
214+
table_str += f"| {o} |"
215+
for m in sorted(machinelist):
216+
url = ftable[o].get(m)
217+
if url:
218+
url = url.strip()
219+
table_str += f" [Files]({url}/{o}/{m}/) |"
220+
else:
221+
table_str += " |"
222+
table_str += "\n"
223+
summary_file_name = os.environ.get("GITHUB_STEP_SUMMARY")
224+
if summary_file_name:
225+
with open(summary_file_name, "a") as summaryfile:
226+
summaryfile.write("## Download URLs\n")
227+
summaryfile.write(table_str)
228+
print(table_str)

0 commit comments

Comments
 (0)