Skip to content

Commit

Permalink
Merge pull request #701 from tsuyoshicho/feature/ghaction
Browse files Browse the repository at this point in the history
feat: vital.vim work under GitHub workflow
  • Loading branch information
thinca authored Jul 26, 2021
2 parents 46c280c + e2e89a2 commit b199fbe
Show file tree
Hide file tree
Showing 22 changed files with 434 additions and 348 deletions.
38 changes: 0 additions & 38 deletions .appveyor.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/actions/vital-throw-message/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.13

ENV REVIEWDOG_VERSION=v0.13.0

RUN curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${REVIEWDOG_VERSION}

ADD scripts/ /scripts/

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
26 changes: 26 additions & 0 deletions .github/actions/vital-throw-message/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Run vimlint with reviewdog'
description: 'Run vim error throw with reviewdog on pull requests.'
author: 'Tsuyoshi CHO <[email protected]>'
inputs:
github_token:
description: 'GITHUB_TOKEN.'
required: true
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: |
Reporter of reviewdog command [github-pr-check,github-pr-review].
Default is github-pr-check.
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
default: 'github-pr-check'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.github_token }}
- ${{ inputs.level }}
- ${{ inputs.reporter }}
branding:
icon: 'chevron-down'
color: 'green'
13 changes: 13 additions & 0 deletions .github/actions/vital-throw-message/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

cd "$GITHUB_WORKSPACE"

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

go get -d -v ./scripts

go run ./scripts/lint-throw.go $(find autoload/vital/__vital__/ | grep -e '\.vim$') \
| reviewdog -efm="%f:%l:%c: %m" -name="vital-throw-message" \
-reporter="${INPUT_REPORTER:-'github-pr-check'}" \
-level="${INPUT_LEVEL}"

File renamed without changes.
192 changes: 192 additions & 0 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: "build and test at vim"
on: [push, pull_request]
env:
THEMIS_VERSION: v1.5.5
LUA_VERSION: 5.3.5
jobs:
unixlike:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
vim: [v8.1.0005, v8.2.0020, head]
type: [vim, macvim]
download: [available]
# Linux vim 8.1 build only, action-setup-vim 1.0.1 or after auto switch
exclude:
- os: ubuntu-latest
# linux only vim/ macvim run as mac os
type: macvim
- os: macos-latest
type: macvim
# macvim only head
vim: v8.1.0005
- os: macos-latest
type: macvim
# macvim only head
vim: v8.2.0020
runs-on: ${{ matrix.os }}
name: ${{ matrix.type }} ${{ matrix.vim }}/${{ matrix.os }} test
env:
OS: ${{ matrix.os }}
VIMVER: ${{ matrix.type }}-${{ matrix.vim }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup apt
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
- name: Setup lua
if: matrix.type == 'macvim'
run: |
brew update
brew install lua
- name: Setup pip
run: |
sudo pip3 install -U pip
- name: Get pip cache
id: pip-cache
run: |
python3 -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: Set pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Setup cached item
run: |
pip3 install --user -r requirements.txt
- name: Setup Vim
id: 'vim'
uses: thinca/action-setup-vim@v1
with:
vim_version: '${{ matrix.vim }}'
vim_type: '${{ matrix.type }}'
download: '${{ matrix.vim_download || matrix.download }}'
- name: Setup MacVim
if: matrix.type == 'macvim'
run: |
echo "set luadll=$(brew --prefix lua)/lib/liblua.dylib" > ${GITHUB_WORKSPACE}/.themisrc
- name: Run test
env:
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
run: |
git clone --depth 1 --branch ${THEMIS_VERSION} --single-branch https://github.com/thinca/vim-themis ${GITHUB_WORKSPACE}/vim-themis
git clone --depth 1 https://github.com/Shougo/vimproc.vim ${GITHUB_WORKSPACE}/vimproc
(cd ${GITHUB_WORKSPACE}/vimproc && make)
${THEMIS_VIM} --version
${GITHUB_WORKSPACE}/vim-themis/bin/themis --runtimepath ${GITHUB_WORKSPACE}/vimproc --exclude ConcurrentProcess --reporter dot
- name: Collect coverage
env:
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
run: |
export PATH=$(python3 -m site --user-base)/bin:${PATH}
covimerage write_coverage "${THEMIS_PROFILE}"
coverage xml
- name: Send coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
env_vars: OS,VIMVER
windows:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
vim: [v8.1.0005, v8.2.0020, head]
type: [vim]
download: [available]
runs-on: ${{ matrix.os }}
name: ${{ matrix.type }} ${{ matrix.vim }}/${{ matrix.os }} test
env:
OS: ${{ matrix.os }}
VIMVER: ${{ matrix.type }}-${{ matrix.vim }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Determining the library file
id: files
shell: pwsh
run: |
$lua_url = 'https://sourceforge.net/projects/luabinaries/files/' + ${Env:LUA_VERSION} + '/Windows%20Libraries/Dynamic/lua-' + ${Env:LUA_VERSION} + '_Win64_dllw6_lib.zip/download'
Write-Host "::set-output name=url::$($lua_url)"
Write-Output $lua_url | Out-File url.txt
$dir = ${Env:GITHUB_WORKSPACE} + '\lib'
New-Item $dir -ItemType Directory
Write-Host "::set-output name=dir::$($dir)"
- name: Set files cache
uses: actions/cache@v2
with:
path: ${{ steps.files.outputs.dir }}
key: ${{ runner.os }}-64-files-${{ hashFiles('**/url.txt') }}
restore-keys: |
${{ runner.os }}-64-files-
- name: Setup lua
shell: pwsh
run: |
$lua = ${Env:GITHUB_WORKSPACE} + '\lua\'
$zip = '${{ steps.files.outputs.dir }}\lua-lib.zip'
if (Test-Path $zip) {
Write-Host cache hit
} else {
(New-Object Net.WebClient).DownloadFile('${{ steps.files.outputs.url }}', $zip)
}
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $lua)
Write-Output "$($lua)" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup pip
id: setup
run: |
python -m pip install --upgrade pip
- name: Get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: Set pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Setup Vim
id: 'vim'
uses: thinca/action-setup-vim@v1
with:
vim_version: '${{ matrix.vim }}'
vim_type: '${{ matrix.type }}'
download: '${{ matrix.vim_download || matrix.download }}'
- name: Build
shell: pwsh
run: |
git -c advice.detachedHead=false clone https://github.com/thinca/vim-themis --quiet --branch ${Env:THEMIS_VERSION} --single-branch --depth 1 ${Env:GITHUB_WORKSPACE}\vim-themis
git -c advice.detachedHead=false clone https://github.com/Shougo/vimproc.vim --quiet --branch ver.9.2 --single-branch --depth 1 ${Env:GITHUB_WORKSPACE}\vimproc
Invoke-WebRequest -Uri "https://github.com/Shougo/vimproc.vim/releases/download/ver.9.2/vimproc_win64.dll" -OutFile "${Env:GITHUB_WORKSPACE}\vimproc\lib\vimproc_win64.dll"
- name: Run test
env:
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
shell: cmd
run: |
set TEMP=%GITHUB_WORKSPACE%\tmp
set TMP=%TEMP%
mkdir %TEMP%
%THEMIS_VIM% --version
%GITHUB_WORKSPACE%\vim-themis\bin\themis.bat --runtimepath %GITHUB_WORKSPACE%\vimproc --exclude ConcurrentProcess --reporter dot
- name: Collect coverage
env:
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
shell: pwsh
run: |
pip install -r requirements.txt
covimerage write_coverage ${Env:THEMIS_PROFILE}
coverage xml
- name: Send coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
env_vars: OS,VIMVER
66 changes: 66 additions & 0 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: depup
on:
schedule:
- cron: '35 9 2,13,25 * *' # Runs at 9:35 UTC 2,13,25 per month
repository_dispatch:
types: [depup]
workflow_dispatch:

jobs:
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Check depup
uses: haya14busa/action-depup@v1
id: depup
with:
file: .github/actions/vital-throw-message/Dockerfile
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
commit-message: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
body: |
Update ${{ steps.depup.outputs.repo }} to [${{ steps.depup.outputs.latest }}](https://github.com/${{ steps.depup.outputs.repo }}/releases/tag/v${{ steps.depup.outputs.latest }})
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
branch: depup/${{ steps.depup.outputs.repo }}

themis:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Check depup
uses: haya14busa/action-depup@v1
id: depup
with:
file: .github/workflows/buildtest.yml
version_name: THEMIS_VERSION
repo: thinca/vim-themis
tag: true

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
commit-message: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
body: |
Update ${{ steps.depup.outputs.repo }} to [${{ steps.depup.outputs.latest }}](https://github.com/${{ steps.depup.outputs.repo }}/releases/tag/v${{ steps.depup.outputs.latest }})
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
branch: depup/${{ steps.depup.outputs.repo }}

Loading

0 comments on commit b199fbe

Please sign in to comment.