build.yml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.7
  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 derivedDataPath Build
  19. mv Build/Release/libhttps.so Build/Release/https.so
  20. cd Build/Release
  21. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  22. - uses: actions/upload-artifact@v2
  23. with:
  24. name: https-macos.zip
  25. path: build/Build/**/https.so
  26. Linux:
  27. runs-on: "ubuntu-20.04"
  28. timeout-minutes: 30
  29. steps:
  30. - uses: actions/checkout@v2
  31. - name: Build and test
  32. run: |
  33. # install dependencies
  34. sudo apt-get install -y cmake lua5.1 liblua5.1-0-dev luajit libluajit-5.1-dev libcurl4-openssl-dev g++ libssl-dev
  35. # build
  36. cmake -S . -B ./build
  37. cd build
  38. make
  39. cd ..
  40. cp build/src/libhttps.so ./https.so
  41. # Test
  42. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  43. luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  44. - uses: actions/upload-artifact@v2
  45. with:
  46. name: https-ubuntu.zip
  47. path: https.so
  48. Windows:
  49. runs-on: "windows-latest"
  50. timeout-minutes: 30
  51. steps:
  52. - uses: actions/checkout@v2
  53. - uses: carlosperate/[email protected]
  54. with:
  55. file-url: "https://master.dl.sourceforge.net/project/luabinaries/5.1.5/Windows%20Libraries/Dynamic/lua-5.1.5_Win64_dll14_lib.zip"
  56. file-name: "lua51.zip"
  57. - uses: carlosperate/[email protected]
  58. with:
  59. file-url: "https://iweb.dl.sourceforge.net/project/luabinaries/5.1.5/Tools%20Executables/lua-5.1.5_Win64_bin.zip"
  60. file-name: "lua51bin.zip"
  61. - run: |
  62. 7z x lua51.zip -o${{ runner.workspace }}/lua-51
  63. 7z x lua51bin.zip -o${{ runner.workspace }}/lua-51/bin
  64. - uses: ashutoshvarma/action-cmake-build@master
  65. with:
  66. build-dir: ${{ runner.workspace }}/build
  67. build-type: Release
  68. # Extra options pass to cmake while configuring project
  69. configure-options: "-H. -A x64 -T v140 -DLUA_INCLUDE_DIR=${{ runner.workspace }}/lua-51/include -DLUA_LIBRARIES=${{ runner.workspace }}/lua-51/lua5.1.lib"
  70. - run: |
  71. cd ${{ runner.workspace }}/build/src/Release
  72. ${{ runner.workspace }}/lua-51/bin/lua5.1.exe -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  73. - uses: actions/upload-artifact@v2
  74. with:
  75. name: https-windows.zip
  76. path: ${{ runner.workspace }}/build/src/**/https.dll