build.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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-latest"
  49. timeout-minutes: 30
  50. steps:
  51. - uses: actions/checkout@v2
  52. - uses: carlosperate/[email protected]
  53. with:
  54. file-url: "https://master.dl.sourceforge.net/project/luabinaries/5.1.5/Windows%20Libraries/Dynamic/lua-5.1.5_Win64_dll14_lib.zip"
  55. file-name: "lua51.zip"
  56. - uses: carlosperate/[email protected]
  57. with:
  58. file-url: "https://iweb.dl.sourceforge.net/project/luabinaries/5.1.5/Tools%20Executables/lua-5.1.5_Win64_bin.zip"
  59. file-name: "lua51bin.zip"
  60. - run: |
  61. 7z x lua51.zip -o${{ runner.workspace }}/lua-51
  62. 7z x lua51bin.zip -o${{ runner.workspace }}/lua-51/bin
  63. - uses: ashutoshvarma/action-cmake-build@master
  64. with:
  65. build-dir: ${{ runner.workspace }}/build
  66. build-type: Release
  67. # Extra options pass to cmake while configuring project
  68. configure-options: "-H. -A x64 -T v140 -DLUA_INCLUDE_DIR=${{ runner.workspace }}/lua-51/include -DLUA_LIBRARIES=${{ runner.workspace }}/lua-51/lua5.1.lib"
  69. - run: |
  70. cd ${{ runner.workspace }}/build/src/Release
  71. ${{ 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)"
  72. - uses: actions/upload-artifact@v2
  73. with:
  74. name: https-windows.zip
  75. path: ${{ runner.workspace }}/build/src/**/https.dll