Skip to content

Commit

Permalink
GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Feb 16, 2023
1 parent 6fd5883 commit b9a4761
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 99 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) Borislav Stanimirov
# SPDX-License-Identifier: MIT
#
name: Test
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
type: [Debug, RelWithDebInfo]
steps:
- name: Clone
uses: actions/checkout@v3
- name: VC Vars
# Setup vcvars on Windows
# MSVC's address sanitizer attaches dependencies to several DLLs which are not in PATH
# vcvars will add them to PATH and allow msvc asan executables to run
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DSAN_ADDR=1
- name: Build
run: cmake --build . --config ${{ matrix.type }}
- name: Test
run: ctest -C ${{ matrix.type }} --output-on-failure
- name: Example
run: cmake --build . --config Release --target=picobench-run-example-basic
# TODO: ./picobench "sleep 0.3" "sleep 0.22"
97 changes: 0 additions & 97 deletions .travis.yml

This file was deleted.

17 changes: 15 additions & 2 deletions dev.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,18 @@ else()
set(icm_compiler_flags "-Wall -Wextra")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${icm_compiler_flags}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${icm_compiler_flags}")
if(SAN_ADDR)
if(MSVC)
set(icm_san_flags "/fsanitize=address")
elseif(APPLE)
# apple clang doesn't support the leak sanitizer
set(icm_san_flags "-fsanitize=address,undefined -pthread -g")
else()
set(icm_san_flags "-fsanitize=address,undefined,leak -pthread -g")
endif()
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${icm_compiler_flags} ${icm_san_flags}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${icm_compiler_flags} ${icm_san_flags}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${icm_san_flags}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${icm_san_flags}")
4 changes: 4 additions & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ macro(pb_example name)
add_executable(${tgt} ${ARGN})
target_link_libraries(${tgt} picobench::picobench)
set_target_properties(${tgt} PROPERTIES FOLDER example)
add_custom_target(
picobench-run-example-${name}
COMMAND ${tgt}
)
endmacro()

pb_example(basic basic.cpp)
Expand Down

0 comments on commit b9a4761

Please sign in to comment.