Skip to content

Commit c9c38b9

Browse files
committed
Enable testing with neovim
Also fix bash conditionals, no clue why they even worked before.
1 parent 822c6b6 commit c9c38b9

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/test.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test virtual environment activation
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ "master" ]
66
pull_request:
77

88
jobs:
@@ -14,6 +14,7 @@ jobs:
1414
matrix:
1515
tool: [ "venv", "virtualenv" ]
1616
kind: [ "internal", "external" ]
17+
editor: [ "vim", "neovim" ]
1718

1819
steps:
1920
- name: Checkout the repository
@@ -28,25 +29,39 @@ jobs:
2829
run: |
2930
python -m pip install --upgrade virtualenv
3031
31-
- name: Set up Vim
32+
- name: Set up editor
3233
run: |
3334
sudo apt-get update
34-
sudo apt-get install --yes vim
35+
sudo apt-get install --yes ${{ matrix.editor }}
36+
if [[ "${{ matrix.editor }}" == "neovim" ]]; then
37+
# Make pynvim available to Python from setup-python
38+
python -m pip install --upgrade pynvim
39+
fi
3540
3641
- name: Create virtual environment
3742
run: |
3843
export VIM_VIRTUALENV_TARGET="$(mktemp --directory)"
3944
python -m ${{ matrix.tool }} "${VIM_VIRTUALENV_TARGET}"
4045
echo "VIM_VIRTUALENV_TARGET=${VIM_VIRTUALENV_TARGET}" >> "${GITHUB_ENV}"
4146
47+
- name: Set up virtual environment
48+
run: |
49+
if [[ "${{ matrix.editor }}" == "neovim" ]]; then
50+
# Make pynvim available to Python from virtualenv
51+
source "${VIM_VIRTUALENV_TARGET}/bin/activate"
52+
python -m pip install --upgrade pynvim
53+
deactivate
54+
fi
55+
4256
- name: Activate virtual environment
4357
run: |
44-
if [[ "${{ matrix.kind }}" -eq "internal" ]];
45-
then cd "${VIM_VIRTUALENV_TARGET}"; \
46-
else source "${VIM_VIRTUALENV_TARGET}/bin/activate"; \
58+
if [[ "${{ matrix.kind }}" == "internal" ]];
59+
then cd "${VIM_VIRTUALENV_TARGET}"
60+
else source "${VIM_VIRTUALENV_TARGET}/bin/activate"
4761
fi
48-
MATRIX_KIND_CODE=$([[ "${{ matrix.kind }}" -eq "internal" ]] && echo 1 || echo 0)
49-
vim --not-a-term -u "${GITHUB_WORKSPACE}/.github/workflows/vimrc.github" \
62+
MATRIX_KIND_CODE=$([[ "${{ matrix.kind }}" == "internal" ]] && echo 1 || echo 0)
63+
MATRIX_EDITOR_CMD=$([[ "${{ matrix.editor }}" == "vim" ]] && echo "vim --not-a-term" || echo "nvim --headless")
64+
${MATRIX_EDITOR_CMD} --clean -u "${GITHUB_WORKSPACE}/.github/workflows/vimrc.github" \
5065
-c "call assert_equal('${{ matrix.tool }}', virtualenv#state('virtualenv_type'))" \
5166
-c "call assert_equal(${MATRIX_KIND_CODE}, virtualenv#state('virtualenv_internal'))" \
5267
-c "call assert_equal('${VIM_VIRTUALENV_TARGET}', virtualenv#state('virtualenv_directory'))" \

0 commit comments

Comments
 (0)