ci: remove ci/build.ps1 (#20891)

Main benefit is that this will return the correct exit code by default,
meaning the lengthy workarounds to properly fail a test aren't needed.
This commit is contained in:
dundargoc 2022-11-05 22:57:11 +01:00 committed by GitHub
parent 83ea9e23a2
commit 9a52a8e1ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 107 deletions

View File

@ -339,16 +339,41 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ env.DEPS_BUILD_DIR }}
key: windows-${{ hashFiles('cmake.deps/**', 'ci/build.ps1') }}
key: windows-${{ hashFiles('cmake.deps/**') }}
- name: Set env
run: ./.github/workflows/env.ps1
- name: Build deps
run: .\ci\build.ps1 -BuildDeps
run: |
cmake -S cmake.deps -B $env:DEPS_BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo'
cmake --build $env:DEPS_BUILD_DIR
- name: Build nvim
run: .\ci\build.ps1 -Build
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX"
cmake --build build
- name: Install test deps
run: .\ci\build.ps1 -EnsureTestDeps
run: |
& build\bin\nvim.exe "--version"
# Ensure that the "win32" feature is set.
& build\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"'
python -m pip install pynvim
# Sanity check
python -c "import pynvim; print(str(pynvim))"
gem.cmd install --pre neovim
Get-Command -CommandType Application neovim-ruby-host.bat
node --version
npm.cmd --version
npm.cmd install -g neovim
Get-Command -CommandType Application neovim-node-host.cmd
npm.cmd link neovim
- if: "!cancelled()"
name: Determine if run should be aborted
@ -357,9 +382,15 @@ jobs:
"status=${{ job.status }}" >> $env:GITHUB_OUTPUT
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Run tests
run: .\ci\build.ps1 -Test
name: Run functionaltests
run: cmake --build build --target functionaltest
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Run old tests
run: .\ci\build.ps1 -TestOld
name: Run oldtests
run: |
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path src\nvim\testdir) VERBOSE=1
$env:PATH = $OldPath

7
.github/workflows/env.ps1 vendored Normal file
View File

@ -0,0 +1,7 @@
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
"$name=$value" >> $env:GITHUB_ENV
}
}

View File

@ -150,10 +150,16 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set env
run: ./.github/workflows/env.ps1
- name: Build deps
run: .\ci\build.ps1 -BuildDeps
run: |
cmake -S cmake.deps -B $env:DEPS_BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo'
cmake --build $env:DEPS_BUILD_DIR
- name: build package
run: .\ci\build.ps1 -Package
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX"
cmake --build build --target package
- uses: actions/upload-artifact@v3
with:
name: nvim-win64

View File

@ -1,97 +0,0 @@
[CmdletBinding(DefaultParameterSetName = "Build")]
param(
[Parameter(ParameterSetName="Build")][switch]$Build,
[Parameter(ParameterSetName="BuildDeps")][switch]$BuildDeps,
[Parameter(ParameterSetName="EnsureTestDeps")][switch]$EnsureTestDeps,
[Parameter(ParameterSetName="Package")][switch]$Package,
[Parameter(ParameterSetName="Test")][switch]$Test,
[Parameter(ParameterSetName="TestOld")][switch]$TestOld
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$projectDir = [System.IO.Path]::GetFullPath("$(Get-Location)")
$buildDir = Join-Path -Path $projectDir -ChildPath "build"
function exitIfFailed() {
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
}
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
Set-Content env:\"$name" $value
}
}
function BuildDeps {
cmake -S "$projectDir\cmake.deps" -B $env:DEPS_BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo'; exitIfFailed
cmake --build $env:DEPS_BUILD_DIR; exitIfFailed
}
function Build {
cmake -S $projectDir -B $buildDir -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX"; exitIfFailed
cmake --build $buildDir; exitIfFailed
}
function EnsureTestDeps {
& $buildDir\bin\nvim.exe "--version"; exitIfFailed
# Ensure that the "win32" feature is set.
& $buildDir\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
python -m pip install pynvim
# Sanity check
python -c "import pynvim; print(str(pynvim))"; exitIfFailed
gem.cmd install --pre neovim
Get-Command -CommandType Application neovim-ruby-host.bat; exitIfFailed
node --version
npm.cmd --version
npm.cmd install -g neovim; exitIfFailed
Get-Command -CommandType Application neovim-node-host.cmd; exitIfFailed
npm.cmd link neovim
}
function Test {
# Functional tests
# The $LastExitCode from MSBuild can't be trusted
$failed = $false
# Run only this test file:
# $env:TEST_FILE = "test\functional\foo.lua"
cmake --build $buildDir --target functionaltest 2>&1 |
ForEach-Object { $failed = $failed -or
$_ -match 'functional tests failed with error'; $_ }
if ($failed) {
exit $LastExitCode
}
}
function TestOld {
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path $projectDir\src\nvim\testdir) VERBOSE=1; exitIfFailed
$env:PATH = $OldPath
}
function Package {
cmake -S $projectDir -B $buildDir -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX"; exitIfFailed
cmake --build $buildDir --target package; exitIfFailed
}
if ($PSCmdlet.ParameterSetName) {
& (Get-ChildItem "Function:$($PSCmdlet.ParameterSetName)")
exit
}