Windows CI (#167)

Windows CI on Github Actions
This commit is contained in:
mihacooper 2022-02-27 16:16:51 +03:00 committed by GitHub
parent 925494e7d5
commit c5e5123341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 34 deletions

View File

@ -1,4 +1,4 @@
name: build & run tests name: build & run tests (NIX)
on: on:
push: push:
@ -13,7 +13,7 @@ jobs:
matrix: matrix:
build-type: [Release] # Debug build-type: [Release] # Debug
lua: ["lua 5.1", "lua 5.2", "lua 5.3", "luajit 2.0"] lua: ["lua 5.1", "lua 5.2", "lua 5.3", "luajit 2.0"]
os: ["macos-latest", "ubuntu-latest"] # "windows-latest" os: ["macos-latest", "ubuntu-latest"]
include: include:
- os: macos-latest - os: macos-latest
macos_build_target: 10.0 macos_build_target: 10.0
@ -31,12 +31,16 @@ jobs:
run: | run: |
pip install hererocks pip install hererocks
hererocks lua-pkg --${{ matrix.lua }} -rlatest hererocks lua-pkg --${{ matrix.lua }} -rlatest
- name: Configure CMake source ${{github.workspace}}/lua-pkg/bin/activate
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DLUA_INCLUDE_DIR="${{github.workspace}}/lua-pkg/include"
- name: Build - name: Configure CMake && build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}} run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DLUA_INCLUDE_DIR="${{github.workspace}}/lua-pkg/include"
cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}}
- name: Test - name: Test
working-directory: ${{github.workspace}}/build working-directory: ${{github.workspace}}/build
env:
STRESS: 1
run: | run: |
source ${{github.workspace}}/lua-pkg/bin/activate ${{github.workspace}}/lua-pkg/bin/lua ../tests/lua/run_tests
STRESS=1 lua ../tests/lua/run_tests

48
.github/workflows/win_ci.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: build & run tests (Win)
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
fail-fast: false
matrix:
build-type: [Release] # Debug
lua: ["lua 5.1", "lua 5.2", "lua 5.3", "luajit 2.0"]
os: ["windows-2016"]
platform: [
{"forLua": "vs_32", "forCMake": "Win32"},
{"forLua": "vs_64", "forCMake": "x64"},
]
exclude:
- lua: "luajit 2.0"
platform: {"forLua": "vs_32", "forCMake": "Win32"}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Setup env
run: |
pip install hererocks
hererocks lua-pkg --${{ matrix.lua }} -rlatest --target ${{matrix.platform.forLua}}
cmd ${{github.workspace}}\lua-pkg\bin\activate
- name: Configure CMake & build
run: |
cmake -A ${{matrix.platform.forCMake}} -B ${{github.workspace}}\build -DLUA_INCLUDE_DIR="${{github.workspace}}/lua-pkg/include" -DLUA_LIBRARY="${{github.workspace}}/lua-pkg/lib/lua*.lib"
cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}}
- name: Test
working-directory: ${{github.workspace}}/build
env:
STRESS: 1
run: |
${{github.workspace}}/lua-pkg/bin/lua ../tests/lua/run_tests

View File

@ -41,8 +41,8 @@ FILE(GLOB SOURCES src/cpp/*.cpp src/cpp/*.h)
FILE(GLOB LUA_SOURCES src/lua/*.lua) FILE(GLOB LUA_SOURCES src/lua/*.lua)
add_library(effil SHARED ${SOURCES}) add_library(effil SHARED ${SOURCES})
if (WIN32 OR WIN64)
target_link_libraries(effil ${LUA_LIBRARY}) target_link_libraries(effil ${LUA_LIBRARY})
if (WIN32)
set_target_properties(effil PROPERTIES set_target_properties(effil PROPERTIES
PREFIX "" PREFIX ""
SUFFIX .dll) SUFFIX .dll)

View File

@ -47,8 +47,6 @@ test.channel_stress.with_multiple_threads = function ()
end end
end end
-- TODO: fix it for Windows
if not os.getenv("APPVEYOR") then
test.channel_stress.timed_read = function () test.channel_stress.timed_read = function ()
local chan = effil.channel() local chan = effil.channel()
local delayed_writer = function(channel, delay) local delayed_writer = function(channel, delay)
@ -60,7 +58,7 @@ if not os.getenv("APPVEYOR") then
local function check_time(real_time, use_time, metric, result) local function check_time(real_time, use_time, metric, result)
local start_time = os.time() local start_time = os.time()
test.equal(chan:pop(use_time, metric), result) test.equal(chan:pop(use_time, metric), result)
test.almost_equal(os.time(), start_time + real_time, 1) test.almost_equal(os.time(), start_time + real_time, 2)
end end
check_time(2, 2, nil, nil) -- second by default check_time(2, 2, nil, nil) -- second by default
check_time(2, 2, 's', nil) check_time(2, 2, 's', nil)
@ -70,7 +68,6 @@ if not os.getenv("APPVEYOR") then
test.equal(chan:pop(10), "hello!") test.equal(chan:pop(10), "hello!")
test.is_true(os.time() < start_time + 10) test.is_true(os.time() < start_time + 10)
end end
end
-- regress for channel returns -- regress for channel returns
test.channel_stress.retun_tables = function () test.channel_stress.retun_tables = function ()