diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d64749b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: CI +on: + push: + schedule: + - cron: '0 8 * * 6' +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python: [2.7, pypy2, 3.4, 3.5, 3.6, 3.7, 3.8, pypy3] + name: Python ${{ matrix.python }} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - run: ./test/test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f81b161..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: python -python: - - "2.7" - - "pypy" - - "3.4" - - "3.5" - - "3.6" - - "3.7" - - "3.8" - - "nightly" - - "pypy3" - -sudo: false - -script: - - ./test/test diff --git a/README.md b/README.md index ae7e570..fa24201 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dotbot [![Build Status](https://travis-ci.com/anishathalye/dotbot.svg?branch=master)](https://travis-ci.com/anishathalye/dotbot) +# Dotbot [![Build Status](https://github.com/anishathalye/dotbot/workflows/CI/badge.svg)](https://github.com/anishathalye/dotbot/actions?query=workflow%3ACI) Dotbot makes installing your dotfiles as easy as `git clone $url && cd dotfiles && ./install`, even on a freshly installed system! diff --git a/test/driver-lib.bash b/test/driver-lib.bash index dcbcba6..ab59240 100644 --- a/test/driver-lib.bash +++ b/test/driver-lib.bash @@ -24,30 +24,14 @@ yellow() { check_env() { - if [[ "$(whoami)" != "vagrant" && ( "${TRAVIS}" != true || "${CI}" != true ) ]]; then - die "tests must be run inside Travis or Vagrant" + if [[ "$(whoami)" != "vagrant" && "${CI}" != true ]]; then + die "tests must be run inside Vagrant or CI" fi } cleanup() { - ( - if [ "$(whoami)" == "vagrant" ]; then - cd $HOME - find . -not \( \ - -path './.pyenv' -o \ - -path './.pyenv/*' -o \ - -path './.bashrc' -o \ - -path './.profile' -o \ - -path './.ssh' -o \ - -path './.ssh/*' \ - \) -delete >/dev/null 2>&1 - else - find ~ -mindepth 1 -newermt "${date_stamp}" \ - -not \( -path ~ -o -path "${BASEDIR}/*" \ - -o -path ~/dotfiles \) \ - -exec rm -rf {} + - fi - ) || true + rm -rf ~/fakehome + mkdir -p ~/fakehome } initialize() { @@ -76,7 +60,7 @@ run_test() { tests_run=$((tests_run + 1)) printf '[%d/%d] (%s)\n' "${tests_run}" "${tests_total}" "${1}" cleanup - if (cd "${BASEDIR}/test/tests" && DOTBOT_TEST=true bash "${1}"); then + if (cd "${BASEDIR}/test/tests" && HOME=~/fakehome DOTBOT_TEST=true bash "${1}"); then pass else fail diff --git a/test/test-lib.bash b/test/test-lib.bash index fba9aa0..5472e46 100644 --- a/test/test-lib.bash +++ b/test/test-lib.bash @@ -1,6 +1,6 @@ DEBUG=${DEBUG:-false} DOTBOT_EXEC="${BASEDIR}/bin/dotbot" -DOTFILES="/home/$(whoami)/dotfiles" +DOTFILES="${HOME}/dotfiles" INSTALL_CONF='install.conf.yaml' INSTALL_CONF_JSON='install.conf.json' diff --git a/test/tests/except-multi.bash b/test/tests/except-multi.bash index 4193e66..5832011 100644 --- a/test/tests/except-multi.bash +++ b/test/tests/except-multi.bash @@ -16,6 +16,6 @@ EOF ' test_expect_success 'test' ' -[ "$(readlink ~/bad | cut -d/ -f4-)" = "dotfiles/nonexistent" ] && +[ "$(readlink ~/bad | cut -d/ -f5-)" = "dotfiles/nonexistent" ] && ! test -f ~/x && test -f ~/y ' diff --git a/test/tests/link-canonicalize.bash b/test/tests/link-canonicalize.bash index 34015c8..ee06f2e 100644 --- a/test/tests/link-canonicalize.bash +++ b/test/tests/link-canonicalize.bash @@ -16,5 +16,5 @@ ${DOTBOT_EXEC} -c dotfiles-symlink/${INSTALL_CONF} ' test_expect_success 'test' ' -[ "$(readlink ~/.f | cut -d/ -f4-)" = "dotfiles/f" ] +[ "$(readlink ~/.f | cut -d/ -f5-)" = "dotfiles/f" ] ' diff --git a/test/tests/link-if.bash b/test/tests/link-if.bash index 1ea7709..fbc80f3 100644 --- a/test/tests/link-if.bash +++ b/test/tests/link-if.bash @@ -17,7 +17,7 @@ run_dotbot <