build.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. build_macos_10_luajit:
  7. runs-on: "macos-10.15"
  8. timeout-minutes: 30
  9. steps:
  10. - uses: actions/checkout@v2
  11. - uses: leafo/gh-actions-lua@v7
  12. with:
  13. luaVersion: "luajit"
  14. - run: |
  15. cmake -G Xcode -S . -B ./build -DLUA_INCLUDE_DIR=${{ runner.workspace }}/lua-https/.lua/include/luajit-2.1 -DLUA_LIBRARIES=${{ runner.workspace }}/lua-https/.lua/lib/libluajit-5.1.a
  16. cd ./build
  17. xcodebuild
  18. xcodebuild -configuration Release
  19. mv src/Debug/libhttps.so src/Debug/https.so
  20. mv src/Release/libhttps.so src/Release/https.so
  21. cd src/Debug
  22. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  23. cd ../Release
  24. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  25. - uses: actions/upload-artifact@v2
  26. with:
  27. name: luajit-macos10.zip
  28. path: build/src/**/https.so
  29. build_macos_10_lua51:
  30. runs-on: "macos-10.15"
  31. timeout-minutes: 30
  32. steps:
  33. - uses: actions/checkout@v2
  34. - uses: leafo/gh-actions-lua@v7
  35. with:
  36. luaVersion: "5.1.5"
  37. - run: |
  38. 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
  39. cd ./build
  40. xcodebuild
  41. xcodebuild -configuration Release
  42. mv src/Debug/libhttps.so src/Debug/https.so
  43. mv src/Release/libhttps.so src/Release/https.so
  44. cd src/Debug
  45. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  46. cd ../Release
  47. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  48. - uses: actions/upload-artifact@v2
  49. with:
  50. name: lua51-macos10.zip
  51. path: build/src/**/https.so
  52. build_macos_11:
  53. runs-on: "macos-11.0"
  54. timeout-minutes: 30
  55. steps:
  56. - uses: actions/checkout@v2
  57. - uses: leafo/gh-actions-lua@v7
  58. with:
  59. luaVersion: "5.1.5"
  60. - run: |
  61. 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
  62. cd ./build
  63. xcodebuild
  64. xcodebuild -configuration Release
  65. mv src/Debug/libhttps.so src/Debug/https.so
  66. mv src/Release/libhttps.so src/Release/https.so
  67. cd src/Debug
  68. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  69. cd ../Release
  70. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  71. - uses: actions/upload-artifact@v2
  72. with:
  73. name: macos11.zip
  74. path: build/src/**/https.so
  75. build_linux:
  76. runs-on: "ubuntu-20.04"
  77. timeout-minutes: 30
  78. steps:
  79. - uses: actions/checkout@v2
  80. - name: Build and test
  81. run: |
  82. # install dependencies
  83. sudo apt-get install -y cmake lua5.1 liblua5.1-0-dev luajit libluajit-5.1-dev libcurl4-openssl-dev g++ libssl-dev
  84. # build
  85. cmake -S . -B ./build
  86. cd build
  87. make
  88. cd ..
  89. cp build/src/libhttps.so ./https.so
  90. # Test
  91. lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  92. luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
  93. - uses: actions/upload-artifact@v2
  94. with:
  95. name: ubuntu.zip
  96. path: https.so
  97. build_windows:
  98. runs-on: "windows-2019"
  99. timeout-minutes: 30
  100. steps:
  101. - uses: actions/checkout@v2
  102. - uses: carlosperate/[email protected]
  103. with:
  104. file-url: "https://master.dl.sourceforge.net/project/luabinaries/5.1.5/Windows%20Libraries/Dynamic/lua-5.1.5_Win64_dll14_lib.zip"
  105. file-name: "lua51.zip"
  106. - uses: carlosperate/[email protected]
  107. with:
  108. file-url: "https://iweb.dl.sourceforge.net/project/luabinaries/5.1.5/Tools%20Executables/lua-5.1.5_Win64_bin.zip"
  109. file-name: "lua51bin.zip"
  110. - run: |
  111. 7z x lua51.zip -o${{ runner.workspace }}/lua-51
  112. 7z x lua51bin.zip -o${{ runner.workspace }}/lua-51/bin
  113. - uses: ashutoshvarma/action-cmake-build@master
  114. with:
  115. build-dir: ${{ runner.workspace }}/build
  116. build-type: Debug
  117. # Extra options pass to cmake while configuring project
  118. configure-options: "-H. -A x64 -T v140 -DLUA_INCLUDE_DIR=${{ runner.workspace }}/lua-51/include -DLUA_LIBRARIES=${{ runner.workspace }}/lua-51/lua5.1.lib"
  119. - run: |
  120. cd ${{ runner.workspace }}/build/src/Debug
  121. ${{ 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)"
  122. - uses: actions/upload-artifact@v2
  123. with:
  124. name: windows.zip
  125. path: ${{ runner.workspace }}/build/src/**/https.dll