diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 732e3bb8c1..c4f7f9da36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/env.ps1 b/.github/workflows/env.ps1 new file mode 100644 index 0000000000..8ac267f2f9 --- /dev/null +++ b/.github/workflows/env.ps1 @@ -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 + } +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1444109eae..1c033fc1dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/ci/build.ps1 b/ci/build.ps1 deleted file mode 100644 index 2340c2273f..0000000000 --- a/ci/build.ps1 +++ /dev/null @@ -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 -}