build.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: "Build & Test"
  2. on: [push, pull_request]
  3. jobs:
  4. macOS:
  5. runs-on: macos-latest
  6. timeout-minutes: 30
  7. env:
  8. MACOSX_DEPLOYMENT_TARGET: "10.9"
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v4
  12. - name: Download LuaJIT
  13. uses: actions/checkout@v4
  14. with:
  15. repository: LuaJIT/LuaJIT
  16. ref: v2.1
  17. path: LuaJIT
  18. - name: Compile universal LuaJIT
  19. working-directory: ./LuaJIT
  20. run: |
  21. TARGET_FLAGS="-arch x86_64" make
  22. cp ./src/libluajit.so ./src/libluajit_x64.dylib
  23. cp ./src/luajit ./src/luajit_x64
  24. make clean
  25. TARGET_FLAGS="-arch arm64" make
  26. cp ./src/libluajit.so ./src/libluajit_arm.dylib
  27. cp ./src/luajit ./src/luajit_arm
  28. lipo -create -output ./src/libluajit.dylib ./src/libluajit_x64.dylib ./src/libluajit_arm.dylib
  29. lipo -create -output ./src/luajit ./src/luajit_x64 ./src/luajit_arm
  30. - name: Configure
  31. run: cmake -Bbuild -S. -G Xcode -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DLUA_INCLUDE_DIR=$PWD/LuaJIT/src -DLUA_LIBRARIES=$PWD/LuaJIT/src/lua
  32. - name: Build
  33. working-directory: build
  34. run: xcodebuild -configuration Release -scheme https -destination generic/platform=macOS
  35. - name: Test
  36. working-directory: ./build/src/Release
  37. run: ../../../LuaJIT/src/luajit -l "https" ../../../example/test.lua
  38. - name: Artifact
  39. if: always()
  40. uses: actions/upload-artifact@v4
  41. with:
  42. name: https-macos.zip
  43. path: build/src/**/https.so
  44. Linux:
  45. name: ${{ matrix.mode.name }}
  46. runs-on: ubuntu-20.04
  47. timeout-minutes: 30
  48. strategy:
  49. matrix:
  50. mode:
  51. - name: Linux cURL
  52. curl: 1
  53. openssl: 0
  54. artifact: 0
  55. - name: Linux OpenSSL
  56. curl: 0
  57. openssl: 1
  58. artifact: 0
  59. - name: Linux cURL & OpenSSL
  60. curl: 1
  61. openssl: 1
  62. artifact: 1
  63. steps:
  64. - name: Checkout
  65. uses: actions/checkout@v4
  66. - name: Update APT Repository
  67. run: sudo apt-get update
  68. - name: Install Dependencies
  69. run: sudo apt-get install -y lua5.1 luajit liblua5.1-0-dev libcurl4-openssl-dev g++ libssl-dev
  70. - name: Configure
  71. run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Release -DUSE_CURL_BACKEND=${{ matrix.mode.curl }} -DUSE_OPENSSL_BACKEND=${{ matrix.mode.openssl }}
  72. - name: Build
  73. run: cmake --build build --config Release --target install -j$(nproc)
  74. - name: Test (Lua)
  75. if: matrix.mode.artifact == 0
  76. working-directory: ./install
  77. run: lua -l "https" ../example/test.lua
  78. - name: Test (LuaJIT)
  79. if: matrix.mode.artifact == 0
  80. working-directory: ./install
  81. run: luajit -l "https" ../example/test.lua
  82. - name: Artifact
  83. if: matrix.mode.artifact == 1
  84. uses: actions/upload-artifact@v4
  85. with:
  86. name: https-ubuntu.zip
  87. path: install/https.so
  88. Windows:
  89. runs-on: windows-latest
  90. strategy:
  91. matrix:
  92. arch:
  93. - Win32
  94. - x64
  95. defaults:
  96. run:
  97. shell: cmd
  98. steps:
  99. - name: Checkout
  100. uses: actions/checkout@v4
  101. - name: Download LuaJIT
  102. uses: actions/checkout@v4
  103. with:
  104. repository: LuaJIT/LuaJIT
  105. ref: v2.1
  106. path: LuaJIT
  107. - name: Configure MSVC Developer Command Prompt
  108. uses: ilammy/msvc-dev-cmd@v1
  109. with:
  110. arch: ${{ matrix.arch }}
  111. - name: Compile LuaJIT
  112. working-directory: ./LuaJIT/src
  113. run: msvcbuild.bat amalg
  114. - name: Configure
  115. run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=%CD%\install -A ${{ matrix.arch }} -DLUA_INCLUDE_DIR=%CD%\LuaJIT\src -DLUA_LIBRARIES=%CD%\LuaJIT\src\lua51.lib
  116. - name: Build
  117. run: cmake --build build --config Release --target install
  118. - name: Test
  119. working-directory: ./install
  120. run: ..\LuaJIT\src\luajit ..\example\test.lua
  121. - name: Artifact
  122. if: always()
  123. uses: actions/upload-artifact@v4
  124. with:
  125. name: https-windows-${{ matrix.arch }}.zip
  126. path: install/https.dll