mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-23 11:21:45 +08:00
Merge pull request #52 from jeremiejig/travisci
Travis: Base of travis test
This commit is contained in:
commit
1994b658ff
28
.travis.yml
28
.travis.yml
|
@ -5,13 +5,35 @@ sudo: false
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
|
- bc
|
||||||
|
- doxygen
|
||||||
|
- expect
|
||||||
|
- gettext
|
||||||
|
- libncurses5-dev
|
||||||
- tree
|
- tree
|
||||||
- fish
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- PATH="$HOME/fish/bin:$PATH"
|
||||||
|
- OMF_REPO_URI="https://github.com/$TRAVIS_REPO_SLUG"
|
||||||
|
- OMF_REPO_BRANCH="$TRAVIS_BRANCH"
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- tools/travis_install_fish.sh
|
||||||
|
- fish -c 'ln -sf $TRAVIS_BUILD_DIR/tests/functions_override $fish_function_path[1]'
|
||||||
|
|
||||||
before_script: pwd; tree -h
|
before_script: pwd; tree -h
|
||||||
script: "/bin/sh bin/install"
|
|
||||||
|
script:
|
||||||
|
- /bin/sh tools/travis_install_omf.sh
|
||||||
|
- tests/test_runner.fish
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- cd ~/.config/fish; tree -h; find . -type f | xargs cat
|
- cd ~/.config/fish; tree -h; find . -type f | xargs cat
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $HOME/fish
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|
11
bin/install
11
bin/install
|
@ -58,19 +58,16 @@ omf_install() {
|
||||||
die "Could not clone the repository → ${OMF_PATH}:${OMF_REPO_BRANCH}"
|
die "Could not clone the repository → ${OMF_PATH}:${OMF_REPO_BRANCH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd ${OMF_PATH} >/dev/null 2>&1
|
local git_rev=$(git -C ${OMF_PATH} rev-parse HEAD) >/dev/null 2>&1
|
||||||
|
local git_upstream=$(git -C ${OMF_PATH} config remote.upstream.url)
|
||||||
local git_rev=$(git rev-parse HEAD) >/dev/null 2>&1
|
|
||||||
local git_upstream=$(git config remote.upstream.url)
|
|
||||||
|
|
||||||
if [ -z "${git_upstream}" ]; then
|
if [ -z "${git_upstream}" ]; then
|
||||||
git remote add upstream ${git_uri}
|
git -C ${OMF_PATH} remote add upstream ${git_uri}
|
||||||
else
|
else
|
||||||
git remote set-url upstream ${git_uri}
|
git -C ${OMF_PATH} remote set-url upstream ${git_uri}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Oh My Fish revision id → ${git_rev}"
|
echo "Oh My Fish revision id → ${git_rev}"
|
||||||
popd >/dev/null 2>&1
|
|
||||||
test -z ${FISH_CONFIG+_} && FISH_CONFIG="${XDG_CONFIG_HOME}/fish"
|
test -z ${FISH_CONFIG+_} && FISH_CONFIG="${XDG_CONFIG_HOME}/fish"
|
||||||
|
|
||||||
local fish_config_file="${FISH_CONFIG}/config.fish"
|
local fish_config_file="${FISH_CONFIG}/config.fish"
|
||||||
|
|
10
tests/functions_override/refresh.fish
Normal file
10
tests/functions_override/refresh.fish
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# SYNOPSIS
|
||||||
|
# refresh
|
||||||
|
#
|
||||||
|
# OVERVIEW
|
||||||
|
# Refresh (reload) the current fish session.
|
||||||
|
|
||||||
|
function refresh -d "refresh the fish session (Travis Override)"
|
||||||
|
echo !!! Shell refresh requested in testing Environment !!!
|
||||||
|
exit 0;
|
||||||
|
end
|
16
tests/test_runner.fish
Executable file
16
tests/test_runner.fish
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
# TODO: This is only a basic draft.
|
||||||
|
|
||||||
|
set -l return_code 0
|
||||||
|
|
||||||
|
set commands "omf help" "omf query PATH" "omf query fish_function_path" "omf install apt"
|
||||||
|
for cmd in $commands
|
||||||
|
echo \$ $cmd
|
||||||
|
if not eval $cmd
|
||||||
|
set return_code 1
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
exit $return_code
|
12
tools/travis_install_fish.sh
Executable file
12
tools/travis_install_fish.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
BINDIR=$HOME/fish/bin
|
||||||
|
# check to see if fish bin doesn't exist
|
||||||
|
if [ ! -x "$BINDIR/fish" ]; then
|
||||||
|
cd /tmp
|
||||||
|
wget -O - https://github.com/fish-shell/fish-shell/releases/download/2.2.0/fish-2.2.0.tar.gz | tar xzv
|
||||||
|
cd fish-2.2.0 && ./configure --prefix=$HOME/fish && make -j2 && make install;
|
||||||
|
strip $BINDIR/fish $BINDIR/fish_indent $BINDIR/mimedb
|
||||||
|
else
|
||||||
|
echo 'Using cached directory.';
|
||||||
|
fi
|
21
tools/travis_install_omf.sh
Executable file
21
tools/travis_install_omf.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
git () {
|
||||||
|
case $1 in
|
||||||
|
clone)
|
||||||
|
command git "$@"
|
||||||
|
if test "$TRAVIS_PULL_REQUEST" != "false"; then
|
||||||
|
echo "! detecting a pull request !"
|
||||||
|
echo "$ git -C $OMF_PATH fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge:"
|
||||||
|
git -C $OMF_PATH fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge:
|
||||||
|
echo "$ git -C $OMF_PATH checkout -qf FETCH_HEAD"
|
||||||
|
git -C $OMF_PATH checkout -qf FETCH_HEAD
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
command git "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
. $TRAVIS_BUILD_DIR/bin/install
|
Loading…
Reference in New Issue
Block a user