Skip to content

Commit

Permalink
feat(ci): first try to support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Oct 28, 2020
1 parent 57d84cc commit 709b6c6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: npm run build:binary -- node${{ matrix.node-version }}-${{ matrix.target }}-x64 vim-doge-${{ matrix.target }}
- name: Build Windows binary
if: matrix.target == 'win'
run: npm run build:binary:windows -- node${{ matrix.node-version }}-${{ matrix.target }}-x64 vim-doge-${{ matrix.target }}
run: npm run build:binary:windows -- node${{ matrix.node-version }}-${{ matrix.target }}-x64 vim-doge-${{ matrix.target }}64
- name: Get release
id: get_release
uses: bruceadams/[email protected]
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ jobs:
name: Vim
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
vim-version: [v7.4.2119, head]
node-version: [10, 12, 14]
include:
- os: macos-latest
target: macos
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
runs-on: ${{ matrix.os }}
steps:
- name: Checkout kkoomen/vim-doge
Expand All @@ -36,8 +38,12 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- name: Build binary
- name: Build Unix binary
if: matrix.target != 'win'
run: npm run build:binary -- node${{ matrix.node-version }}-${{ matrix.target }}-x64
- name: Build Windows binary
if: matrix.target == 'win'
run: npm run build:binary:windows -- node${{ matrix.node-version }}-${{ matrix.target }}-x64
- name: Setup vim
uses: thinca/action-setup-vim@v1
id: vim
Expand All @@ -46,19 +52,22 @@ jobs:
vim_type: vim
- name: Run tests
run: ./scripts/run-vader-tests.sh "${{ steps.vim.outputs.executable }}"
shell: bash

tests_neovim:
name: NeoVim
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
vim-version: [v0.3.2, head]
node-version: [10, 12, 14]
include:
- os: macos-latest
target: macos
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
runs-on: ${{ matrix.os }}
steps:
- name: Checkout kkoomen/vim-doge
Expand All @@ -75,8 +84,12 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- name: Build binary
- name: Build Unix binary
if: matrix.target != 'win'
run: npm run build:binary -- node${{ matrix.node-version }}-${{ matrix.target }}-x64
- name: Build Windows binary
if: matrix.target == 'win'
run: npm run build:binary:windows -- node${{ matrix.node-version }}-${{ matrix.target }}-x64
- name: Setup neovim
uses: thinca/action-setup-vim@v1
id: vim
Expand All @@ -85,6 +98,7 @@ jobs:
vim_type: neovim
- name: Run tests
run: ./scripts/run-vader-tests.sh "${{ steps.vim.outputs.executable }}"
shell: bash

vint:
name: Linter
Expand Down
19 changes: 3 additions & 16 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
param([String] $buildTarget, [String] $outFile)
Write-Host "buildTarget: $buildTarget"
Write-Host "outFile: $outFile"
$rootDir = Resolve-Path -Path ((Split-Path $myInvocation.MyCommand.Path) + "\..")
# $winVersion = switch ([IntPtr]::Size -eq 4) {
# $true {"32"}
# $false {"64"}
# }
$winVersion = "64"
$assetName = "vim-doge-win$winVersion.zip"
$assetPath = "$rootDir\bin\$assetName"

# Build the pkg lib prerequisites if needed.
if (!(Test-Path "$rootDir\pkg\lib-es5")) {
cd $rootDir\pkg
npm install --no-save; if ($?) {npm run prepare}
}

# Build the binary.
cd $rootDir
node "$rootDir\pkg\lib-es5\bin.js" . -t "$buildTarget" --out-path "$rootDir\bin"

Write-Host "--------- vim-doge.exe ---------"
Write-Host (Get-ChildItem -Path "$rootDir" -Filter "vim-doge.exe" -Recurse -ErrorAction SilentlyContinue -Force | %{$_.FullName})
Write-Host (Get-ChildItem -Path "$rootDir" -Filter "vim-doge" -Recurse -ErrorAction SilentlyContinue -Force | %{$_.FullName})
Write-Host "--------- vim-doge.exe ---------"
# Build the binary.
node "$rootDir\pkg\lib-es5\bin.js" . -t "$buildTarget" --out-path "$rootDir\bin"

# Archive the binary.
if ($outFile -ne "") {
$outFile = "$rootDir\bin\$outFile$winVersion.zip"
$outFile = "$rootDir\bin\$outFile.zip"
rm $rootDir\bin\*.zip
echo "==> Archiving $rootDir\bin\vim-doge.exe -> $outFile"
7z a -tzip "$outFile" "$rootDir\bin\vim-doge.exe"
Expand Down
6 changes: 1 addition & 5 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
$rootDir = Resolve-Path -Path ((Split-Path $myInvocation.MyCommand.Path) + "\..")
$version = Get-Content "$rootDir\.version"
$winVersion = switch ([IntPtr]::Size -eq 4) {
$true {"32"}
$false {"64"}
}
$assetName = "vim-doge-win$winVersion.zip"
$assetName = "vim-doge-win64.zip"
$assetPath = "$rootDir\bin\$assetName"
$outFile = "$rootDir\bin\vim-doge.exe"

Expand Down

0 comments on commit 709b6c6

Please sign in to comment.