Skip to content

Commit

Permalink
Merge #526 ci: run tests on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk authored Jul 14, 2023
2 parents dd540b0 + 8a2a3b8 commit 19127b2
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 68 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: test
on:
push:
pull_request:
branches:
- 'master'

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.repository_owner == 'neovim' && github.sha || github.ref_name }}
cancel-in-progress: true

env:
PYTEST_ADDOPTS: '-vv'

jobs:
test:
strategy:
fail-fast: false
matrix:
node: ['3.11', '3.12']
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
include:
- os: ubuntu-latest
NIGHTLY: nvim-linux64.tar.gz
NVIM_BIN_PATH: nvim-linux64/bin
EXTRACT: tar xzf
- os: macos-latest
NIGHTLY: nvim-macos.tar.gz
NVIM_BIN_PATH: nvim-macos/bin
EXTRACT: tar xzf
- os: windows-latest
NIGHTLY: nvim-win64.zip
NVIM_BIN_PATH: nvim-win64/bin
EXTRACT: unzip

runs-on: ${{ matrix.os }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
cache: 'pip'
python-version: ${{ matrix.python }}

- name: install neovim
run: |
curl -LO 'https://github.com/neovim/neovim/releases/download/nightly/${{ matrix.NIGHTLY }}'
${{ matrix.EXTRACT }} ${{ matrix.NIGHTLY }}
echo '${{ runner.os }}'
- name: update path (bash)
if: runner.os != 'Windows'
run: echo "$(pwd)/${{ matrix.NVIM_BIN_PATH }}" >> $GITHUB_PATH

- name: update path (windows)
if: runner.os == 'Windows'
run: echo "$(pwd)/${{ matrix.NVIM_BIN_PATH }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: install dependencies
run: |
pip3 install . # Install from setup.py
pip3 install -q pytest
- name: test
run: |
echo $PATH
which nvim
nvim --version
python3 -m pytest
- uses: codecov/codecov-action@v3
if: runner.os == 'macOS'
with:
verbose: true # optional (default = false)

# TODO: tox, codecov steps from old travis workflow
#
# env: CI_TARGET=checkqa TOXENV=checkqa,docs
# script:
# - tox
# after_script:
# - if [ $CI_TARGET = tests ]; then
# set -x;
# pip3 install coverage;
# coverage combine;
# coverage report -m;
# coverage xml;
# bash <(curl --retry 5 --silent --fail https://codecov.io/bash) -f coverage.xml;
# set +x;
# fi
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Pynvim: Python client to [Neovim](https://github.com/neovim/neovim)
===================================================================

[![Build Status](https://travis-ci.org/neovim/pynvim.svg?branch=master)](https://travis-ci.org/neovim/pynvim)
[![Documentation Status](https://readthedocs.org/projects/pynvim/badge/?version=latest)](https://pynvim.readthedocs.io/en/latest/?badge=latest)
[![Code coverage](https://codecov.io/gh/neovim/pynvim/branch/master/graph/badge.svg)](https://codecov.io/gh/neovim/pynvim)

Expand All @@ -11,29 +10,19 @@ connecting to and scripting Nvim processes through its msgpack-rpc API.
Install
-------

Supports python 2.7, and 3.4 or later.
Supports python 3.10 or later.

```sh
pip2 install pynvim
pip3 install pynvim
```

If you only use one of python2 or python3, it is enough to install that
version. You can install the package without being root by adding the `--user`
flag.
pip3 install pynvim

You can install the package without being root by adding the `--user` flag.
Anytime you upgrade Neovim, make sure to upgrade pynvim as well:
```sh
pip2 install --upgrade pynvim
pip3 install --upgrade pynvim
```

Alternatively, the master version could be installed by executing the following
in the root of this repository:
```sh
pip2 install .
pip3 install .
```
pip3 install --upgrade pynvim

Alternatively, you can install the development version by cloning this
repository and executing the following at the top level:

pip3 install .

Python Plugin API
-----------------
Expand Down Expand Up @@ -61,8 +50,8 @@ Development

Use (and activate) a local virtualenv.

python3 -m venv env36
source env36/bin/activate
python3 -m virtualenv venv
source venv/bin/activate

If you change the code, you must reinstall for the changes to take effect:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

setup(name='pynvim',
version='0.4.3',
description='Python client to neovim',
description='Python client for Neovim',
url='http://github.com/neovim/pynvim',
download_url='https://github.com/neovim/pynvim/archive/0.4.3.tar.gz',
author='Thiago de Arruda',
Expand Down
2 changes: 1 addition & 1 deletion test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_options(vim):
vim.current.buffer.options['define'] = 'test'
assert vim.current.buffer.options['define'] == 'test'
# Doesn't change the global value
assert vim.options['define'] == r'^\s*#\s*define'
assert vim.options['define'] == ''

with pytest.raises(KeyError) as excinfo:
vim.current.buffer.options['doesnotexist']
Expand Down
7 changes: 4 additions & 3 deletions test/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def test_host_async_error(vim):
assert 'rplugin-host: Async request caused an error:\nboom\n' \
in h._on_error_event(None, 'boom')


def test_legacy_vim_eval(vim):
h = ScriptHost(vim)
assert h.legacy_vim.eval('1') == '1'
assert h.legacy_vim.eval('v:null') == None
assert h.legacy_vim.eval('v:true') == True
assert h.legacy_vim.eval('v:false') == False
assert h.legacy_vim.eval('v:null') is None
assert h.legacy_vim.eval('v:true') is True
assert h.legacy_vim.eval('v:false') is False
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{27,34,35,36,37,38}-{asyncio,pyuv}-cov,pypy-cov
py{310,311}-{asyncio,pyuv}-cov,pypy-cov
checkqa

[testenv]
Expand Down

0 comments on commit 19127b2

Please sign in to comment.