|
| 1 | +name: Test virtualenv environments activation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + test: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout the repository |
| 13 | + uses: actions/checkout@v5 |
| 14 | + |
| 15 | + - name: Set up Python |
| 16 | + uses: actions/setup-python@v6 |
| 17 | + with: |
| 18 | + python-version: "3.12" # Vim on Ubuntu supports only 3.12 |
| 19 | + |
| 20 | + - name: Set up Vim |
| 21 | + run: | |
| 22 | + sudo apt-get update |
| 23 | + sudo apt-get install --yes vim |
| 24 | +
|
| 25 | + - name: Set up virtual environment |
| 26 | + run: | |
| 27 | + python -m pip install virtualenv |
| 28 | + export VIM_VIRTUALENV_TARGET="$(mktemp --directory)" |
| 29 | + python -m virtualenv "${VIM_VIRTUALENV_TARGET}" |
| 30 | + echo "VIM_VIRTUALENV_TARGET=${VIM_VIRTUALENV_TARGET}" >> "${GITHUB_ENV}" |
| 31 | +
|
| 32 | + - name: Test internal virtual environment |
| 33 | + run: | |
| 34 | + cd "${VIM_VIRTUALENV_TARGET}" |
| 35 | + vim --not-a-term -u "${GITHUB_WORKSPACE}/.github/workflows/vimrc.github" \ |
| 36 | + -c "call assert_equal(1, virtualenv#state('virtualenv_internal'))" \ |
| 37 | + -c "call assert_equal('virtualenv', virtualenv#state('virtualenv_type'))" \ |
| 38 | + -c "call assert_equal('${VIM_VIRTUALENV_TARGET}', virtualenv#state('virtualenv_directory'))" \ |
| 39 | + -c "call g:ExitTest()" |
| 40 | +
|
| 41 | + - name: Test external virtual environment |
| 42 | + run: | |
| 43 | + source "${VIM_VIRTUALENV_TARGET}/bin/activate" |
| 44 | + vim --not-a-term -u "${GITHUB_WORKSPACE}/.github/workflows/vimrc.github" \ |
| 45 | + -c "call assert_equal(0, virtualenv#state('virtualenv_internal'))" \ |
| 46 | + -c "call assert_equal('virtualenv', virtualenv#state('virtualenv_type'))" \ |
| 47 | + -c "call assert_equal('${VIM_VIRTUALENV_TARGET}', virtualenv#state('virtualenv_directory'))" \ |
| 48 | + -c "call g:ExitTest()" |
0 commit comments