Skip to content

Commit 67e58ac

Browse files
committed
Update GitHub Actions workflow.
1 parent 6a6d6bd commit 67e58ac

File tree

1 file changed

+50
-51
lines changed

1 file changed

+50
-51
lines changed

.github/workflows/build.yml

+50-51
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,60 @@
1-
name: "build-and-test"
1+
name: "Build & Test"
22
on: [push, pull_request]
33

4-
env:
5-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # required for leafo/gh-actions-lua
6-
74
jobs:
85
macOS:
9-
runs-on: "macos-latest"
6+
runs-on: macos-latest
107
timeout-minutes: 30
8+
env:
9+
MACOSX_DEPLOYMENT_TARGET: "10.9"
1110
steps:
12-
- uses: actions/checkout@v2
13-
- uses: leafo/gh-actions-lua@v7
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Install Lua 5.1
14+
uses: leafo/[email protected]
1415
with:
1516
luaVersion: "5.1.5"
16-
- run: |
17-
export MACOSX_DEPLOYMENT_TARGET=10.9
18-
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
19-
cd ./build
20-
xcodebuild -configuration Release -scheme https
21-
22-
cd src/Release
23-
lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
24-
- uses: actions/upload-artifact@v2
17+
- name: Configure
18+
run: cmake -Bbuild -S. -G Xcode -DLUA_INCLUDE_DIR=$PWD/.lua/include -DLUA_LIBRARIES=$PWD/.lua/lib/liblua.a
19+
- name: Build
20+
working-directory: build
21+
run: xcodebuild -configuration Release -scheme https
22+
- name: Test
23+
working-directory: ./build/src/Release
24+
run: lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
25+
- uses: actions/upload-artifact@v3
2526
with:
2627
name: https-macos.zip
2728
path: build/src/**/https.so
2829

2930
Linux:
30-
runs-on: "ubuntu-20.04"
31+
runs-on: ubuntu-latest
3132
timeout-minutes: 30
3233
steps:
33-
- uses: actions/checkout@v2
34-
- name: Build and test
35-
run: |
36-
# install dependencies
37-
sudo apt-get install -y cmake lua5.1 liblua5.1-0-dev luajit libluajit-5.1-dev libcurl4-openssl-dev g++ libssl-dev
38-
39-
# build
40-
cmake -S . -B ./build
41-
cd build
42-
make
43-
cd ..
44-
cp build/src/https.so ./https.so
45-
46-
# Test
47-
lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
48-
luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
49-
- uses: actions/upload-artifact@v2
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
- name: Update APT Repository
37+
run: sudo apt-get update
38+
- name: Install Dependencies
39+
run: sudo apt-get install -y lua5.1 luajit liblua5.1-0-dev libcurl4-openssl-dev g++ libssl-dev
40+
- name: Configure
41+
run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=RelWithDebInfo
42+
- name: Build
43+
run: cmake --build build --config RelWithDebInfo --target install -j$(nproc)
44+
- name: Test (Lua)
45+
working-directory: ./install
46+
run: lua -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
47+
- name: Test (LuaJIT)
48+
working-directory: ./install
49+
run: luajit -l "https" -e "assert(require('https').request('https://httpbin.org/post', {method='post', data='lotsa=data'}) == 200)"
50+
- name: Artifact
51+
uses: actions/upload-artifact@v3
5052
with:
5153
name: https-ubuntu.zip
52-
path: https.so
54+
path: install/https.so
5355

5456
Windows:
55-
runs-on: "windows-2019"
57+
runs-on: windows-latest
5658
strategy:
5759
matrix:
5860
arch:
@@ -67,24 +69,19 @@ jobs:
6769
repository: LuaJIT/LuaJIT
6870
ref: v2.1
6971
path: LuaJIT
72+
- name: Configure MSVC Developer Command Prompt
73+
uses: ilammy/msvc-dev-cmd@v1
74+
with:
75+
arch: ${{ matrix.arch }}
7076
- name: Compile LuaJIT
7177
shell: cmd
78+
working-directory: ./LuaJIT/src
7279
env:
7380
BUILD_ARCH: ${{ matrix.arch }}
74-
run: |
75-
rem Compile LuaJIT using MSVC Command Prompt
76-
rem https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019
77-
set VCBT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
78-
if %BUILD_ARCH% == Win32 (
79-
call %VCBT% x86
80-
) else (
81-
call %VCBT% x86_amd64
82-
)
83-
cd LuaJIT\src
84-
msvcbuild.bat amalg
81+
run: msvcbuild.bat amalg
8582
- name: Configure
8683
shell: cmd
87-
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
84+
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
8885
- name: Build
8986
shell: cmd
9087
run: cmake --build build --config Release --target install
@@ -93,8 +90,10 @@ jobs:
9390
run: copy /y install\https.dll LuaJIT\src\https.dll
9491
- name: Test
9592
shell: cmd
96-
run: cd LuaJIT\src && luajit ..\..\example\example.lua
97-
- uses: actions/upload-artifact@v2
93+
working-directory: ./LuaJIT/src
94+
run: luajit ..\..\example\example.lua
95+
- name: Artifact
96+
uses: actions/upload-artifact@v3
9897
with:
9998
name: https-windows-${{ matrix.arch }}.zip
100-
path: install\https.dll
99+
path: install/https.dll

0 commit comments

Comments
 (0)