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

./.github/scripts: Restore the build directory #7037

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
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
24 changes: 18 additions & 6 deletions .github/scripts/sketch_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,30 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
exit 1
fi

# The directory that will hold all the artifcats (the build directory) is
# provided through:
# 1. An env variable called ARDUINO_BUILD_DIR.
# 2. Created at the sketch level as "build" in the case of a single
# configuration test.
# 3. Created at the sketch level as "buildX" where X is the number
# of configuration built in case of a multiconfiguration test.

ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
if [ -z "$ARDUINO_BUILD_DIR" ]; then
build_dir="$sketchdir/build"
else
if [ -n "$ARDUINO_BUILD_DIR" ]; then
build_dir="$ARDUINO_BUILD_DIR"
elif [ $len -eq 1 ]; then
build_dir="$sketchdir/build"
fi

mkdir -p "$ARDUINO_CACHE_DIR"
for i in `seq 0 $(($len - 1))`
do
rm -rf "$build_dir$i"
mkdir -p "$build_dir$i"
if [ $len -ne 1 ]; then
build_dir="$sketchdir/build$i"
fi
rm -rf $build_dir
mkdir -p $build_dir

currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'`
sketchname=$(basename $sketchdir)
echo "Building $sketchname with FQBN=$currfqbn"
Expand All @@ -134,7 +146,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
-hardware "$user_path/hardware" \
-libraries "$user_path/libraries" \
-build-cache "$ARDUINO_CACHE_DIR" \
-build-path "$build_dir$i" \
-build-path "$build_dir" \
$xtra_opts "${sketchdir}/${sketchname}.ino"
done
}
Expand Down
12 changes: 11 additions & 1 deletion .github/scripts/tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,24 @@ function run_test() {
len=1
fi

if [ $len -eq 1 ]; then
build_dir="tests/$sketchname/build"
report_file="tests/$sketchname/$sketchname.xml"
fi

for i in `seq 0 $(($len - 1))`
do
echo "Running test: $sketchname -- Config: $i"
if [ $erase_flash -eq 1 ]; then
esptool.py -c $target erase_flash
fi

pytest tests --build-dir tests/$sketchname/build$i -k test_$sketchname --junit-xml=tests/$sketchname/$sketchname$i.xml
if [ $len -ne 1 ]; then
build_dir="tests/$sketchname/build$i"
report_file="tests/$sketchname/$sketchname$i.xml"
fi

pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file
result=$?
if [ $result -ne 0 ]; then
return $result
Expand Down