Enable testing with neovim #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | | |
| sudo apt-get update | |
| 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 }}" == "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") | |
| ${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()" |