Repository navigation
164 lines (136 loc) · 5.24 KB
/
Copy pathbuild_linux_rpi.yml
File metadata and controls
164 lines (136 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Vorbedingung:
# - Die Conan-Lockdatei (conan_linux_rpi.lock) muss existieren.
name: Build for RPi
on:
push:
branches: [ "main", "v1*", "v2*", "v3*" ]
pull_request:
branches: [ "main", "v1*", "v2*", "v3*" ]
jobs:
# Bereitet die Abhängigkeiten für RPi vor.
# Separater Job mit selber Begründung wie oben.
build_dependencies_rpi:
runs-on: CPR_Ubuntu2404
timeout-minutes: 90
steps:
- uses: actions/checkout@v7
- uses: CommonplaceRobotics/Action_Build_Conan_Dependencies/Linux_armv8_32@v2
with:
lockfile: 'conan_linux_rpi.lock'
cache_key: conan-${{ runner.os }}-armv8_32-${{ hashFiles('**/conan_linux_rpi.lock', '**/conanfile.py') }}
conan_cache_user: ${{ secrets.ARTIFACTORY_USER }}
conan_cache_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
# Build for RPi
build_rpi:
#runs-on: ubuntu-latest
runs-on: CPR_Ubuntu2404
timeout-minutes: 15
needs: build_dependencies_rpi
steps:
- uses: actions/checkout@v7
- name: Restore cached dependencies
id: cache
uses: actions/cache/restore@v5
with:
path: |
~/.conan2
out
key: conan-${{ runner.os }}-armv8_32-${{ hashFiles('conan_linux_rpi.lock', 'conanfile.py') }}
fail-on-cache-miss: true
- name: Install RPi Cross-Compiler
uses: CommonplaceRobotics/Action_Build_Conan_Dependencies/Install_Toolchain_armv8_32@v1
- name: Install Conan
uses: conan-io/setup-conan@v1
- name: Configure CMake
run: |
rm -f CMakePresets.json
echo "{\"version\": 4,\"include\":[\"out/conan/Linux/armv8_32/Release/generators/CMakePresets.json\"]}" >> CMakePresets.json
cmake --preset conan-linux-armv8_32-release
- name: Build Library (armv8_32)
run: |
cd out/build/Linux/armv8_32/Release
cmake --build . --target iRCApp
- name: Rename Library
run: mv out/build/Linux/armv8_32/Release/libiRCApp.a out/build/Linux/armv8_32/Release/libiRCApp_armv8_32.a
- name: Export Library
uses: actions/upload-artifact@v7
with:
name: libiRCApp_armv8_32.a
path: out/build/Linux/armv8_32/Release/libiRCApp_armv8_32.a
archive: false
# Creates the SBOM and checks its compliance
sbom:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: build_rpi
steps:
- uses: actions/checkout@v7
- name: Restore cached dependencies
id: cache
uses: actions/cache/restore@v5
with:
path: |
~/.conan2
out
key: conan-${{ runner.os }}-armv8_32-${{ hashFiles('conan_linux_rpi.lock', 'conanfile.py') }}
fail-on-cache-miss: true
# This is needed so CMake can run, we won't compile anything here
- name: Install RPi Cross-Compiler
uses: CommonplaceRobotics/Action_Build_Conan_Dependencies/Install_Toolchain_armv8_32@v1
# This generates sbomify.json with lifecycle info
- name: Configure CMake
run: |
rm -f CMakePresets.json
echo "{\"version\": 4,\"include\":[\"out/conan/Linux/armv8_32/Release/generators/CMakePresets.json\"]}" >> CMakePresets.json
cmake --preset conan-linux-armv8_32-release
mv out/build/Linux/armv8_32/Release/sbomify.json .
# We need the library to calculate its hash
- name: Import Library
uses: actions/download-artifact@v8
with:
name: libiRCApp_armv8_32.a
path: out/build/Linux/armv8_32/Release
- name: Rename Library
run: mv out/build/Linux/armv8_32/Release/libiRCApp_armv8_32.a out/build/Linux/armv8_32/Release/libiRCApp.a
# Liest die Core-Version aus CMakeLists.txt
- name: Get software version
run: |
VER=`grep -E -o "VERSION[[:blank:]]+[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+" CMakeLists.txt | sed "s/[^0-9.]*//g"`
echo "Software version '$VER' detected"
echo "SW_VERSION=$VER" >> $GITHUB_ENV
- name: Create incomplete SBOM
uses: CommonplaceRobotics/Action_Create_Conan_SBOM@v4
with:
lockfile: conan_linux_rpi.lock
sbom: sbom_temp1.cdx.json
conan_params: '--profile:host=cpr_linux_rpi4_gcc10_release --profile:build=cpr_linux_x86_64_release'
- name: Enrich and Augment SBOM
uses: sbomify/sbomify-action@master
env:
SBOM_FILE: sbom_temp1.cdx.json
OUTPUT_FILE: sbom_temp2.cdx.json
COMPONENT_NAME: AppAPI_CPP
COMPONENT_VERSION: ${{ env.SW_VERSION }}
# Produkt- und Firmeninfo werden aus sbomify.json geladen
AUGMENT: true
# Metadaten aus Paket-Registry hinzufügen
ENRICH: true
# Metadaten aus additional_packages_rpi.txt hinzufügen
ADDITIONAL_PACKAGES_FILE: additional_packages_rpi.txt
UPLOAD: false
- name: Final SBOM enrichment
uses: CommonplaceRobotics/Action_SBOM_Enrichment@v9
with:
database: .github/workflows/sbom_enrichment_db.json
sbom: sbom_temp2.cdx.json
sbom_out: sbom_rpi.cdx.json
cmake_build_dir: out/build/Linux/armv8_32/Release
- name: Export SBOM
uses: actions/upload-artifact@v7
with:
path: sbom_rpi.cdx.json
archive: false
- name: Validate SBOM with company policies
uses: CommonplaceRobotics/SW_Validate_SBOM@v6
with:
sbom: sbom_rpi.cdx.json