Skip to content

Enable testing with neovim #19

Enable testing with neovim

Enable testing with neovim #19

Workflow file for this run

name: Test virtual environment activation
on:
push:
branches: [ master ]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tool: [ "venv", "virtualenv" ]
kind: [ "internal", "external" ]
editor: [ "vim", "neovim" ]
steps:
- name: Checkout the repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12" # Vim on Ubuntu supports only 3.12
- name: Set up tools
run: |
python -m pip install --upgrade virtualenv
- name: Set up editor
run: |
echo $USER
sudo apt-get update
sudo apt-get install --yes ${{ matrix.editor }}
if [[ "${{ matrix.editor }}" == "neovim" ]]; then
python -m pip install 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
source "${VIM_VIRTUALENV_TARGET}/bin/activate"
python -m pip install pynvim
deactivate
fi
- name: Activate virtual environment
run: |
if [[ "${{ matrix.kind }}" == "internal" ]];
then cd "${VIM_VIRTUALENV_TARGET}"
else source "${VIM_VIRTUALENV_TARGET}/bin/activate"
fi
MATRIX_KIND_CODE=$([[ "${{ matrix.kind }}" == "internal" ]] && echo 1 || echo 0)
MATRIX_EDITOR_CMD=$([[ "${{ matrix.editor }}" == "vim" ]] && echo "vim --not-a-term" || echo "nvim --headless")
echo ${PWD} ${VIRTUAL_ENV}
echo ${MATRIX_KIND_CODE} ${MATRIX_EDITOR_CMD}
nvim --headless --clean -c 'checkhealth | w!health.txt' -c 'q'
cat health.txt
${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'))" \
-c "call g:ExitTest()"