From a221b6c64f752bf1d881a9e490dd2a693ddf819e Mon Sep 17 00:00:00 2001 From: Marco Kellershoff Date: Sun, 13 Oct 2024 21:22:34 +0200 Subject: [PATCH] feat(ci): windows --- .github/workflows/test-windows.yml | 15 +++++++-- scripts/install-ci-test-requirements.ps1 | 40 +++++++++++++----------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 3f91761..05f10dc 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -2,11 +2,13 @@ name: Test on Windows on: - # Allows you to run this workflow manually from the Actions tab + pull_request: + branches: + - main workflow_dispatch: jobs: - test-linux: + test-windows: name: Test Windows runs-on: windows-latest steps: @@ -16,8 +18,17 @@ jobs: with: path: | .tests + ~\scoop key: ${{ runner.os }}-tests - name: Install dependencies run: ./scripts/install-ci-test-requirements.ps1 + - name: Save cache + id: cache-primes-save + uses: actions/cache/save@v4 + with: + path: | + .tests + ~\scoop + key: ${{ runner.os }}-tests - name: Run tests run: ./scripts/tests.ps1 diff --git a/scripts/install-ci-test-requirements.ps1 b/scripts/install-ci-test-requirements.ps1 index 9b677fc..8b1f380 100644 --- a/scripts/install-ci-test-requirements.ps1 +++ b/scripts/install-ci-test-requirements.ps1 @@ -1,40 +1,44 @@ -setx /M KULALA_ROOT_DIR (Get-Location).Path -setx /M LUAJIT_FOR_WIN_REPO \"luajit-for-win64\" -setx /M LUAJIT_FOR_WIN_RELEASE \"0.0.2\" +$Env:KULALA_ROOT_DIR = (Get-Location).Path + +if (!(Test-Path .tests)) { + mkdir .tests +} cd .tests Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression -# required before add extras scoop install main/git - -# add for extras suggested by neovim -scoop bucket add extras - -scoop install extras/vcredist2022 scoop install main/neovim@0.10.2 -Invoke-RestMethod -Uri \"https://github.com/mistweaverco/$Env:LUAJIT_FOR_WIN_REPO/archive/refs/tags/v$Env:LUAJIT_FOR_WIN_RELEASE.zip\" -outfile luajit.zip +Invoke-RestMethod -Uri https://github.com/mistweaverco/luajit-for-win64/archive/refs/tags/v0.0.2.zip -outfile luajit.zip 7z x luajit.zip RM luajit.zip -cd \"$Env:LUAJIT_FOR_WIN_REPO-$Env:LUAJIT_FOR_WIN_RELEASE\" +cd luajit-for-win64-0.0.2 .\luajit-for-win64.cmd -setx /M KULALA_LUA_DIR (Get-Location).Path +$Env:KULALA_LUA_DIR = (Get-Location).Path -setx /M PATH \"$Env:KULALA_LUA_DIR\tools\cmd;$Env:KULALA_LUA_DIR\tools\PortableGit\mingw64\bin;$Env:KULALA_LUA_DIR\tools\PortableGit\usr\bin;$Env:KULALA_LUA_DIR\tools\mingw\bin;$Env:KULALA_LUA_DIR\lib;$Env:KULALA_LUA_DIR\bin;$Env:APPDATA\LJ4W\LuaRocks\bin;$Env:path\" -setx /M LUA_PATH \"$Env:KULALA_LUA_DIR\lua\?.lua;$Env:KULALA_LUA_DIR\lua\?\init.lua;$Env:APPDATA\luarocks\share\lua\5.1\?.lua;$Env:APPDATA\luarocks\share\lua\5.1\?\init.lua;$Env:LUA_PATH\" -setx /M LUA_CPATH \"$Env:APPDATA\luarocks;$Env:APPDATA\luarocks\lib\lua\5.1\?.dll;$Env:LUA_CPATH\" +$Env:PATH = \"$Env:KULALA_LUA_DIR\tools\cmd;$Env:KULALA_LUA_DIR\tools\PortableGit\mingw64\bin;$Env:KULALA_LUA_DIR\tools\PortableGit\usr\bin;$Env:KULALA_LUA_DIR\tools\mingw\bin;$Env:KULALA_LUA_DIR\lib;$Env:KULALA_LUA_DIR\bin;$Env:APPDATA\LJ4W\LuaRocks\bin;$Env:PATH\" +$Env:LUA_PATH = \"$Env:KULALA_LUA_DIR\lua\?.lua;$Env:KULALA_LUA_DIR\lua\?\init.lua;$Env:APPDATA\luarocks\share\lua\5.1\?.lua;$Env:APPDATA\luarocks\share\lua\5.1\?\init.lua;$Env:LUA_PATH\" +$Env:LUA_CPATH = \"$Env:APPDATA\luarocks;$Env:APPDATA\luarocks\lib\lua\5.1\?.dll;$Env:LUA_CPATH\" -Write-Host \"Path: $Env:PATH.Split(';')\" -Write-Host \"LUA_PATH: $Env:LUA_PATH.Split(';')\" -Write-Host \"LUA_CPATH: $Env:LUA_CPATH.Split(';')\" +Write-Host "Path" +Write-Host $Env:PATH.Split(';') +Write-Host "LUA_PATH" +Write-Host $Env:LUA_PATH.Split(';') +Write-Host "LUA_CPATH" +Write-Host $Env:LUA_CPATH.Split(';') luarocks install --lua-version 5.1 busted +# Persist the Environment Variables +echo "PATH=$Env:Path" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append +echo "LUA_PATH=$Env:LUA_PATH" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append +echo "LUA_CPATH=$Env:LUA_CPATH" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + cd $Env:KULALA_ROOT_DIR