Skip to content

Commit

Permalink
Migrate CI to GHA, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
rdipardo committed Dec 28, 2020
1 parent 73bf9d7 commit 2ce0c21
Show file tree
Hide file tree
Showing 23 changed files with 359 additions and 78 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "00:00"
timezone: "America/Toronto"
commit-message:
prefix: gh-actions
Binary file removed .github/img/nvim_043_ver_031.gif
Binary file not shown.
Binary file added .github/img/vim_821860.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: (Neo)vim
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Restore cache
uses: actions/cache@v2
with:
path: '~/.cache/pip'
key: ${{ runner.os }}-pip-${{ hashFiles('.vintrc.yml') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install
run: |
pip install --upgrade pip
pip install vim-vint
- name: Lint
run: vint autoload plugin -wt
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04]
vim-version: [stable]
nvim-version: [nightly]
python-version: ['2.7', '3.6', '3.7', '3.8', '3.9']
include:
- python-version: '3.4.10'
os: [ubuntu-18.04]
- python-version: '3.5'
# don't clobber standard issue python on 16.04
os: [ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install latest pip
if: ${{ !(startsWith(matrix.python-version, '2.7') || startsWith(matrix.python-version, '3.4') || startsWith(matrix.python-version, '3.5')) }}
run: |
pip install --upgrade pip
- name: Install pip < 21.0
if: ${{ (startsWith(matrix.python-version, '2.7') || startsWith(matrix.python-version, '3.5')) }}
run: |
pip install --upgrade 'pip < 21.0'
- name: Install pip < 19.2
if: ${{ startsWith(matrix.python-version, '3.4') }}
run: |
pip install --upgrade 'pip < 19.2'
- name: Restore pip cache
uses: actions/cache@v2
with:
path: '~/.cache/pip'
key: ${{ matrix.python-version }}-pip-${{ hashFiles('**/test/requirements.txt') }}
restore-keys: ${{ matrix.python-version }}-pip-

- name: Install python modules
run: pip install -r test/requirements.txt

- name: Set up plugin test environment
uses: actions/checkout@v2
with:
repository: junegunn/vader.vim
path: vader.vim
fetch-depth: 1

- name: Install vim
uses: rhysd/action-setup-vim@v1
id: vim
with:
version: ${{ matrix.vim-version }}

- name: Install neovim
uses: rhysd/action-setup-vim@v1
id: neovim
with:
neovim: true
version: ${{ matrix.nvim-version }}

- name: Run python tests
run: pytest -v

- name: Test plugin on vim
run: |
"${{ steps.vim.outputs.executable }}" --startuptime vim_bench.log -ENsu test/vimrc -c '+Vader! test/vader/*' > /dev/null
- name: Test plugin on neovim
run: |
"${{ steps.neovim.outputs.executable }}" --startuptime nvim_bench.log -ENsu test/vimrc -c '+Vader! test/vader/*' > /dev/null
- name: Check startup times
run: |
head -n 10 nvim*.log > BENCH.log
awk '/.*\/cpywrite\.vim.*$/{print $2 " " $3 " " $5}' nvim_* | sort >> BENCH.log
head -n 10 vim*.log >> BENCH.log
awk '/.*\/cpywrite\.vim.*$/{print $2 " " $3 " " $5}' vim_* | sort >> BENCH.log
- name: Save startup times
uses: actions/upload-artifact@v2
with:
name: plugin-load-stats
path: '**/BENCH.log'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
*.log
/__pycache__/
.pytest_cache/
vader.vim/
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
branches:
except:
- master
- pre-release
- gh-actions

dist: xenial

language: python
Expand All @@ -10,6 +16,10 @@ python:
- 3.7
- 3.8

jobs:
allow_failures:
- python: 3.8

before_install:
- sudo apt-get -y install vim
- pip install --upgrade pip
Expand Down
5 changes: 5 additions & 0 deletions .vintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmdargs:
color: true
policies:
ProhibitAbbreviationOption:
enabled: false
28 changes: 28 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ CHANGELOG
:depth: 1
:backlinks: top

0.3.2
======
**(2020-12-28)**

Fixed
-----
- replace double-quotes with single-quotes when filetypes use ``"`` as their
comment delimiter (i.e. VimL, Smalltalk)
- (temporarily) avoid requesting defective copies of the full `Unlicense`_ and
`BSD-1-Clause`_
- minor pruning of some unreachable code (overlooked in `last release`_)

.. _last release: https://github.com/rdipardo/vim-cpywrite/releases/tag/v0.3.1

Added
-----
- match the ``.mkd`` extension with Markdown files
- support for these file types:

+ Eiffel
+ PureScript
+ R
+ ReasonML
+ Smalltalk
+ Vala

0.3.1
======
**(2020-10-26)**
Expand Down Expand Up @@ -138,5 +164,7 @@ Added

.. _`#2`: https://github.com/rdipardo/vim-cpywrite/pull/2
.. _cached: https://github.com/rdipardo/vim-cpywrite/blob/7661fb2a6d1cf81b949f2ec9854c9598c04fac4a/rplugin/pythonx/cpywrite/spdx/license.py#L55
.. _Unlicense: https://github.com/spdx/license-list-data/blob/2e20899c0504ff6c0acfcc1b0994d7163ce46939/text/Unlicense.txt#L10
.. _BSD-1-Clause: https://github.com/spdx/license-list-data/blob/2e20899c0504ff6c0acfcc1b0994d7163ce46939/text/BSD-1-Clause.txt#L9

.. vim:ft=rst:et:tw=78:
21 changes: 10 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
vim-cpywrite
############

|travis-badge|
|gh-actions| |current version|

Generate copyright headers for any open source license

.. figure:: .github/img/nvim_043_ver_031.gif
.. figure:: .github/img/vim_821860.gif
:alt: nvim-043-linux-demo
:align: center
:width: 800
:width: 900

----

Expand Down Expand Up @@ -119,8 +119,6 @@ Requirements
.. _pynvim: https://github.com/neovim/pynvim
.. _requests: https://pypi.org/project/requests

.. _installation guide:

Installation
============

Expand Down Expand Up @@ -218,7 +216,7 @@ TODO
Improve this README
-------------------

Consider opening a PR with an updated `installation guide`_ if any of the
Consider opening a PR with an updated `installation guide <#installation>`_ if any of the
following applies to you:

* installation fails
Expand All @@ -227,14 +225,15 @@ following applies to you:
License
=======

Distributed under the terms of the MIT license
Distributed under the terms of the MIT license.

.. |travis-badge| image:: https://travis-ci.com/rdipardo/vim-cpywrite.svg?branch=master
.. |gh-actions| image:: https://github.com/rdipardo/vim-cpywrite/workflows/(Neo)vim/badge.svg?branch=master
:alt: Build Status
:scale: 100%
:target: https://travis-ci.com/rdipardo/vim-cpywrite
:target: https://github.com/rdipardo/vim-cpywrite/actions
.. |current version| image:: https://img.shields.io/github/v/release/rdipardo/vim-cpywrite?logo=vim
:alt: Vim Scripts version

.. _supported programming languages: https://github.com/rdipardo/vim-cpywrite/blob/7661fb2a6d1cf81b949f2ec9854c9598c04fac4a/rplugin/pythonx/cpywrite/generator.py#L270
.. _supported programming languages: https://github.com/rdipardo/vim-cpywrite/blob/324af8c1dbfd728ef2cff4f37f1623cc5a48c7f8/rplugin/pythonx/cpywrite/generator.py#L274
.. _vim-pathogen: https://github.com/tpope/vim-pathogen#native-vim-package-management
.. _native package directory: https://github.com/vim/vim/blob/03c3bd9fd094c1aede2e8fe3ad8fd25b9f033053/runtime/doc/repeat.txt#L515
.. _DIY plugin management: https://shapeshed.com/vim-packages
Expand Down
2 changes: 1 addition & 1 deletion autoload/cpywrite.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ func! cpywrite#PrependHeader(...) abort
endif
endfunc

func! cpywrite#GetInterpreter()
func! cpywrite#GetInterpreter() abort
return exists('s:cpywrite_python_cmd') ? s:cpywrite_python_cmd : ''
endfunc
2 changes: 1 addition & 1 deletion autoload/cpywrite/error.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if get(g:, 'autoloaded_cpywrite_error') | finish | endif
let g:autoloaded_cpywrite_error = 1

func! cpywrite#error#NoPython()
func! cpywrite#error#NoPython() abort
if has ('nvim')
call health#report_error(
\'Your editor is missing a python provider!',
Expand Down
4 changes: 2 additions & 2 deletions autoload/cpywrite/licenses.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
if get(g:, 'autoloaded_cpywrite_licenses') | finish | endif
let g:autoloaded_cpywrite_licenses = 1

func! cpywrite#licenses#SetDefaultLicense(...)
func! cpywrite#licenses#SetDefaultLicense(...) abort
if !empty(get(a:, 1, ''))
exe 'let g:cpywrite#default_license = ' . string(a:1)
endif

exe 'echo g:cpywrite#default_license'
endfunc

func! cpywrite#licenses#GetLicenseList(a,l,p)
func! cpywrite#licenses#GetLicenseList(a,l,p) abort
let l:loader = cpywrite#GetInterpreter()
let s:license_list = []

Expand Down
2 changes: 1 addition & 1 deletion plugin/cpywrite.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if get(g:, 'loaded_cpywrite') | finish | endif
let g:loaded_cpywrite = 1

let g:cpywrite#version = '0.3.1'
let g:cpywrite#version = '0.3.2'

if empty(get(g:, 'cpywrite#default_license', ''))
let g:cpywrite#default_license = 'GPL-3.0-or-later'
Expand Down
2 changes: 1 addition & 1 deletion rplugin/pythonx/cpywrite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
~~~~~~~~~
"""

__version__ = '0.3.1'
__version__ = '0.3.2'
__authors__ = ['Robert Di Pardo']
__url__ = 'https://github.com/rdipardo/vim-cpywrite'
__license__ = 'MIT'
Expand Down
Loading

0 comments on commit 2ce0c21

Please sign in to comment.