Build on Windows #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build native dependencies (Lua) | |
| env: | |
| LUA_VERSION: 5.1.5 # Make sure this matches the version mentioned in the description in the .nuspec file. | |
| on: | |
| pull_request: | |
| workflow_call: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| windows: | |
| name: Windows (x64) | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Setup Dependencies | |
| run: | | |
| New-Item -ItemType Directory -Force artifacts/x64 | Out-Null | |
| - name: Download sources | |
| shell: pwsh | |
| run: | | |
| $version = ${env:LUA_VERSION} | |
| $archive = "lua-${env:LUA_VERSION}.tar.gz" | |
| $url = "https://www.lua.org/ftp/$archive" | |
| Invoke-WebRequest -Uri $url -OutFile $archive | |
| tar xf $archive | |
| - name: Compile natives | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
| cd lua-%LUA_VERSION%/src/ | |
| cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c | |
| ren lua.obj lua.o | |
| ren luac.obj luac.o | |
| link /DLL /IMPLIB:lua51.lib /OUT:lua51.dll *.obj | |
| cp lua51.dll ../../artifacts/x64/ | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Natives-Windows | |
| path: ./artifacts | |
| windows-arm64: | |
| name: Windows (arm64) | |
| runs-on: windows-11-arm | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v7 | |
| - name: Setup Dependencies | |
| shell: pwsh | |
| run: | | |
| - name: Setup Dependencies | |
| run: | | |
| New-Item -ItemType Directory -Force artifacts/arm64 | Out-Null | |
| - name: Download sources | |
| shell: pwsh | |
| run: | | |
| $version = ${env:LUA_VERSION} | |
| $archive = "lua-${env:LUA_VERSION}.tar.gz" | |
| $url = "https://www.lua.org/ftp/$archive" | |
| Invoke-WebRequest -Uri $url -OutFile $archive | |
| tar xf $archive | |
| - name: Compile natives | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat" | |
| cd lua-%LUA_VERSION%/src/ | |
| cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c | |
| ren lua.obj lua.o | |
| ren luac.obj luac.o | |
| link /DLL /IMPLIB:lua51.lib /OUT:lua51.dll *.obj | |
| cp lua51.dll ../../artifacts/arm64/ | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Natives-Windows(arm64) | |
| path: ./artifacts | |
| macos: | |
| name: macOS (x64 + arm64) | |
| runs-on: macos-14 | |
| steps: | |
| - name: Clone Repository | |
| uses: actions/checkout@v7 | |
| - name: Setup Dependencies | |
| run: | | |
| mkdir -p artifacts/x86_64 | |
| mkdir artifacts/arm64 | |
| - name: Compile natives | |
| run: | | |
| curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | |
| tar xf lua-${LUA_VERSION}.tar.gz | |
| cd lua-${LUA_VERSION}/src/ | |
| patch < ../../liblua.macos.patch | |
| make liblua.5.1.dylib CC="clang -target x86_64-apple-macos10.11" LD="clang -target x86_64-apple-macos10.11" | |
| cp liblua.${LUA_VERSION}.dylib ../../artifacts/x86_64/lua51.dylib | |
| make clean | |
| make liblua.5.1.dylib CC="clang -target arm64-apple-macos10.15" LD="clang -target arm64-apple-macos10.15" | |
| cp liblua.${LUA_VERSION}.dylib ../../artifacts/arm64/lua51.dylib | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Natives-MacOS | |
| path: ./artifacts | |
| # Note: Running inside a RockyLinux container because we want to compile using a version of glibc | |
| # that is as old as reasonably possible to ensure backwards compatibility of the compiled binaries. | |
| linux-x64: | |
| name: Linux (x64) | |
| runs-on: ubuntu-22.04 | |
| container: rockylinux:8 | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v7 | |
| - name: Setup Dependencies | |
| run: | | |
| mkdir -p artifacts/x64 | |
| dnf -y upgrade | |
| dnf install -y gcc make patch | |
| - name: Compile natives | |
| run: | | |
| curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | |
| tar xf lua-${LUA_VERSION}.tar.gz | |
| cd lua-${LUA_VERSION}/src/ | |
| patch < ../../liblua.linux.patch | |
| make liblua.so | |
| cp liblua.so ../../artifacts/x64/lua51.so | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Natives-Linux(x64) | |
| path: ./artifacts | |
| linux-arm64: | |
| name: Linux (arm64) | |
| runs-on: ubuntu-22.04-arm | |
| steps: | |
| - name: Clone Repository | |
| uses: actions/checkout@v7 | |
| - name: Setup dependencies and compile natives | |
| run: | | |
| mkdir -p artifacts/arm64 | |
| curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | |
| tar xf lua-${LUA_VERSION}.tar.gz | |
| cd lua-${LUA_VERSION}/src/ | |
| patch < ../../liblua.linux.patch | |
| make liblua.so | |
| cp liblua.so ../../artifacts/arm64/lua51.so | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Natives-Linux(arm64) | |
| path: ./artifacts |