diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-03-11 17:13:17 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-03-11 17:13:17 +0300 |
commit | 68d795158f31f349599dfb59e435ca4daf7370bc (patch) | |
tree | 7deacbc36476656dbcad8ab766bdcf2ad8f37d0c /.travis | |
parent | Travis: prettier output (diff) | |
download | vk-scripts-68d795158f31f349599dfb59e435ca4daf7370bc.tar.gz vk-scripts-68d795158f31f349599dfb59e435ca4daf7370bc.zip |
Travis: restructure .travis/
Diffstat (limited to '')
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | .travis/bin/main.sh | 19 | ||||
-rwxr-xr-x | .travis/bin/mutual_friends.sh (renamed from .travis/test/mutual_friends.sh) | 10 | ||||
-rwxr-xr-x | .travis/bin/online_sessions.sh (renamed from .travis/test/online_sessions.sh) | 10 | ||||
-rwxr-xr-x | .travis/bin/show_status.sh (renamed from .travis/test/show_status.sh) | 8 | ||||
-rwxr-xr-x | .travis/bin/track_status.sh (renamed from .travis/test/track_status.sh) | 6 | ||||
-rwxr-xr-x | .travis/lib/test.sh (renamed from .travis/test.sh) | 6 | ||||
-rw-r--r-- | .travis/share/test_db.csv (renamed from .travis/test_db.csv) | 0 | ||||
-rwxr-xr-x | .travis/travis.sh | 11 |
9 files changed, 50 insertions, 22 deletions
diff --git a/.travis.yml b/.travis.yml index d3d1567..3b958c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,4 @@ python: - '3.7' jobs: fast_finish: true -script: ./.travis/travis.sh +script: ./.travis/bin/main.sh diff --git a/.travis/bin/main.sh b/.travis/bin/main.sh new file mode 100755 index 0000000..bfe2052 --- /dev/null +++ b/.travis/bin/main.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Copyright (c) 2019 Egor Tensin <Egor.Tensin@gmail.com> +# This file is part of the "VK scripts" project. +# For details, see https://github.com/egor-tensin/vk-scripts. +# Distributed under the MIT License. + +set -o errexit -o nounset -o pipefail + +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + +"$script_dir/mutual_friends.sh" + +"$script_dir/online_sessions.sh" + +"$script_dir/show_status.sh" +"$script_dir/track_status.sh" diff --git a/.travis/test/mutual_friends.sh b/.travis/bin/mutual_friends.sh index ebecf8e..4a00fb8 100755 --- a/.travis/test/mutual_friends.sh +++ b/.travis/bin/mutual_friends.sh @@ -7,13 +7,17 @@ set -o errexit -o nounset -o pipefail +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + test_users() { - ./.travis/test.sh bin.mutual_friends --format csv "$@" - ./.travis/test.sh bin.mutual_friends --format json "$@" + "$script_dir/../lib/test.sh" bin.mutual_friends --format csv "$@" + "$script_dir/../lib/test.sh" bin.mutual_friends --format json "$@" } main() { test_users kreed58 maxkorzh_official } -main "$@" +main diff --git a/.travis/test/online_sessions.sh b/.travis/bin/online_sessions.sh index 7d26630..2534735 100755 --- a/.travis/test/online_sessions.sh +++ b/.travis/bin/online_sessions.sh @@ -7,7 +7,11 @@ set -o errexit -o nounset -o pipefail -readonly db_path='.travis/test_db.csv' +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + +readonly db_path="$script_dir/../share/test_db.csv" try_output() { local output_path @@ -18,7 +22,7 @@ try_output() { trap "$rm_aux_files" RETURN - ./.travis/test.sh bin.online_sessions "$@" "$db_path" "$output_path" + "$script_dir/../lib/test.sh" bin.online_sessions "$@" "$db_path" "$output_path" if file --brief --dereference --mime -- "$output_path" | grep --quiet -- 'charset=binary$'; then echo 'Output is a binary file, not going to show that' @@ -51,4 +55,4 @@ main() { online_sessions } -main "$@" +main diff --git a/.travis/test/show_status.sh b/.travis/bin/show_status.sh index ff0ce47..c9f8e26 100755 --- a/.travis/test/show_status.sh +++ b/.travis/bin/show_status.sh @@ -7,12 +7,16 @@ set -o errexit -o nounset -o pipefail +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + test_users() { - ./.travis/test.sh bin.show_status "$@" + "$script_dir/../lib/test.sh" bin.show_status "$@" } main() { test_users egor.tensin } -main "$@" +main diff --git a/.travis/test/track_status.sh b/.travis/bin/track_status.sh index 2b3e001..9aedb6b 100755 --- a/.travis/test/track_status.sh +++ b/.travis/bin/track_status.sh @@ -7,6 +7,10 @@ set -o errexit -o nounset -o pipefail +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + test_users() { local log_path log_path="$( mktemp )" @@ -17,7 +21,7 @@ test_users() { rm_aux_files="$( printf -- 'rm -f -- %q %q' "$log_path" "$db_path" )" trap "$rm_aux_files" RETURN - ./.travis/test.sh bin.track_status "$@" --log "$log_path" --format csv --output "$db_path" & + "$script_dir/../lib/test.sh" bin.track_status "$@" --log "$log_path" --format csv --output "$db_path" & local pid="$!" sleep 3 diff --git a/.travis/test.sh b/.travis/lib/test.sh index 83c4efa..c91ce48 100755 --- a/.travis/test.sh +++ b/.travis/lib/test.sh @@ -7,6 +7,10 @@ set -o errexit -o nounset -o pipefail +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + run_test() { local arg echo @@ -17,7 +21,7 @@ run_test() { echo echo ====================================================================== - python3 -m "$@" + PYTHONPATH="$script_dir/../.." python3 -m "$@" } run_test "$@" diff --git a/.travis/test_db.csv b/.travis/share/test_db.csv index 2b087a8..2b087a8 100644 --- a/.travis/test_db.csv +++ b/.travis/share/test_db.csv diff --git a/.travis/travis.sh b/.travis/travis.sh deleted file mode 100755 index 758e2fd..0000000 --- a/.travis/travis.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2019 Egor Tensin <Egor.Tensin@gmail.com> -# This file is part of the "VK scripts" project. -# For details, see https://github.com/egor-tensin/vk-scripts. -# Distributed under the MIT License. - -./.travis/test/mutual_friends.sh -./.travis/test/show_status.sh -./.travis/test/track_status.sh -./.travis/test/online_sessions.sh |