From 4d37ba57eeff1e86b0546e422ddd51492cf75dad Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 8 Oct 2021 22:38:13 +0800 Subject: switch to luajit in this version --- .github/workflows/windows_lua.yml | 122 +++++++++++++++++++++++++++++++++++ .github/workflows/windows_luajit.yml | 122 ----------------------------------- core/xmake.lua | 2 +- 3 files changed, 123 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/windows_lua.yml delete mode 100644 .github/workflows/windows_luajit.yml diff --git a/.github/workflows/windows_lua.yml b/.github/workflows/windows_lua.yml new file mode 100644 index 000000000..3ad8ebf74 --- /dev/null +++ b/.github/workflows/windows_lua.yml @@ -0,0 +1,122 @@ +name: Windows (Luajit) + +on: + pull_request: + push: + release: + types: [published] + +jobs: + build: + strategy: + matrix: + os: [windows-latest, windows-2016] + arch: [x64, x86] + + runs-on: ${{ matrix.os }} + + concurrency: + group: ${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-Windows-Luajit + cancel-in-progress: true + steps: + - uses: actions/checkout@v2 + with: + # WyriHaximus/github-action-get-previous-tag@master need it + fetch-depth: 0 + submodules: true + - uses: xmake-io/github-action-setup-xmake@v1 + with: + # this is not supported, use dev branch instead + # xmake-version: local# + xmake-version: branch@dev + - uses: dlang-community/setup-dlang@v1 + with: + compiler: dmd-latest + - uses: little-core-labs/get-git-tag@v3.0.2 + id: tagName + + - name: Prepare + run: | + xmake show + Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04.zip" -UseBasicParsing -OutFile ./nsis.zip + Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04-strlen_8192.zip" -UseBasicParsing -OutFile ./nsis-longstr.zip + Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/UAC.zip" -UseBasicParsing -OutFile ./nsis-uac.zip + Expand-Archive ./nsis.zip -DestinationPath ./nsis + Move-Item ./nsis/*/* ./nsis + Expand-Archive ./nsis-longstr.zip -DestinationPath ./nsis -Force + Expand-Archive ./nsis-uac.zip -DestinationPath ./nsis -Force + Move-Item ./nsis/UAC.nsh ./nsis/Include/ + + - name: Build + run: | + xmake f -vD -P core -a ${{ matrix.arch }} --runtime=lua + xmake -vD -P core + + - name: Tests + run: | + Copy-Item ./core/build/xmake.exe ./xmake + Copy-Item ./scripts/xrepo.bat ./xmake + Copy-Item ./scripts/xrepo.ps1 ./xmake + $Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmake) + Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path) + xrepo --version + xmake show + #xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake + xmake lua -v -D tests/run.lua + + - name: Set release arch name + run: | + if ("${{ matrix.arch }}" -eq "x64") { + Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append + } else { + Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append + } + - name: Artifact + run: | + # build installer + (New-Item ./winenv/bin -ItemType Directory).FullName + Invoke-WebRequest "https://github.com/xmake-mirror/7zip/releases/download/19.00/7z19.00-${{ matrix.arch }}.zip" -UseBasicParsing -OutFile .\7zip.zip + Expand-Archive ./7zip.zip -DestinationPath ./7zip + Copy-Item ./7zip/7z.exe ./winenv/bin + Copy-Item ./7zip/7z.dll ./winenv/bin + Invoke-WebRequest "https://curl.se/windows/dl-7.78.0_2/curl-7.78.0_2-win32-mingw.zip" -UseBasicParsing -OutFile .\curl.zip + Expand-Archive ./curl.zip -DestinationPath ./curl + Copy-Item ./curl/curl-7.78.0-win32-mingw/bin/curl.exe ./winenv/bin + Copy-Item ./curl/curl-7.78.0-win32-mingw/bin/curl-ca-bundle.crt ./winenv/bin + $version = (Get-Command xmake/xmake.exe).FileVersionInfo + ./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi + (New-Item ./artifacts/${{env.RELEASE_NAME}} -ItemType Directory).FullName + Copy-Item scripts/xmake.exe ./artifacts/${{env.RELEASE_NAME}}/xmake.exe + # archive + Copy-Item ./*.md ./xmake + Copy-Item ./winenv ./xmake -Recurse + Add-Type -AssemblyName System.Text.Encoding + Add-Type -AssemblyName System.IO.Compression.FileSystem + class FixedEncoder : System.Text.UTF8Encoding { + FixedEncoder() : base($true) { } + [byte[]] GetBytes([string] $s) + { + $s = $s.Replace("\", "/") + return ([System.Text.UTF8Encoding]$this).GetBytes($s) + } + } + Copy-Item ./xmake ./archive/xmake -Recurse + [System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) + (Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append + Copy-Item archive.zip ./artifacts/${{env.RELEASE_NAME}} + Copy-Item shafile ./artifacts/${{env.RELEASE_NAME}} + + # upload artifacts + - uses: actions/upload-artifact@v2 + with: + name: xmake-latest.${{env.RELEASE_NAME}}.exe + path: artifacts/${{env.RELEASE_NAME}}/xmake.exe + - uses: actions/upload-artifact@v2 + with: + name: xmake-latest.${{ env.RELEASE_NAME }}.zip + path: artifacts/${{env.RELEASE_NAME}}/archive.zip + - uses: actions/upload-artifact@v2 + with: + name: xmake-latest.${{ env.RELEASE_NAME }}.sha256 + path: artifacts/${{env.RELEASE_NAME}}/shafile + diff --git a/.github/workflows/windows_luajit.yml b/.github/workflows/windows_luajit.yml deleted file mode 100644 index 3b2115beb..000000000 --- a/.github/workflows/windows_luajit.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Windows (Luajit) - -on: - pull_request: - push: - release: - types: [published] - -jobs: - build: - strategy: - matrix: - os: [windows-latest, windows-2016] - arch: [x64, x86] - - runs-on: ${{ matrix.os }} - - concurrency: - group: ${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-Windows-Luajit - cancel-in-progress: true - steps: - - uses: actions/checkout@v2 - with: - # WyriHaximus/github-action-get-previous-tag@master need it - fetch-depth: 0 - submodules: true - - uses: xmake-io/github-action-setup-xmake@v1 - with: - # this is not supported, use dev branch instead - # xmake-version: local# - xmake-version: branch@dev - - uses: dlang-community/setup-dlang@v1 - with: - compiler: dmd-latest - - uses: little-core-labs/get-git-tag@v3.0.2 - id: tagName - - - name: Prepare - run: | - xmake show - Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04.zip" -UseBasicParsing -OutFile ./nsis.zip - Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04-strlen_8192.zip" -UseBasicParsing -OutFile ./nsis-longstr.zip - Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/UAC.zip" -UseBasicParsing -OutFile ./nsis-uac.zip - Expand-Archive ./nsis.zip -DestinationPath ./nsis - Move-Item ./nsis/*/* ./nsis - Expand-Archive ./nsis-longstr.zip -DestinationPath ./nsis -Force - Expand-Archive ./nsis-uac.zip -DestinationPath ./nsis -Force - Move-Item ./nsis/UAC.nsh ./nsis/Include/ - - - name: Build - run: | - xmake f -vD -P core -a ${{ matrix.arch }} --runtime=luajit - xmake -vD -P core - - - name: Tests - run: | - Copy-Item ./core/build/xmake.exe ./xmake - Copy-Item ./scripts/xrepo.bat ./xmake - Copy-Item ./scripts/xrepo.ps1 ./xmake - $Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmake) - Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path) - xrepo --version - xmake show - #xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake - xmake lua -v -D tests/run.lua - - - name: Set release arch name - run: | - if ("${{ matrix.arch }}" -eq "x64") { - Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append - } else { - Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append - } - - name: Artifact - run: | - # build installer - (New-Item ./winenv/bin -ItemType Directory).FullName - Invoke-WebRequest "https://github.com/xmake-mirror/7zip/releases/download/19.00/7z19.00-${{ matrix.arch }}.zip" -UseBasicParsing -OutFile .\7zip.zip - Expand-Archive ./7zip.zip -DestinationPath ./7zip - Copy-Item ./7zip/7z.exe ./winenv/bin - Copy-Item ./7zip/7z.dll ./winenv/bin - Invoke-WebRequest "https://curl.se/windows/dl-7.78.0_2/curl-7.78.0_2-win32-mingw.zip" -UseBasicParsing -OutFile .\curl.zip - Expand-Archive ./curl.zip -DestinationPath ./curl - Copy-Item ./curl/curl-7.78.0-win32-mingw/bin/curl.exe ./winenv/bin - Copy-Item ./curl/curl-7.78.0-win32-mingw/bin/curl-ca-bundle.crt ./winenv/bin - $version = (Get-Command xmake/xmake.exe).FileVersionInfo - ./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi - (New-Item ./artifacts/${{env.RELEASE_NAME}} -ItemType Directory).FullName - Copy-Item scripts/xmake.exe ./artifacts/${{env.RELEASE_NAME}}/xmake.exe - # archive - Copy-Item ./*.md ./xmake - Copy-Item ./winenv ./xmake -Recurse - Add-Type -AssemblyName System.Text.Encoding - Add-Type -AssemblyName System.IO.Compression.FileSystem - class FixedEncoder : System.Text.UTF8Encoding { - FixedEncoder() : base($true) { } - [byte[]] GetBytes([string] $s) - { - $s = $s.Replace("\", "/") - return ([System.Text.UTF8Encoding]$this).GetBytes($s) - } - } - Copy-Item ./xmake ./archive/xmake -Recurse - [System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) - (Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append - Copy-Item archive.zip ./artifacts/${{env.RELEASE_NAME}} - Copy-Item shafile ./artifacts/${{env.RELEASE_NAME}} - - # upload artifacts - - uses: actions/upload-artifact@v2 - with: - name: xmake-latest.${{env.RELEASE_NAME}}.exe - path: artifacts/${{env.RELEASE_NAME}}/xmake.exe - - uses: actions/upload-artifact@v2 - with: - name: xmake-latest.${{ env.RELEASE_NAME }}.zip - path: artifacts/${{env.RELEASE_NAME}}/archive.zip - - uses: actions/upload-artifact@v2 - with: - name: xmake-latest.${{ env.RELEASE_NAME }}.sha256 - path: artifacts/${{env.RELEASE_NAME}}/shafile - diff --git a/core/xmake.lua b/core/xmake.lua index a9108c487..71253d8ae 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -43,7 +43,7 @@ end -- the runtime option option("runtime") set_showmenu(true) - set_default("lua") + set_default("luajit") set_description("Use luajit or lua runtime") set_values("luajit", "lua") option_end() -- cgit v1.3.1