refine build.sh and CI

This commit is contained in:
Li Jie
2025-08-22 08:54:45 +08:00
parent 50d8dbee05
commit 3ce63965bf
4 changed files with 181 additions and 397 deletions

View File

@@ -1,252 +0,0 @@
#!/bin/bash
# Initialize arrays to store results
successful_targets=()
warned_targets=()
failed_targets=()
for target in \
adafruit-esp32-feather-v2 \
ae-rp2040 \
arduino-leonardo \
arduino-mega1280 \
arduino-mega2560 \
arduino-mkr1000 \
arduino-mkrwifi1010 \
arduino-nano-new \
arduino-nano \
arduino-nano33 \
arduino-zero \
arduino \
atmega1280 \
atmega1284p \
atmega2560 \
atmega328p \
atmega328pb \
atmega32u4 \
atsamd21e18a \
atsamd21g18a \
atsamd51g19a \
atsamd51j19a \
atsamd51j20a \
atsamd51p19a \
atsamd51p20a \
atsame51j19a \
atsame54-xpro \
atsame54p20a \
attiny1616 \
attiny85 \
avr \
avrtiny \
badger2040-w \
badger2040 \
bluemicro840 \
bluepill-clone \
bluepill \
btt-skr-pico \
challenger-rp2040 \
circuitplay-bluefruit \
circuitplay-express \
clue-alpha \
clue \
cortex-m-qemu \
cortex-m \
cortex-m0 \
cortex-m0plus \
cortex-m3 \
cortex-m33 \
cortex-m4 \
cortex-m7 \
d1mini \
digispark \
elecrow-rp2040 \
elecrow-rp2350 \
esp-c3-32s-kit \
esp32-c3-devkit-rust-1 \
esp32-coreboard-v2 \
esp32-mini32 \
esp32 \
esp32c3-12f \
esp32c3-supermini \
esp32c3 \
esp8266 \
fe310 \
feather-m0-express \
feather-m0 \
feather-m4-can \
feather-m4 \
feather-nrf52840-sense \
feather-nrf52840 \
feather-rp2040 \
feather-stm32f405 \
gameboy-advance \
gemma-m0 \
gnse \
gobadge \
gopher-badge \
gopherbot \
gopherbot2 \
grandcentral-m4 \
hifive1b \
hw-651-s110v8 \
hw-651 \
itsybitsy-m0 \
itsybitsy-m4 \
itsybitsy-nrf52840 \
k210 \
kb2040 \
lgt92 \
lorae5 \
m5paper \
m5stack-core2 \
m5stack \
m5stamp-c3 \
m5stick-c \
macropad-rp2040 \
maixbit \
makerfabs-esp32c3spi35 \
matrixportal-m4 \
mch2022 \
mdbt50qrx-uf2 \
metro-m4-airlift \
microbit-s110v8 \
microbit-v2-s113v7 \
microbit-v2-s140v7 \
microbit-v2 \
microbit \
mksnanov3 \
nano-33-ble-s140v6-uf2 \
nano-33-ble-s140v7-uf2 \
nano-33-ble-s140v7 \
nano-33-ble \
nano-rp2040 \
nicenano \
nintendoswitch \
nodemcu \
nrf51-s110v8 \
nrf51 \
nrf52-s132v6 \
nrf52 \
nrf52833-s113v7 \
nrf52833-s140v7 \
nrf52833 \
nrf52840-mdk-usb-dongle \
nrf52840-mdk \
nrf52840-s140v6-uf2-generic \
nrf52840-s140v6-uf2 \
nrf52840-s140v7-uf2 \
nrf52840-s140v7 \
nrf52840 \
nucleo-f103rb \
nucleo-f722ze \
nucleo-l031k6 \
nucleo-l432kc \
nucleo-l476rg \
nucleo-l552ze \
nucleo-wl55jc \
p1am-100 \
particle-3rd-gen \
particle-argon \
particle-boron \
particle-xenon \
pca10031 \
pca10040-s132v6 \
pca10040 \
pca10056-s140v6-uf2 \
pca10056-s140v7 \
pca10056 \
pca10059-s140v7 \
pca10059 \
pga2350 \
pico-plus2 \
pico-w \
pico \
pico2-w \
pico2 \
pinetime \
pybadge \
pygamer \
pyportal \
qtpy-esp32c3 \
qtpy-rp2040 \
qtpy \
rak4631 \
reelboard-s140v7 \
reelboard \
riscv-qemu \
riscv \
riscv32 \
riscv64 \
rp2040 \
rp2350 \
rp2350b \
simavr \
stm32f469disco \
stm32f4disco-1 \
stm32f4disco \
stm32l0x2 \
stm32wl5x_cm4 \
stm32wle5 \
swan \
teensy36 \
teensy40 \
teensy41 \
thingplus-rp2040 \
thumby \
tiny2350 \
tkey \
trinket-m0 \
trinkey-qt2040 \
tufty2040 \
wasi \
wasip1 \
wasip2 \
wasm-unknown \
wasm \
waveshare-rp2040-tiny \
waveshare-rp2040-zero \
wioterminal \
x9pro \
xiao-ble \
xiao-esp32c3 \
xiao-rp2040 \
xiao \
xtensa; do
output=$(../../llgo.sh build -target $target -o hello.out . 2>&1)
if [ $? -eq 0 ]; then
echo$target `file hello.out`
successful_targets+=("$target")
else
# Check if output contains warning messages
if echo "$output" | grep -q "does not have a valid LLVM target triple\|does not have a valid CPU configuration"; then
echo ⚠️ $target
echo "$output"
warned_targets+=("$target")
else
echo$target
echo "$output"
failed_targets+=("$target")
fi
fi
done
echo ""
echo "----------------------------------------"
# Output successful targets
echo "Successful targets (${#successful_targets[@]} total):"
for target in "${successful_targets[@]}"; do
echo "$target"
done
echo ""
echo "Warned targets (${#warned_targets[@]} total):"
for target in "${warned_targets[@]}"; do
echo "$target"
done
echo ""
echo "Failed targets (${#failed_targets[@]} total):"
for target in "${failed_targets[@]}"; do
echo "$target"
done

View File

@@ -1,144 +0,0 @@
for target in \
adafruit-esp32-feather-v2 \
ae-rp2040 \
arduino-leonardo \
arduino-mega1280 \
arduino-mega2560 \
arduino-mkr1000 \
arduino-mkrwifi1010 \
arduino-nano-new \
arduino-nano \
arduino-nano33 \
arduino-zero \
arduino \
atmega1284p \
atmega328pb \
atsamd21e18a \
atsamd21g18a \
atsamd51g19a \
atsamd51j19a \
atsamd51j20a \
atsamd51p19a \
atsamd51p20a \
atsame51j19a \
atsame54-xpro \
atsame54p20a \
attiny1616 \
badger2040-w \
badger2040 \
bluepill-clone \
bluepill \
btt-skr-pico \
challenger-rp2040 \
circuitplay-express \
cortex-m-qemu \
cortex-m0 \
cortex-m0plus \
cortex-m3 \
cortex-m33 \
cortex-m4 \
cortex-m7 \
d1mini \
digispark \
elecrow-rp2040 \
elecrow-rp2350 \
esp-c3-32s-kit \
esp32-c3-devkit-rust-1 \
esp32-coreboard-v2 \
esp32-mini32 \
esp32 \
esp32c3-12f \
esp32c3-supermini \
esp32c3 \
esp8266 \
feather-m0-express \
feather-m0 \
feather-m4-can \
feather-m4 \
feather-rp2040 \
feather-stm32f405 \
gemma-m0 \
gnse \
gobadge \
gopher-badge \
gopherbot \
grandcentral-m4 \
hifive1b \
itsybitsy-m0 \
itsybitsy-m4 \
kb2040 \
lgt92 \
lorae5 \
m5paper \
m5stack-core2 \
m5stack \
m5stamp-c3 \
m5stick-c \
macropad-rp2040 \
maixbit \
makerfabs-esp32c3spi35 \
matrixportal-m4 \
mch2022 \
metro-m4-airlift \
mksnanov3 \
nano-rp2040 \
nodemcu \
nucleo-f103rb \
nucleo-f722ze \
nucleo-l031k6 \
nucleo-l432kc \
nucleo-l476rg \
nucleo-wl55jc \
p1am-100 \
pga2350 \
pico-plus2 \
pico-w \
pico \
pico2-w \
pico2 \
pybadge \
pygamer \
pyportal \
qtpy-esp32c3 \
qtpy-rp2040 \
qtpy \
riscv-qemu \
rp2350 \
rp2350b \
simavr \
stm32f469disco \
stm32f4disco-1 \
stm32f4disco \
stm32l0x2 \
stm32wl5x_cm4 \
stm32wle5 \
swan \
teensy36 \
teensy40 \
teensy41 \
thingplus-rp2040 \
thumby \
tiny2350 \
tkey \
trinket-m0 \
trinkey-qt2040 \
tufty2040 \
wasi \
wasip1 \
wasip2 \
wasm-unknown \
wasm \
waveshare-rp2040-tiny \
waveshare-rp2040-zero \
wioterminal \
xiao-esp32c3 \
xiao-rp2040 \
xiao; do
output=$(../../llgo.sh build -v -target $target -o hello.out . 2>&1)
if [ $? -eq 0 ]; then
echo$target `file hello.out`
else
echo$target
echo "$output"
fi
done

180
_demo/targetsbuild/build.sh Normal file
View File

@@ -0,0 +1,180 @@
#!/bin/bash
# Function to display usage information
show_usage() {
cat << EOF
Usage: $(basename "$0") [OPTIONS] [TARGET_FILE]
Build targets for llgo across multiple platforms.
OPTIONS:
-h, --help Show this help message and exit
ARGUMENTS:
TARGET_FILE Optional. A text file containing target names, one per line.
Lines starting with # are treated as comments and ignored.
Empty lines are also ignored.
BEHAVIOR:
Without TARGET_FILE:
- Automatically discovers all targets from ../../targets/*.json files
- Extracts target names from JSON filenames
With TARGET_FILE:
- Reads target names from the specified file
- Supports comments (lines starting with #)
- Ignores empty lines and whitespace
IGNORED TARGETS:
The following targets are automatically ignored and not built:
atmega1280, atmega2560, atmega328p, atmega32u4, attiny85,
fe310, k210, riscv32, riscv64, rp2040
RESULT CATEGORIES:
✅ Successful: Build completed successfully
🔕 Ignored: Target is in the ignore list
⚠️ Warned: Build failed with configuration warnings
❌ Failed: Build failed with errors
EXIT CODES:
0 All builds successful, ignored, or warned only
1 One or more builds failed with errors
EXAMPLES:
$(basename "$0") # Build all targets from JSON files
$(basename "$0") my-targets.txt # Build targets from file
$(basename "$0") --help # Show this help
TARGET FILE FORMAT:
# This is a comment
esp32
cortex-m4
# Another comment
riscv64
EOF
}
# Check for help flag
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_usage
exit 0
fi
# Check for invalid number of arguments
if [ $# -gt 1 ]; then
echo "Error: Too many arguments."
echo "Use '$(basename "$0") --help' for usage information."
exit 1
fi
# Initialize arrays to store results
successful_targets=()
ignored_targets=()
warned_targets=()
failed_targets=()
targets_to_build=()
# Define ignore list
ignore_list=(
"atmega1280"
"atmega2560"
"atmega328p"
"atmega32u4"
"attiny85"
"fe310"
"k210"
"riscv32"
"riscv64"
"rp2040"
)
# Build the targets list based on input method
if [ $# -eq 1 ]; then
# Read targets from file
target_file="$1"
if [ ! -f "$target_file" ]; then
echo "Error: Target file '$target_file' not found."
echo "Use '$(basename "$0") --help' for usage information."
exit 1
fi
while IFS= read -r target || [[ -n "$target" ]]; do
# Skip empty lines and comments
if [[ -z "$target" || "$target" =~ ^[[:space:]]*# ]]; then
continue
fi
# Trim whitespace
target=$(echo "$target" | xargs)
targets_to_build+=("$target")
done < "$target_file"
else
# Use targets from *.json files
for target_file in ../../targets/*.json; do
# Extract target name from filename (remove path and .json extension)
target=$(basename "$target_file" .json)
targets_to_build+=("$target")
done
fi
# Process each target
for target in "${targets_to_build[@]}"; do
# Check if target is in ignore list
if [[ " ${ignore_list[@]} " =~ " ${target} " ]]; then
echo 🔕 $target "(ignored)"
ignored_targets+=("$target")
continue
fi
output=$(../../llgo.sh build -target $target -o hello.out . 2>&1)
if [ $? -eq 0 ]; then
echo$target `file hello.out`
successful_targets+=("$target")
else
# Check if output contains warning messages
if echo "$output" | grep -q "does not have a valid LLVM target triple\|does not have a valid CPU configuration"; then
echo ⚠️ $target
echo "$output"
warned_targets+=("$target")
else
echo$target
echo "$output"
failed_targets+=("$target")
fi
fi
done
echo ""
echo "----------------------------------------"
# Output successful targets
echo "Successful targets (${#successful_targets[@]} total):"
for target in "${successful_targets[@]}"; do
echo "$target"
done
echo ""
echo "Ignored targets (${#ignored_targets[@]} total):"
for target in "${ignored_targets[@]}"; do
echo "$target"
done
echo ""
echo "Warned targets (${#warned_targets[@]} total):"
for target in "${warned_targets[@]}"; do
echo "$target"
done
echo ""
echo "Failed targets (${#failed_targets[@]} total):"
for target in "${failed_targets[@]}"; do
echo "$target"
done
# Exit with error code if there are any failed targets
if [ ${#failed_targets[@]} -gt 0 ]; then
echo ""
echo "Build failed with ${#failed_targets[@]} failed targets."
exit 1
fi