Add docker test

This commit is contained in:
westito 2022-08-01 22:09:36 +02:00
parent 4bb36488e1
commit 936656b6cc
7 changed files with 60 additions and 18 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
**/.dart_tool
**/pubspec.lock
**/build

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
FROM dart
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y chromium build-essential gcc
RUN ln -s /usr/bin/chromium /usr/bin/google-chrome
RUN chmod +x /usr/bin/google-chrome
RUN useradd -ms /bin/bash developer
RUN mkdir -p /app
USER developer
WORKDIR /home/developer
RUN cd /tmp/ &&\
mkdir sqlite &&\
cd sqlite &&\
curl https://sqlite.org/2022/sqlite-autoconf-3380000.tar.gz --output sqlite.tar.gz &&\
tar zxvf sqlite.tar.gz &&\
cd sqlite-autoconf-3380000 &&\
./configure &&\
make &&\
mkdir ../out &&\
cp sqlite3 ../out &&\
cp .libs/libsqlite3.so ../out
USER developer
COPY --chown=developer:developer . /app/
WORKDIR /app/tool
RUN ./upgrade_all.sh
CMD export LD_LIBRARY_PATH=/tmp/sqlite/out ; ./test_all.sh
#; (cd .. && ./tool/misc_integration_test.sh)

7
tool/docker_test.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
cd ..
DOCKER_BUILDKIT=0 docker build -t drift-test .
docker run --rm --privileged -it drift-test
docker image rm drift-test

View File

@ -1,17 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
EXIT_CODE=0
pushd extras/drift_postgres pushd extras/drift_postgres
echo "Running integration tests with Postgres" echo "Running integration tests with Postgres"
dart pub upgrade dart pub upgrade
dart test || EXIT_CODE=$? dart test || true
popd popd
pushd examples/with_built_value pushd examples/with_built_value
echo "Running build runner in with_built_value" echo "Running build runner in with_built_value"
dart pub upgrade dart pub upgrade
dart run build_runner build --delete-conflicting-outputs || EXIT_CODE=$? dart run build_runner build --delete-conflicting-outputs
popd popd
pushd examples/migrations_example pushd examples/migrations_example
@ -19,5 +17,3 @@ echo "Testing migrations in migrations_example"
dart pub upgrade dart pub upgrade
dart test dart test
popd popd
exit $EXIT_CODE

View File

@ -1 +0,0 @@
find ../ -name pubspec.yaml -execdir dart pub get \;

View File

@ -8,12 +8,12 @@ function run_test() {
dart format -o none --set-exit-if-changed . dart format -o none --set-exit-if-changed .
dart analyze --fatal-infos --fatal-warnings dart analyze --fatal-infos --fatal-warnings
if [[ "$2" == 'vm+web' ]]; then if [[ "$2" == 'vm+web' ]]; then
dart test dart test -p vm
dart test -p chrome dart test -p chrome
elif [[ "$2" == 'web-only' ]]; then elif [[ "$2" == 'web-only' ]]; then
dart test -p chrome dart test -p chrome
else else
dart test dart test -p vm
fi fi
popd > /dev/null popd > /dev/null
} }
@ -30,12 +30,16 @@ function run_test_flutter() {
} }
cd .. cd ..
run_test 'drift' 'vm+web'
run_test 'drift_dev' if [[ "$1" == 'flutter' ]]; then
run_test 'sqlparser' run_test_flutter 'drift_sqflite' 'integration_test'
run_test_flutter 'drift_sqflite' 'integration_test' run_test_flutter 'examples/app'
run_test_flutter 'examples/app' run_test_flutter 'extras/integration_tests/ffi_on_flutter' 'integration_test/drift_native.dart'
run_test 'examples/migrations_example' else
run_test_flutter 'extras/integration_tests/ffi_on_flutter' 'integration_test/drift_native.dart' run_test 'drift' 'vm+web'
run_test 'extras/integration_tests/web' 'web-only' run_test 'drift_dev'
run_test 'extras/drift_postgres' run_test 'sqlparser'
run_test 'examples/migrations_example'
run_test 'extras/integration_tests/web' 'web-only'
run_test 'extras/drift_postgres'
fi

1
tool/upgrade_all.sh Executable file
View File

@ -0,0 +1 @@
find ../ -name pubspec.yaml -execdir dart pub upgrade \;