|
| 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 |
0 commit comments