build.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: "build-and-test"
  2. on: [push, pull_request]
  3. env:
  4. ACTIONS_ALLOW_UNSECURE_COMMANDS: true # required for leafo/gh-actions-lua
  5. jobs:
  6. macOS:
  7. runs-on: "macos-latest"
  8. timeout-minutes: 30
  9. steps:
  10. - uses: actions/checkout@v2
  11. - uses: leafo/gh-actions-lua@v7
  12. with:
  13. luaVersion: "5.1.5"
  14. - run: |
  15. export MACOSX_DEPLOYMENT_TARGET=10.9
  16. cmake -G Xcode -S . -B ./build -DLUA_INCLUDE_DIR=${{ runner.workspace }}/lua-https/.lua/include -DLUA_LIBRARIES=${{ runner.workspace }}/lua-https/.lua/lib/liblua.a
  17. cd ./build
  18. xcodebuild -configuration Release -scheme https
  19. cd src/Release
  20. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  21. - uses: actions/upload-artifact@v2
  22. with:
  23. name: https-macos.zip
  24. path: build/src/**/https.so
  25. Linux:
  26. runs-on: "ubuntu-20.04"
  27. timeout-minutes: 30
  28. steps:
  29. - uses: actions/checkout@v2
  30. - name: Build and test
  31. run: |
  32. # install dependencies
  33. sudo apt-get install -y cmake lua5.1 liblua5.1-0-dev luajit libluajit-5.1-dev libcurl4-openssl-dev g++ libssl-dev
  34. # build
  35. cmake -S . -B ./build
  36. cd build
  37. make
  38. cd ..
  39. cp build/src/https.so ./https.so
  40. # Test
  41. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  42. luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  43. - uses: actions/upload-artifact@v2
  44. with:
  45. name: https-ubuntu.zip
  46. path: https.so
  47. Windows:
  48. runs-on: "windows-2019"
  49. strategy:
  50. matrix:
  51. arch:
  52. - Win32
  53. - x64
  54. steps:
  55. - name: Checkout
  56. uses: actions/checkout@v3
  57. - name: Download LuaJIT
  58. uses: actions/checkout@v3
  59. with:
  60. repository: LuaJIT/LuaJIT
  61. ref: v2.1
  62. path: LuaJIT
  63. - name: Compile LuaJIT
  64. shell: cmd
  65. env:
  66. BUILD_ARCH: ${{ matrix.arch }}
  67. run: |
  68. rem Compile LuaJIT using MSVC Command Prompt
  69. rem https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019
  70. set VCBT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
  71. if %BUILD_ARCH% == Win32 (
  72. call %VCBT% x86
  73. ) else (
  74. call %VCBT% x86_amd64
  75. )
  76. cd LuaJIT\src
  77. msvcbuild.bat amalg
  78. - name: Configure
  79. shell: cmd
  80. run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=%CD%\install -T v142 -A ${{ matrix.arch }} -DLUA_INCLUDE_DIR=%CD%\LuaJIT\src -DLUA_LIBRARIES=%CD%\LuaJIT\src\lua51.lib
  81. - name: Build
  82. shell: cmd
  83. run: cmake --build build --config Release --target install
  84. - name: Copy https.dll For testing
  85. shell: cmd
  86. run: copy /y install\https.dll LuaJIT\src\https.dll
  87. - name: Test
  88. shell: cmd
  89. run: cd LuaJIT\src && luajit ..\..\example\example.lua
  90. - uses: actions/upload-artifact@v2
  91. with:
  92. name: https-windows-${{ matrix.arch }}.zip
  93. path: install\https.dll