Skip to content

Commit

Permalink
[test] Set up a GitHub Actions workflow for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Quuxplusone committed Oct 18, 2023
1 parent 574497c commit 3f15da7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and run tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
# Consider changing this to true when your workflow is stable.
fail-fast: true

matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Debug, RelWithDebInfo, Release]
cpp_compiler: [g++, clang++]
cpp_standard: [14, 17, 20, 23]
exclude:
- os: windows-latest
cpp_compiler: clang++
- os: windows-latest
cpp_compiler: g++

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Install Google Test (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libgtest-dev
# Configure CMake in a 'build' subdirectory.
# `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
#
- name: Build and Test
run: |
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cpp_standard }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cd ${{ github.workspace }}/build
make
./bin/utest
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ elseif ("${CMAKE_CXX_STANDARD}" EQUAL 17)
elseif ("${CMAKE_CXX_STANDARD}" EQUAL 20)
check_cxx_compiler_flag("-std=c++20" HAVE_REALFLAG)
check_cxx_compiler_flag("-std=c++2a" HAVE_FAKEFLAG)
check_cxx_compiler_flag("-std:c++latest" HAVE_MSVCFLAG)
check_cxx_compiler_flag("-std:c++20" HAVE_MSVCFLAG)
if (HAVE_REALFLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
elseif (HAVE_FAKEFLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2a")
elseif (HAVE_MSVCFLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++latest")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++20")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++20 support. Please use a different C++ compiler.")
endif()
Expand Down Expand Up @@ -89,7 +89,7 @@ target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${SG14_INCLUDE_DIRECTORY}>
)

add_subdirectory(benchmarks)
# add_subdirectory(benchmarks)
add_subdirectory(test)

install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}_targets)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SG14
[![Build Status](https://travis-ci.org/Quuxplusone/SG14.svg?branch=master)](https://travis-ci.org/Quuxplusone/SG14)
[![Build Status](https://github.com/Quuxplusone/SG14/actions/workflows/ci-tests.yml/badge.svg?branch=master)](https://github.com/Quuxplusone/SG14/actions/workflows/ci-tests.yml)

A library of containers and algorithms pioneered by the ISO C++ Committee's
"Low-Latency and Embedded" study group (SG14). For more information on
Expand Down

0 comments on commit 3f15da7

Please sign in to comment.