Skip to content

Commit b199fbe

Browse files
authored
Merge pull request #701 from tsuyoshicho/feature/ghaction
feat: vital.vim work under GitHub workflow
2 parents 46c280c + e2e89a2 commit b199fbe

22 files changed

+434
-348
lines changed

.appveyor.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.13
2+
3+
ENV REVIEWDOG_VERSION=v0.13.0
4+
5+
RUN curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${REVIEWDOG_VERSION}
6+
7+
ADD scripts/ /scripts/
8+
9+
COPY entrypoint.sh /entrypoint.sh
10+
11+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Run vimlint with reviewdog'
2+
description: 'Run vim error throw with reviewdog on pull requests.'
3+
author: 'Tsuyoshi CHO <[email protected]>'
4+
inputs:
5+
github_token:
6+
description: 'GITHUB_TOKEN.'
7+
required: true
8+
level:
9+
description: 'Report level for reviewdog [info,warning,error]'
10+
default: 'error'
11+
reporter:
12+
description: |
13+
Reporter of reviewdog command [github-pr-check,github-pr-review].
14+
Default is github-pr-check.
15+
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
16+
default: 'github-pr-check'
17+
runs:
18+
using: 'docker'
19+
image: 'Dockerfile'
20+
args:
21+
- ${{ inputs.github_token }}
22+
- ${{ inputs.level }}
23+
- ${{ inputs.reporter }}
24+
branding:
25+
icon: 'chevron-down'
26+
color: 'green'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
cd "$GITHUB_WORKSPACE"
4+
5+
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
6+
7+
go get -d -v ./scripts
8+
9+
go run ./scripts/lint-throw.go $(find autoload/vital/__vital__/ | grep -e '\.vim$') \
10+
| reviewdog -efm="%f:%l:%c: %m" -name="vital-throw-message" \
11+
-reporter="${INPUT_REPORTER:-'github-pr-check'}" \
12+
-level="${INPUT_LEVEL}"
13+

.github/workflows/buildtest.yml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: "build and test at vim"
2+
on: [push, pull_request]
3+
env:
4+
THEMIS_VERSION: v1.5.5
5+
LUA_VERSION: 5.3.5
6+
jobs:
7+
unixlike:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest, macos-latest]
12+
vim: [v8.1.0005, v8.2.0020, head]
13+
type: [vim, macvim]
14+
download: [available]
15+
# Linux vim 8.1 build only, action-setup-vim 1.0.1 or after auto switch
16+
exclude:
17+
- os: ubuntu-latest
18+
# linux only vim/ macvim run as mac os
19+
type: macvim
20+
- os: macos-latest
21+
type: macvim
22+
# macvim only head
23+
vim: v8.1.0005
24+
- os: macos-latest
25+
type: macvim
26+
# macvim only head
27+
vim: v8.2.0020
28+
runs-on: ${{ matrix.os }}
29+
name: ${{ matrix.type }} ${{ matrix.vim }}/${{ matrix.os }} test
30+
env:
31+
OS: ${{ matrix.os }}
32+
VIMVER: ${{ matrix.type }}-${{ matrix.vim }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
- name: Setup apt
37+
if: matrix.os == 'ubuntu-latest'
38+
run: |
39+
sudo apt-get update
40+
- name: Setup lua
41+
if: matrix.type == 'macvim'
42+
run: |
43+
brew update
44+
brew install lua
45+
- name: Setup pip
46+
run: |
47+
sudo pip3 install -U pip
48+
- name: Get pip cache
49+
id: pip-cache
50+
run: |
51+
python3 -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
52+
- name: Set pip cache
53+
uses: actions/cache@v2
54+
with:
55+
path: ${{ steps.pip-cache.outputs.dir }}
56+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
57+
restore-keys: |
58+
${{ runner.os }}-pip-
59+
- name: Setup cached item
60+
run: |
61+
pip3 install --user -r requirements.txt
62+
- name: Setup Vim
63+
id: 'vim'
64+
uses: thinca/action-setup-vim@v1
65+
with:
66+
vim_version: '${{ matrix.vim }}'
67+
vim_type: '${{ matrix.type }}'
68+
download: '${{ matrix.vim_download || matrix.download }}'
69+
- name: Setup MacVim
70+
if: matrix.type == 'macvim'
71+
run: |
72+
echo "set luadll=$(brew --prefix lua)/lib/liblua.dylib" > ${GITHUB_WORKSPACE}/.themisrc
73+
- name: Run test
74+
env:
75+
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
76+
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
77+
run: |
78+
git clone --depth 1 --branch ${THEMIS_VERSION} --single-branch https://github.com/thinca/vim-themis ${GITHUB_WORKSPACE}/vim-themis
79+
git clone --depth 1 https://github.com/Shougo/vimproc.vim ${GITHUB_WORKSPACE}/vimproc
80+
(cd ${GITHUB_WORKSPACE}/vimproc && make)
81+
${THEMIS_VIM} --version
82+
${GITHUB_WORKSPACE}/vim-themis/bin/themis --runtimepath ${GITHUB_WORKSPACE}/vimproc --exclude ConcurrentProcess --reporter dot
83+
- name: Collect coverage
84+
env:
85+
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
86+
run: |
87+
export PATH=$(python3 -m site --user-base)/bin:${PATH}
88+
covimerage write_coverage "${THEMIS_PROFILE}"
89+
coverage xml
90+
- name: Send coverage
91+
uses: codecov/codecov-action@v2
92+
with:
93+
file: ./coverage.xml
94+
env_vars: OS,VIMVER
95+
windows:
96+
strategy:
97+
fail-fast: false
98+
matrix:
99+
os: [windows-latest]
100+
vim: [v8.1.0005, v8.2.0020, head]
101+
type: [vim]
102+
download: [available]
103+
runs-on: ${{ matrix.os }}
104+
name: ${{ matrix.type }} ${{ matrix.vim }}/${{ matrix.os }} test
105+
env:
106+
OS: ${{ matrix.os }}
107+
VIMVER: ${{ matrix.type }}-${{ matrix.vim }}
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@v2
111+
- name: Determining the library file
112+
id: files
113+
shell: pwsh
114+
run: |
115+
$lua_url = 'https://sourceforge.net/projects/luabinaries/files/' + ${Env:LUA_VERSION} + '/Windows%20Libraries/Dynamic/lua-' + ${Env:LUA_VERSION} + '_Win64_dllw6_lib.zip/download'
116+
Write-Host "::set-output name=url::$($lua_url)"
117+
Write-Output $lua_url | Out-File url.txt
118+
$dir = ${Env:GITHUB_WORKSPACE} + '\lib'
119+
New-Item $dir -ItemType Directory
120+
Write-Host "::set-output name=dir::$($dir)"
121+
- name: Set files cache
122+
uses: actions/cache@v2
123+
with:
124+
path: ${{ steps.files.outputs.dir }}
125+
key: ${{ runner.os }}-64-files-${{ hashFiles('**/url.txt') }}
126+
restore-keys: |
127+
${{ runner.os }}-64-files-
128+
- name: Setup lua
129+
shell: pwsh
130+
run: |
131+
$lua = ${Env:GITHUB_WORKSPACE} + '\lua\'
132+
$zip = '${{ steps.files.outputs.dir }}\lua-lib.zip'
133+
if (Test-Path $zip) {
134+
Write-Host cache hit
135+
} else {
136+
(New-Object Net.WebClient).DownloadFile('${{ steps.files.outputs.url }}', $zip)
137+
}
138+
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
139+
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $lua)
140+
Write-Output "$($lua)" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
141+
- name: Setup pip
142+
id: setup
143+
run: |
144+
python -m pip install --upgrade pip
145+
- name: Get pip cache
146+
id: pip-cache
147+
run: |
148+
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
149+
- name: Set pip cache
150+
uses: actions/cache@v2
151+
with:
152+
path: ${{ steps.pip-cache.outputs.dir }}
153+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
154+
restore-keys: |
155+
${{ runner.os }}-pip-
156+
- name: Setup Vim
157+
id: 'vim'
158+
uses: thinca/action-setup-vim@v1
159+
with:
160+
vim_version: '${{ matrix.vim }}'
161+
vim_type: '${{ matrix.type }}'
162+
download: '${{ matrix.vim_download || matrix.download }}'
163+
- name: Build
164+
shell: pwsh
165+
run: |
166+
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
167+
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
168+
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"
169+
- name: Run test
170+
env:
171+
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
172+
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
173+
shell: cmd
174+
run: |
175+
set TEMP=%GITHUB_WORKSPACE%\tmp
176+
set TMP=%TEMP%
177+
mkdir %TEMP%
178+
%THEMIS_VIM% --version
179+
%GITHUB_WORKSPACE%\vim-themis\bin\themis.bat --runtimepath %GITHUB_WORKSPACE%\vimproc --exclude ConcurrentProcess --reporter dot
180+
- name: Collect coverage
181+
env:
182+
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt
183+
shell: pwsh
184+
run: |
185+
pip install -r requirements.txt
186+
covimerage write_coverage ${Env:THEMIS_PROFILE}
187+
coverage xml
188+
- name: Send coverage
189+
uses: codecov/codecov-action@v2
190+
with:
191+
file: ./coverage.xml
192+
env_vars: OS,VIMVER

.github/workflows/depup.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: depup
2+
on:
3+
schedule:
4+
- cron: '35 9 2,13,25 * *' # Runs at 9:35 UTC 2,13,25 per month
5+
repository_dispatch:
6+
types: [depup]
7+
workflow_dispatch:
8+
9+
jobs:
10+
reviewdog:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
submodules: true
17+
18+
- name: Check depup
19+
uses: haya14busa/action-depup@v1
20+
id: depup
21+
with:
22+
file: .github/actions/vital-throw-message/Dockerfile
23+
version_name: REVIEWDOG_VERSION
24+
repo: reviewdog/reviewdog
25+
26+
- name: Create Pull Request
27+
uses: peter-evans/create-pull-request@v3
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
title: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
31+
commit-message: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
32+
body: |
33+
Update ${{ steps.depup.outputs.repo }} to [${{ steps.depup.outputs.latest }}](https://github.com/${{ steps.depup.outputs.repo }}/releases/tag/v${{ steps.depup.outputs.latest }})
34+
35+
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
36+
branch: depup/${{ steps.depup.outputs.repo }}
37+
38+
themis:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
with:
44+
submodules: true
45+
46+
- name: Check depup
47+
uses: haya14busa/action-depup@v1
48+
id: depup
49+
with:
50+
file: .github/workflows/buildtest.yml
51+
version_name: THEMIS_VERSION
52+
repo: thinca/vim-themis
53+
tag: true
54+
55+
- name: Create Pull Request
56+
uses: peter-evans/create-pull-request@v3
57+
with:
58+
token: ${{ secrets.GITHUB_TOKEN }}
59+
title: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
60+
commit-message: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}"
61+
body: |
62+
Update ${{ steps.depup.outputs.repo }} to [${{ steps.depup.outputs.latest }}](https://github.com/${{ steps.depup.outputs.repo }}/releases/tag/v${{ steps.depup.outputs.latest }})
63+
64+
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
65+
branch: depup/${{ steps.depup.outputs.repo }}
66+

0 commit comments

Comments
 (0)