build.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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@v3
  12. - name: Install Lua 5.1
  13. uses: leafo/[email protected]
  14. with:
  15. luaVersion: "5.1.5"
  16. - name: Configure
  17. run: cmake -Bbuild -S. -G Xcode -DLUA_INCLUDE_DIR=$PWD/.lua/include -DLUA_LIBRARIES=$PWD/.lua/lib/liblua.a
  18. - name: Build
  19. working-directory: build
  20. run: xcodebuild -configuration Release -scheme https
  21. - name: Test
  22. working-directory: ./build/src/Release
  23. run: lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  24. - uses: actions/upload-artifact@v3
  25. with:
  26. name: https-macos.zip
  27. path: build/src/**/https.so
  28. Linux:
  29. runs-on: ubuntu-latest
  30. timeout-minutes: 30
  31. steps:
  32. - name: Checkout
  33. uses: actions/checkout@v3
  34. - name: Update APT Repository
  35. run: sudo apt-get update
  36. - name: Install Dependencies
  37. run: sudo apt-get install -y lua5.1 luajit liblua5.1-0-dev libcurl4-openssl-dev g++ libssl-dev
  38. - name: Configure
  39. run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=RelWithDebInfo
  40. - name: Build
  41. run: cmake --build build --config RelWithDebInfo --target install -j$(nproc)
  42. - name: Test (Lua)
  43. working-directory: ./install
  44. run: lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  45. - name: Test (LuaJIT)
  46. working-directory: ./install
  47. run: luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  48. - name: Artifact
  49. uses: actions/upload-artifact@v3
  50. with:
  51. name: https-ubuntu.zip
  52. path: install/https.so
  53. Windows:
  54. runs-on: windows-latest
  55. strategy:
  56. matrix:
  57. arch:
  58. - Win32
  59. - x64
  60. steps:
  61. - name: Checkout
  62. uses: actions/checkout@v3
  63. - name: Download LuaJIT
  64. uses: actions/checkout@v3
  65. with:
  66. repository: LuaJIT/LuaJIT
  67. ref: v2.1
  68. path: LuaJIT
  69. - name: Configure MSVC Developer Command Prompt
  70. uses: ilammy/msvc-dev-cmd@v1
  71. with:
  72. arch: ${{ matrix.arch }}
  73. - name: Compile LuaJIT
  74. shell: cmd
  75. working-directory: ./LuaJIT/src
  76. env:
  77. BUILD_ARCH: ${{ matrix.arch }}
  78. run: msvcbuild.bat amalg
  79. - name: Configure
  80. shell: cmd
  81. 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
  82. - name: Build
  83. shell: cmd
  84. run: cmake --build build --config Release --target install
  85. - name: Copy https.dll For testing
  86. shell: cmd
  87. run: copy /y install\https.dll LuaJIT\src\https.dll
  88. - name: Test
  89. shell: cmd
  90. working-directory: ./LuaJIT/src
  91. run: luajit ..\..\example\example.lua
  92. - name: Artifact
  93. uses: actions/upload-artifact@v3
  94. with:
  95. name: https-windows-${{ matrix.arch }}.zip
  96. path: install/https.dll