Merge pull request #818 from vim-jp/dependabot/github_actions/codecov… #220
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: "build and test at vim" | |
on: [push, pull_request] | |
env: | |
LUA_VERSION: 5.3.5 | |
VIMPROC_VERSION: ver.10.0 | |
jobs: | |
unixlike: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
vim: [v8.2.0020, v9.0.0107, head] | |
type: [vim, macvim] | |
download: [available] | |
exclude: | |
- os: ubuntu-latest | |
# linux only vim/ macvim run as mac os | |
type: macvim | |
- os: macos-latest | |
type: vim | |
# v8.2.1310 or later is required to build on macos-latest | |
vim: v8.2.0020 | |
- os: macos-latest | |
type: macvim | |
# macvim only head | |
vim: v8.2.0020 | |
- os: macos-latest | |
type: macvim | |
# macvim only head | |
vim: v9.0.0107 | |
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@v4 | |
- name: Setup env | |
run: | | |
cat ENVFILE >> $GITHUB_ENV | |
- name: Setup apt | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
- name: Setup lua | |
if: matrix.type == 'macvim' | |
run: | | |
brew upgrade | |
brew install lua | |
- name: Setup pip | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
sudo pip3 install -U pip --break-system-packages | |
else | |
sudo pip3 install -U pip | |
fi | |
- name: Get pip cache | |
id: pip-cache | |
run: | | |
python3 -c "from pip._internal.locations import USER_CACHE_DIR; print('dir=' + USER_CACHE_DIR)" >> $GITHUB_OUTPUT | |
- name: Set pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Setup cached item | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
pip3 install --user -r requirements.txt --break-system-packages | |
else | |
pip3 install --user -r requirements.txt | |
fi | |
- 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: Setup vim-themis | |
uses: actions/checkout@v4 | |
with: | |
repository: thinca/vim-themis | |
ref: ${{ env.THEMIS_VERSION }} | |
path: ${{ github.workspace }}/vim-themis | |
- name: Setup vimproc | |
uses: actions/checkout@v4 | |
with: | |
repository: Shougo/vimproc.vim | |
path: ${{ github.workspace }}/vimproc | |
- name: Build vimproc | |
run: | | |
make -C ${GITHUB_WORKSPACE}/vimproc | |
- name: Run test | |
env: | |
THEMIS_VIM: ${{ steps.vim.outputs.executable }} | |
THEMIS_PROFILE: ${{ github.workspace }}/vim-profile-${{ runner.os }}-${{ matrix.vim }}-${{ matrix.type }}.txt | |
run: | | |
${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@v4 | |
with: | |
file: ./coverage.xml | |
env_vars: OS,VIMVER | |
windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
vim: [v8.2.0020, v9.0.0107, 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: Setup git | |
shell: bash | |
run: | | |
git config --global core.autocrlf input | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup env | |
shell: bash | |
run: | | |
cat ENVFILE >> $GITHUB_ENV | |
- 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' | |
"url=$($lua_url)" >> ${Env:GITHUB_OUTPUT} | |
Write-Output $lua_url | Out-File url.txt | |
$dir = ${Env:GITHUB_WORKSPACE} + '\lib' | |
New-Item $dir -ItemType Directory | |
"dir=$($dir)" >> ${Env:GITHUB_OUTPUT} | |
- name: Set files cache | |
uses: actions/cache@v3 | |
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: | | |
python3 -c "from pip._internal.locations import USER_CACHE_DIR; print('dir=' + USER_CACHE_DIR)" >> ${Env:GITHUB_OUTPUT} | |
- name: Set pip cache | |
uses: actions/cache@v3 | |
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: Setup vim-themis | |
uses: actions/checkout@v4 | |
with: | |
repository: thinca/vim-themis | |
ref: ${{ env.THEMIS_VERSION }} | |
path: ${{ github.workspace }}/vim-themis | |
- name: Setup vimproc | |
uses: actions/checkout@v4 | |
with: | |
repository: Shougo/vimproc.vim | |
ref: ${{ env.VIMPROC_VERSION }} | |
path: ${{ github.workspace }}/vimproc | |
- name: Fetch vimproc dll | |
shell: pwsh | |
run: | | |
Invoke-WebRequest -Uri "https://github.com/Shougo/vimproc.vim/releases/download/${Env:VIMPROC_VERSION}/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@v4 | |
with: | |
file: ./coverage.xml | |
env_vars: OS,VIMVER |