diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 997792f..bbe92c2 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -11,11 +11,19 @@ jobs: - uses: actions/checkout@v2 - name: Install dependencies - run: sudo apt install -y fish curl git python3 python3-venv + run: sudo apt install -y fish curl git - - name: Install Tide as dev unattended + - name: Install Tide unattended shell: fish {0} - run: source "$GITHUB_WORKSPACE/tools/tide_install.fish" && tide_install -ldu "$GITHUB_WORKSPACE" + run: source "$GITHUB_WORKSPACE/tools/tide_install.fish" && tide_install -lu "$GITHUB_WORKSPACE" + + - name: Install testing dependencies + shell: fish {0} + run: sudo apt install -y python3 python3-venv + + - name: Install fisher and fishtape + shell: fish {0} + run: tide test -i - name: Run all tests shell: fish {0} diff --git a/tide_theme/functions/test.fish b/tide_theme/functions/test.fish index e54c093..b65f465 100644 --- a/tide_theme/functions/test.fish +++ b/tide_theme/functions/test.fish @@ -1,12 +1,27 @@ function tide_test - argparse 'h/help' 'v/verbose' 'a/all' -- $argv + argparse 'h/help' 'v/verbose' 'a/all' 'i/install' -- $argv if set -q _flag_help _help - return 0 + return end - set -lx TERM xterm # Necessary for testing purposes ensures color codes are printed + if set -q _flag_install + # Install fisher and fishtape for testing + curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish + fisher add jorgebucaran/fishtape + + return + end + + if not functions -q fishtape + set -l b (set_color -o) + set -l n (set_color normal) + printf '%s' $b'fishtape'$n' must be installed to to run Tide\'s test suite. You can install it with'$b' tide test -i'$n + return + end + + set -lx TERM xterm # Necessary for testing purposes, ensures color codes are printed set -l testsDir "$_tide_dir/tests" @@ -62,11 +77,13 @@ function _help set -l optionList \ 'v or --verbose' \ 'a or --all' \ - 'h or --help' + 'h or --help' \ + 'i or --install' set -l descriptionList \ 'display test output even if passed' \ 'run all available tests' \ - 'print this help message' + 'print this help message' \ + 'install fisher and fishtape test dependencies' printf '%s\n' 'Usage: '$g'tide_test '$n'[options] '$b'[TESTS...]'$n printf '%s\n' @@ -74,6 +91,7 @@ function _help printf '%s\n' for option in $optionList printf '%s' ' -'$option + printf '%b' '\r' _tide_cursor_right 20 set -l descriptionIndex (contains -i $option $optionList) printf '%s\n' $descriptionList[$descriptionIndex] diff --git a/tools/tide_actual_install.fish b/tools/tide_actual_install.fish index e54deca..7806f9c 100644 --- a/tools/tide_actual_install.fish +++ b/tools/tide_actual_install.fish @@ -1,5 +1,5 @@ function tide_actual_install - argparse 'l/local' 'd/dev' 'u/unattended' -- $argv + argparse 'l/local' 'u/unattended' -- $argv set -l location $argv[1] if test -z "$location" @@ -28,12 +28,6 @@ function tide_actual_install cp -r "$tempDir/functions" $__fish_config_dir cp -r "$tempDir/tide_theme" $__fish_config_dir - if set -q _flag_dev - # Install fisher and fishtape for testing - curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish - fisher add jorgebucaran/fishtape - end - # --------------------Set Defaults-------------------- _set_immutables