dioxus/.docker/run_local_tests.sh

45 lines
1.2 KiB
Bash
Raw Normal View History

2022-02-03 08:26:01 +00:00
set -eux
echo "Test script started"
function run_script {
if [[ -d tmp ]]
then
rm -rf tmp
fi
2022-02-03 09:01:45 +00:00
mkdir tmp
2022-02-03 08:26:01 +00:00
# copy files first
rsync -a --progress ../ tmp --exclude target --exclude docker
# build base image
2022-02-06 16:51:04 +00:00
docker build -f Dockerfile_base_test_image -t dioxus-base-test-image .
docker build -f Dockerfile_pre_test -t dioxus-pre-test .
2022-02-03 08:26:01 +00:00
# run test
docker build -f Dockerfile_test -t dioxus-test-image .
2022-02-06 16:51:04 +00:00
# code coverage
docker build -f Dockerfile_code_coverage -t dioxus-code-coverage .
# exec test coverage
cd .. && \
2022-02-06 22:08:26 +00:00
echo "rustup default nightly && cargo +nightly tarpaulin --verbose --all-features --tests --workspace --exclude core-macro --timeout 120 --out Html" | docker run -i --rm --security-opt seccomp=unconfined -v "/home/elios/project/prs/dioxus/:/run_test" dioxus-code-coverage
2022-02-06 16:51:04 +00:00
2022-02-03 08:26:01 +00:00
# clean up
rm -rf tmp
2022-02-03 09:01:45 +00:00
if [ $# -ge 1 ]
2022-02-03 08:26:01 +00:00
then
2022-02-03 09:01:45 +00:00
echo "Got some parameter"
if [ $1 = "--with-full-docker-cleanup" ]
then
docker image rm dioxus-base-test-image
docker image rm dioxus-test-image
fi
2022-02-03 08:26:01 +00:00
fi
}
2022-02-03 09:01:45 +00:00
run_script || echo "Error occured.. cleaning a bit." && \
2022-02-04 16:18:31 +00:00
docker system prune -f;
2022-02-03 09:01:45 +00:00
2022-02-04 16:18:31 +00:00
docker system prune -f
2022-02-03 08:26:01 +00:00
echo "Script finished to execute"