Skip to content

Commit 77a019b

Browse files
MatteoPologrutoper1234
authored andcommitted
Generate a summary of Arduino packages and add it to the CHANGELOG (qualcomm-linux#157)
* Generate summary of Arduino packages and add it to the CHANGELOG * Add build ID to workflow summary * Disable s3 push for testing purposes * Revert testing changes * Add license * Fix missing quote * Update .github/workflows/promote.yml Co-authored-by: Per Tillisch <accounts@perglass.com> * Update .github/workflows/promote.yml Co-authored-by: Per Tillisch <accounts@perglass.com> * Update path to go.mod * New test: disable s3 * Revert testing changes --------- Co-authored-by: Per Tillisch <accounts@perglass.com>
1 parent c446757 commit 77a019b

File tree

5 files changed

+86
-3
lines changed

5 files changed

+86
-3
lines changed

.github/workflows/build-tester-images.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Debian image tester builds
1+
name: Build Debian image
22

33
env:
44
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
@@ -291,3 +291,4 @@ jobs:
291291
- name: Build summary
292292
run: |
293293
echo "Release available here: https://downloads.oniudra.cc/${{ env.RELEASE_DIR }}/${{ steps.buildtag.outputs.BUILD_ID }}/arduino-unoq-debian-image-${{ steps.buildtag.outputs.BUILD_ID }}.tar.zst" >> $GITHUB_STEP_SUMMARY
294+
echo "Build ID: ${{ steps.buildtag.outputs.BUILD_ID }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/promote.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,24 @@ jobs:
7171
with:
7272
tag-regex: '^[0-9]{8}-[0-9]+$'
7373
changelog-file-path: "./CHANGELOG.md"
74-
75-
- name: Add download link to the changelog
74+
75+
- name: Setup Go
76+
uses: actions/setup-go@v5
77+
with:
78+
go-version-file: scripts/arduino-packages-summary/go.mod
79+
80+
- name: Generate Arduino packages summary
81+
working-directory: ./scripts/arduino-packages-summary
82+
run: |
83+
cp ../../sboms/rootfs-sbom.syft.json.gz . && gzip -d rootfs-sbom.syft.json.gz
84+
go run .
85+
86+
- name: Add download link and packages summary to the changelog
7687
env:
7788
VERSION: ${{ github.event.inputs.version }}
7889
run: |
7990
echo >> "CHANGELOG.md"
91+
cat ./scripts/arduino-packages-summary/arduino-summary.md >> "CHANGELOG.md"
8092
echo "## Download Release" >> "CHANGELOG.md"
8193
echo "Release available here: https://downloads.arduino.cc/debian-im/Stable/${{ env.VERSION }}/arduino-unoq-debian-image-${{ env.VERSION }}.tar.zst" >> "CHANGELOG.md"
8294
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
package main
5+
6+
import (
7+
"encoding/json"
8+
"os"
9+
"strings"
10+
11+
"github.com/arduino/go-paths-helper"
12+
)
13+
14+
type Sbom struct {
15+
Artifacts []Artifact `json:"artifacts"`
16+
}
17+
18+
type Artifact struct {
19+
Name string `json:"name"`
20+
Version string `json:"version"`
21+
}
22+
23+
func main() {
24+
var sboms Sbom
25+
f, err := paths.New("rootfs-sbom.syft.json").ReadFile()
26+
if err != nil {
27+
println(err.Error())
28+
os.Exit(1)
29+
}
30+
31+
err = json.Unmarshal(f, &sboms)
32+
if err != nil {
33+
println(err.Error())
34+
os.Exit(1)
35+
}
36+
37+
output := "- Included Arduino packages:\n"
38+
for _, a := range sboms.Artifacts {
39+
if strings.Contains(a.Name, "arduino-") || strings.Contains(a.Name, "adbd") {
40+
output += " - " + a.Name + ": " + a.Version + "\n"
41+
}
42+
}
43+
44+
outFile := paths.New("arduino-summary.md")
45+
outFile.WriteFile([]byte(output))
46+
if err != nil {
47+
println(err.Error())
48+
os.Exit(1)
49+
}
50+
os.Exit(0)
51+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module arduino-summary-generator
2+
3+
go 1.25.1
4+
5+
require github.com/arduino/go-paths-helper v1.14.0
6+
7+
require golang.org/x/sys v0.37.0 // indirect
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/arduino/go-paths-helper v1.14.0 h1:b4C8KJa7CNz2XnzTWg97M3LAmzWSWrj+m/o5/skzv3Y=
2+
github.com/arduino/go-paths-helper v1.14.0/go.mod h1:dDodKn2ZX4iwuoBMapdDO+5d0oDLBeM4BS0xS4i40Ak=
3+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
8+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
9+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
10+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
11+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
12+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)