Browse Source

Update Actions to use tests script.

Additional changes include:
* Test each OpenSSL and cURL backend for Linux.
* Always try to upload artifacts even on failure.
* Minor cleanup on Windows actions.
Miku AuahDark 2 years ago
parent
commit
af279dfbc7
1 changed files with 32 additions and 16 deletions
  1. 32 16
      .github/workflows/build.yml

+ 32 - 16
.github/workflows/build.yml

@@ -21,15 +21,33 @@ jobs:
         run: xcodebuild -configuration Release -scheme https
       - name: Test
         working-directory: ./build/src/Release
-        run: lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
-      - uses: actions/upload-artifact@v3
+        run: lua -l "https" ../../../example/test.lua
+      - name: Artifact
+        if: always()
+        uses: actions/upload-artifact@v3
         with:
           name: https-macos.zip
           path: build/src/**/https.so
 
   Linux:
+    name: ${{ matrix.mode.name }}
     runs-on: ubuntu-latest
     timeout-minutes: 30
+    strategy:
+      matrix:
+        mode:
+        - name: Linux cURL
+          curl: 1
+          openssl: 0
+          artifact: 0
+        - name: Linux OpenSSL
+          curl: 0
+          openssl: 1
+          artifact: 0
+        - name: Linux cURL & OpenSSL
+          curl: 1
+          openssl: 1
+          artifact: 1
     steps:
       - name: Checkout
         uses: actions/checkout@v3
@@ -38,16 +56,19 @@ jobs:
       - name: Install Dependencies
         run: sudo apt-get install -y lua5.1 luajit liblua5.1-0-dev libcurl4-openssl-dev g++ libssl-dev
       - name: Configure
-        run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=RelWithDebInfo
+        run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_CURL_BACKEND=${{ matrix.mode.curl }} -DUSE_OPENSSL_BACKEND=${{ matrix.mode.openssl }}
       - name: Build
         run: cmake --build build --config RelWithDebInfo --target install -j$(nproc)
       - name: Test (Lua)
+        if: matrix.mode.artifact == 0
         working-directory: ./install
-        run: lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
+        run: lua -l "https" ../example/test.lua
       - name: Test (LuaJIT)
+        if: matrix.mode.artifact == 0
         working-directory: ./install
-        run: luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
+        run: luajit -l "https" ../example/test.lua
       - name: Artifact
+        if: matrix.mode.artifact == 1
         uses: actions/upload-artifact@v3
         with:
           name: https-ubuntu.zip
@@ -60,6 +81,9 @@ jobs:
         arch:
         - Win32
         - x64
+    defaults:
+      run:
+        shell: cmd
     steps:
     - name: Checkout
       uses: actions/checkout@v3
@@ -74,25 +98,17 @@ jobs:
       with:
         arch: ${{ matrix.arch }}
     - name: Compile LuaJIT
-      shell: cmd
       working-directory: ./LuaJIT/src
-      env:
-        BUILD_ARCH: ${{ matrix.arch }}
       run: msvcbuild.bat amalg
     - name: Configure
-      shell: cmd
       run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=%CD%\install -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
-      working-directory: ./LuaJIT/src
-      run: luajit ..\..\example\example.lua
+      working-directory: ./install
+      run: ..\LuaJIT\src\luajit ..\example\test.lua
     - name: Artifact
+      if: always()
       uses: actions/upload-artifact@v3
       with:
         name: https-windows-${{ matrix.arch }}.zip