Skip to content

Commit

Permalink
Merge pull request #18 from sakebook/fix/tests
Browse files Browse the repository at this point in the history
Fix not execute dart test
  • Loading branch information
sakebook authored Jul 18, 2020
2 parents f4b2918 + 26dc235 commit 7923d99
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ check_credentials() {
echo "OK"
}

switch_working_directory() {
echo "Switching to package directory"
cd "$INPUT_PACKAGE_DIRECTORY"
}

copy_credential() {
echo "Copy credentials"
mkdir -p ~/.pub-cache
Expand All @@ -25,26 +20,41 @@ EOF
echo "OK"
}

create_prefix() {
FLUTTER_PREFIX=""
PUB_PREFIX="pub"
if "${INPUT_FLUTTER_PACKAGE}"; then
FLUTTER_PREFIX="flutter"
PUB_PREFIX=""
fi
switch_working_directory() {
echo "Switching to package directory"
cd "$INPUT_PACKAGE_DIRECTORY"
}

test_dart() {
echo "Run test for dart"
pub get
pub run test
}

test() {
echo "Run test"
$FLUTTER_PREFIX pub get
$FLUTTER_PREFIX $PUB_PREFIX test
test_flutter() {
echo "Run test for flutter"
flutter pub get
flutter test
}

run_test_if_needed() {
if "${INPUT_SKIP_TEST}"; then
echo 'Skip test'
else
test
if "${INPUT_FLUTTER_PACKAGE}"; then
test_flutter
else
test_dart
fi
fi
}

create_prefix() {
FLUTTER_PREFIX=""
PUB_PREFIX="pub"
if "${INPUT_FLUTTER_PACKAGE}"; then
FLUTTER_PREFIX="flutter"
PUB_PREFIX=""
fi
}

Expand All @@ -64,6 +74,6 @@ publish_package() {
check_credentials
copy_credential
switch_working_directory
create_prefix
run_test_if_needed
publish_package
create_prefix
publish_package
Empty file added test/flutter_test.dart
Empty file.

0 comments on commit 7923d99

Please sign in to comment.