diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..59cf7d4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,37 @@ +name: tests +on: [pull_request, push] +jobs: + tests: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-22.04 + - ubuntu-20.04 + - macos-12 + - macos-11 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + # Normally, we would use the superbly maintained... + # - uses: actions/setup-python@v2 + # with: + # python-version: ${{ matrix.python-version }} + # ... but in the repo, we want to test pyenv builds on Ubuntu + # - run: | + # sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \ + # libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ + # xz-utils tk-dev libffi-dev liblzma-dev python-openssl git + # https://github.com/pyenv/pyenv#installation + #- env: + # PYENV_ROOT: /home/runner/work/pyenv/pyenv + # run: | + # echo $PYENV_ROOT + # echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH + # macos-11 Github Actions env has an old `readlink` and lacks `greadlink` which causes Bats to break + - run: | + if [[ $RUNNER_OS == "macOS" ]] && [[ $(sw_vers -productVersion | awk -F. '{print $1}') -lt 12 ]]; then + brew install coreutils + fi + - run: git clone https://github.com/bats-core/bats-core.git --depth=1 -b v1.2.0 bats + - run: bats/bin/bats --tap test diff --git a/test/deactivate.bats b/test/deactivate.bats index d0b6dea..53ed0cb 100644 --- a/test/deactivate.bats +++ b/test/deactivate.bats @@ -1,4 +1,4 @@ -#!/usr/bin/env bats + #!/usr/bin/env bats load test_helper @@ -54,7 +54,7 @@ EOS export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv" export PYENV_ACTIVATE_SHELL= - PYENV_SHELL="bash" run pyenv-sh-deactivate --quit + PYENV_SHELL="bash" run pyenv-sh-deactivate --quiet assert_success assert_output </dev/null 2>&1; then - unset -f deactivate; -fi; -EOS -} - @test "deactivate virtualenv (with shell activation)" { export PYENV_VIRTUALENV_INIT=1 export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv" diff --git a/test/init.bats b/test/init.bats index ba90b5d..85f2b42 100644 --- a/test/init.bats +++ b/test/init.bats @@ -72,6 +72,8 @@ EOS run pyenv-virtualenv-init - fish assert_success assert_output <