aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-09-30 03:58:22 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-09-30 04:13:06 +0300
commit873e2e07347cc40a310680e190c7535068699a7b (patch)
tree59496274bc7d588a2efd4e4f6ac988319c01a5d6
parentadd plot.sh (same as plot.bat) (diff)
downloadsorting-algorithms-873e2e07347cc40a310680e190c7535068699a7b.tar.gz
sorting-algorithms-873e2e07347cc40a310680e190c7535068699a7b.zip
add Travis configuration
-rw-r--r--.travis.yml7
-rwxr-xr-x.travis/plot.sh45
-rwxr-xr-xplot.sh2
3 files changed, 53 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5147012
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+language: python
+python:
+ - '3.4'
+ - '3.5'
+ - '3.6'
+ - '3.7'
+script: ./.travis/plot.sh
diff --git a/.travis/plot.sh b/.travis/plot.sh
new file mode 100755
index 0000000..091abab
--- /dev/null
+++ b/.travis/plot.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2019 Egor Tensin <Egor.Tensin@gmail.com>
+# This file is part of the "Sorting algorithms" project.
+# For details, see https://github.com/egor-tensin/sorting-algorithms.
+# 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
+
+declare -a algorithm_list=(
+ bubble_sort
+ bubble_sort_optimized
+ heapsort
+ insertion_sort
+ merge_sort
+ quicksort_first
+ quicksort_last
+ quicksort_middle
+ quicksort_random
+ quicksort_second
+ selection_sort
+)
+
+fix_matplotlib() {
+ # Get rid of:
+ # tkinter.TclError: no display name and no $DISPLAY environment variable
+ mkdir -p -- ~/.config/matplotlib
+ echo 'backend: Agg' > ~/.config/matplotlib/matplotlibrc
+}
+
+main() {
+ fix_matplotlib
+
+ local algorithm
+ for algorithm in ${algorithm_list[@]+"${algorithm_list[@]}"}; do
+ echo "Plotting algorithm $algorithm..."
+ "$script_dir/../plot.sh" "$algorithm"
+ done
+}
+
+main "$@"
diff --git a/plot.sh b/plot.sh
index 691bc01..efdd42f 100755
--- a/plot.sh
+++ b/plot.sh
@@ -33,7 +33,7 @@ main() {
local input_kind
for input_kind in best average worst; do
- local output_path="${algorithm}_${iterations}_${input_kind}_${min}_${max}.png"
+ local output_path="$script_dir/${algorithm}_${iterations}_${input_kind}_${min}_${max}.png"
python3 "$script_dir/plot.py" \
"$algorithm" \
--input "$input_kind" \