Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test virtual environment activation

on:
push:
branches: [ master ]
branches: [ "master" ]
pull_request:

jobs:
Expand All @@ -14,6 +14,7 @@ jobs:
matrix:
tool: [ "venv", "virtualenv" ]
kind: [ "internal", "external" ]
editor: [ "vim", "neovim" ]

steps:
- name: Checkout the repository
Expand All @@ -28,25 +29,39 @@ jobs:
run: |
python -m pip install --upgrade virtualenv

- name: Set up Vim
- name: Set up editor
run: |
sudo apt-get update
sudo apt-get install --yes vim
sudo apt-get install --yes ${{ matrix.editor }}
if [[ "${{ matrix.editor }}" == "neovim" ]]; then
# Make pynvim available to Python from setup-python
python -m pip install --upgrade pynvim
fi

- name: Create virtual environment
run: |
export VIM_VIRTUALENV_TARGET="$(mktemp --directory)"
python -m ${{ matrix.tool }} "${VIM_VIRTUALENV_TARGET}"
echo "VIM_VIRTUALENV_TARGET=${VIM_VIRTUALENV_TARGET}" >> "${GITHUB_ENV}"

- name: Set up virtual environment
run: |
if [[ "${{ matrix.editor }}" == "neovim" ]]; then
# Make pynvim available to Python from virtualenv
source "${VIM_VIRTUALENV_TARGET}/bin/activate"
python -m pip install --upgrade pynvim
deactivate
fi

- name: Activate virtual environment
run: |
if [[ "${{ matrix.kind }}" -eq "internal" ]];
then cd "${VIM_VIRTUALENV_TARGET}"; \
else source "${VIM_VIRTUALENV_TARGET}/bin/activate"; \
if [[ "${{ matrix.kind }}" == "internal" ]];
then cd "${VIM_VIRTUALENV_TARGET}"
else source "${VIM_VIRTUALENV_TARGET}/bin/activate"
fi
MATRIX_KIND_CODE=$([[ "${{ matrix.kind }}" -eq "internal" ]] && echo 1 || echo 0)
vim --not-a-term -u "${GITHUB_WORKSPACE}/.github/workflows/vimrc.github" \
MATRIX_KIND_CODE=$([[ "${{ matrix.kind }}" == "internal" ]] && echo 1 || echo 0)
MATRIX_EDITOR_CMD=$([[ "${{ matrix.editor }}" == "vim" ]] && echo "vim --not-a-term" || echo "nvim --headless")
${MATRIX_EDITOR_CMD} --clean -u "${GITHUB_WORKSPACE}/.github/workflows/vimrc.github" \
-c "call assert_equal('${{ matrix.tool }}', virtualenv#state('virtualenv_type'))" \
-c "call assert_equal(${MATRIX_KIND_CODE}, virtualenv#state('virtualenv_internal'))" \
-c "call assert_equal('${VIM_VIRTUALENV_TARGET}', virtualenv#state('virtualenv_directory'))" \
Expand Down