| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- name: "build-and-test"
- on: [push, pull_request]
- env:
- ACTIONS_ALLOW_UNSECURE_COMMANDS: true # required for leafo/gh-actions-lua
- jobs:
- macOS:
- runs-on: "macos-latest"
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - uses: leafo/gh-actions-lua@v7
- with:
- luaVersion: "5.1.5"
- - run: |
- export MACOSX_DEPLOYMENT_TARGET=10.9
- 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
- cd ./build
- xcodebuild -configuration Release -scheme https
- cd src/Release
- lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
- - uses: actions/upload-artifact@v2
- with:
- name: https-macos.zip
- path: build/src/**/https.so
- Linux:
- runs-on: "ubuntu-20.04"
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v2
- - name: Build and test
- run: |
- # install dependencies
- sudo apt-get install -y cmake lua5.1 liblua5.1-0-dev luajit libluajit-5.1-dev libcurl4-openssl-dev g++ libssl-dev
-
- # build
- cmake -S . -B ./build
- cd build
- make
- cd ..
- cp build/src/https.so ./https.so
-
- # Test
- lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
- luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
- - uses: actions/upload-artifact@v2
- with:
- name: https-ubuntu.zip
- path: https.so
- Windows:
- runs-on: "windows-2019"
- strategy:
- matrix:
- arch:
- - Win32
- - x64
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Download LuaJIT
- uses: actions/checkout@v3
- with:
- repository: LuaJIT/LuaJIT
- ref: v2.1
- path: LuaJIT
- - name: Compile LuaJIT
- shell: cmd
- env:
- BUILD_ARCH: ${{ matrix.arch }}
- run: |
- rem Compile LuaJIT using MSVC Command Prompt
- rem https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019
- set VCBT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
- if %BUILD_ARCH% == Win32 (
- call %VCBT% x86
- ) else (
- call %VCBT% x86_amd64
- )
- cd LuaJIT\src
- msvcbuild.bat amalg
- - name: Configure
- shell: cmd
- 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
- - name: Build
- shell: cmd
- run: cmake --build build --config Release --target install
- - name: Copy https.dll For testing
- shell: cmd
- run: copy /y install\https.dll LuaJIT\src\https.dll
- - name: Test
- shell: cmd
- run: cd LuaJIT\src && luajit ..\..\example\example.lua
- - uses: actions/upload-artifact@v2
- with:
- name: https-windows-${{ matrix.arch }}.zip
- path: install\https.dll
|