ci: run yapf and isort to enforce code style #135
This file contains 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: "Run Tests" | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
unit-tests: | |
name: "Unit Tests" | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
include: | |
- python-version: "3.7" | |
os: ubuntu-22.04 | |
- python-version: "3.8" | |
os: ubuntu-latest | |
- python-version: "3.9" | |
os: ubuntu-latest | |
- python-version: "3.10" | |
os: ubuntu-latest | |
- python-version: "3.11" | |
os: ubuntu-latest | |
- python-version: "3.12-dev" | |
os: ubuntu-latest | |
neovim-version: nightly | |
PYNVIM_MASTER: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: | | |
python -m pip install -U pip | |
- name: Configure environments | |
run: | | |
python --version | |
- name: Enforce code style | |
run: | | |
pip install yapf isort | |
yapf --recursive --diff semshi/ test/ | |
isort --check-only --diff semshi/ test/ | |
if: ${{ matrix.python-version == '3.11' }} | |
- name: Setup neovim | |
run: | | |
sudo apt install libfuse2 | |
NVIM_VERSION="${{ matrix.neovim-version }}" | |
if [ -z "$NVIM_VERSION" ]; then | |
NVIM_VERSION="stable" | |
fi | |
NVIM_DOWNLOAD_URL="https://github.com/neovim/neovim/releases/download/${NVIM_VERSION}/nvim.appimage" | |
mkdir -p $HOME/.local/bin | |
wget -O $HOME/.local/bin/nvim $NVIM_DOWNLOAD_URL | |
chmod +x $HOME/.local/bin/nvim | |
if [ -n "${{ matrix.PYNVIM_MASTER }}" ]; then | |
pip install 'pynvim @ git+https://github.com/neovim/pynvim.git' | |
else | |
pip install pynvim | |
fi | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Check neovim version | |
run: | | |
nvim --version | |
- name: Install dependencies | |
run: | | |
pip install pytest codecov pytest-cov | |
- name: Run tests | |
run: | | |
pytest -v --cov semshi/ --cov-report term-missing:skip-covered --ignore test/test_fuzz.py test/ | |
- name: Test coverage | |
run: codecov | |