build.yml 5.4 KB

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