forked from wolfSSL/wolfBoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-build-cmake-dot-config.yml
More file actions
151 lines (124 loc) · 5.02 KB
/
test-build-cmake-dot-config.yml
File metadata and controls
151 lines (124 loc) · 5.02 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
name: wolfboot CMake (.config)
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
jobs:
wolfboot_dot_config_test:
name: cmake .config test (${{ matrix.target }})
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
target:
# These are exact file names from config/examples (including .config)
# - imx-rt1040.config # Disabled, requires NXP SDK
- sim.config
- stm32c0.config
- stm32f1.config
- stm32f4-small-blocks-uart-update.config
- stm32f7.config
- stm32g0.config
- stm32h5.config
- stm32h7.config
- stm32l0.config
- stm32l4-cube.config
- stm32l5.config
- stm32u5.config
- stm32wb.config
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Workaround for sources.list
run: |
# Replace sources
set -euxo pipefail
# Peek (what repos are active now)
apt-cache policy
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
# Enable nullglob so *.list/*.sources that don't exist don't break sed
shopt -s nullglob
echo "Replace sources.list (legacy)"
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
/etc/apt/sources.list || true
echo "Replace sources.list.d/*.list (legacy)"
for f in /etc/apt/sources.list.d/*.list; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
"$f"
done
echo "Replace sources.list.d/*.sources (deb822)"
for f in /etc/apt/sources.list.d/*.sources; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
-e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \
"$f"
done
echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)"
if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then
# Replace azure with our mirror (idempotent)
sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt
fi
# Peek (verify changes)
grep -RIn "azure.archive.ubuntu.com" /etc/apt || true
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
echo "--- apt-mirrors.txt ---"
cat /etc/apt/apt-mirrors.txt || true
- name: Install requirements
run: |
# Run system updates and install toolchain
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake
- name: Run dot-config examples
run: |
# Sample .config cmake test
set -euo pipefail
TARGET="${{ matrix.target }}"
TARGET="${TARGET%.config}"
TARGET="${TARGET%%-*}"
BUILD_DIR="build-${TARGET}"
LOG_FILE="run-${TARGET}.log"
KEYWORD="Config mode: dot"
echo "Target: ${TARGET}"
echo "Build dir: ${BUILD_DIR}"
echo "Saving output to ${LOG_FILE}"
CONFIG_SRC="./config/examples/${{ matrix.target }}"
echo "Fetch ${TARGET} example .config (source: ${CONFIG_SRC})"
if [ ! -f "${CONFIG_SRC}" ]; then
echo "Missing config file: ${CONFIG_SRC}" >&2
exit 1
fi
cp "${CONFIG_SRC}" ./.config
ls .config
cat .config
echo ""
echo "Clean"
rm -rf "./${BUILD_DIR}"
# Here we should see the .config file values read and displayed:
cmake -S . -B "${BUILD_DIR}" \
-DUSE_DOT_CONFIG=ON \
-DWOLFBOOT_TARGET="${TARGET}" 2>&1 | tee "${LOG_FILE}"
# Config dot-config mode
if grep -q -- "${KEYWORD}" "${LOG_FILE}"; then
echo "Keyword found: ${KEYWORD}"
else
echo "Keyword not found: ${KEYWORD}" >&2
exit 1
fi
# First: build keygen explicitly and inspect it
echo "Building keygen_build for ${TARGET}"
cmake --build "${BUILD_DIR}" --parallel 1 --target keygen_build
if [ -f "${BUILD_DIR}/keygen" ]; then
echo "Inspecting keygen:"
ls -l "${BUILD_DIR}/keygen"
file "${BUILD_DIR}/keygen" || true
else
echo "keygen not found at ${BUILD_DIR}/keygen"
fi
# Now run the normal build
echo "Running full build"
cmake --build "${BUILD_DIR}" --parallel 8