Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Validate all defconfig files before running any builds #14317

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,59 @@ jobs:
export ARTIFACTDIR=`pwd`/buildartifacts
git config --global --add safe.directory /github/workspace/sources/nuttx
git config --global --add safe.directory /github/workspace/sources/apps

# Validate the defconfig files in a temp folder, preserving the links
tar cf sources.tar sources/nuttx sources/apps
mkdir validate
pushd validate
tar xf ../sources.tar
pushd sources/nuttx
rm -rf .git ../apps/.git
testfile=tools/ci/testlist/${{matrix.boards}}.dat
echo Validating targets in $testfile
testlist=`grep -v -E "^(-|#)|^[C|c][M|m][A|a][K|k][E|e]" $testfile || true`

# For every target in the .dat file
for line in $testlist; do
firstch=${line:0:1}
if [ "X$firstch" == "X/" ]; then
dir=`echo $line | cut -d',' -f1`
list=`find boards$dir -name defconfig | cut -d'/' -f4,6`
for config in ${list}; do

# Skip the Excluded Targets, like "-moxa:nsh"
target=${config/\//:}
if grep -e "-$target" $testfile; then
echo Skipping Excluded Target $config
continue
fi

# Skip the CMake Targets, like "CMake,nucleo-f334r8:adc"
if grep "CMake,$target" $testfile; then
echo Skipping CMake Target $config
continue
fi

# Validate the target
make distclean >/dev/null 2>&1 || true
echo ./tools/refresh.sh --silent $config
if ! ./tools/refresh.sh --silent $config; then
echo Error: $config:1:1: error: $config is configured incorrectly. To fix it, run '"'tools/refresh.sh $config'"'
fail=1
fi
done
fi
done
popd ; popd
rm -rf sources.tar validate

# Quit if the defconfig validation failed
if [[ "$fail" == "1" ]]; then
echo Error: $testfile:1:1: error: Quitting, defconfig validation failed for $testfile
exit 1
fi

# Build the targets
cd sources/nuttx/tools/ci
if [ "X${{matrix.boards}}" = "Xcodechecker" ]; then
./cibuild.sh -c -A -N -R --codechecker testlist/${{matrix.boards}}.dat
Expand Down Expand Up @@ -385,4 +438,4 @@ jobs:
with:
name: msvc-builds
path: buildartifacts/
continue-on-error: true
continue-on-error: true
Loading