Skip to content

Commit

Permalink
Add GHA CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed May 30, 2024
1 parent 844e3f3 commit 50319da
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 21 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: CI

on:
pull_request:
push:
branches:
- master
- develop
- feature/**
- pr/**

concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true

jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- compiler: g++-7
cxxstd: "17"
os: ubuntu-20.04
install: g++-7
- compiler: g++-8
cxxstd: "17"
os: ubuntu-20.04
install: g++-8
- compiler: g++-9
cxxstd: "17"
os: ubuntu-20.04
- compiler: g++-10
cxxstd: "17"
os: ubuntu-20.04
install: g++-10
- compiler: g++-11
cxxstd: "17"
os: ubuntu-22.04
install: g++-11
- compiler: g++-12
cxxstd: "17,20"
os: ubuntu-22.04
install: g++-12
- compiler: g++-13
cxxstd: "17,20"
os: ubuntu-24.04
install: g++-13
- compiler: clang++-6.0
cxxstd: "17"
os: ubuntu-18.04
install: clang-6.0
- compiler: clang++-7
cxxstd: "17"
os: ubuntu-18.04
install: clang-7
- compiler: clang++-8
cxxstd: "17"
os: ubuntu-20.04
install: clang-8
- compiler: clang++-9
cxxstd: "17"
os: ubuntu-20.04
install: clang-9
- compiler: clang++-10
cxxstd: "17"
os: ubuntu-20.04
- compiler: clang++-11
cxxstd: "17"
os: ubuntu-20.04
- compiler: clang++-12
cxxstd: "17"
os: ubuntu-20.04
- compiler: clang++-13
cxxstd: "17,20"
os: ubuntu-22.04
install: clang-13
- compiler: clang++-14
cxxstd: "17,20"
os: ubuntu-22.04
install: clang-14
- compiler: clang++-15
install: clang-15
cxxstd: "17,20"
os: ubuntu-22.04
- compiler: clang++-16
install: clang-16
cxxstd: "17,20"
os: ubuntu-24.04
- compiler: clang++-17
install: clang-17
cxxstd: "17,20"
os: ubuntu-24.04
- compiler: clang++-18
install: clang-18
cxxstd: "17,20"
os: ubuntu-24.04
# macos
- compiler: clang++
os: macos-12
cxxstd: "17,20"
- compiler: clang++
os: macos-13
cxxstd: "17,20"
- compiler: clang++
os: macos-14
cxxstd: "17,20"

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

steps:
- uses: actions/checkout@v3

- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}

- name: Build and Run tests
run: |
mkdir build
cd build
standards=$(sed 's/,/ /g' <<<"${{matrix.cxxstd}}")
variants="Debug Release"
err=0
for standard in ${standards} ; do
for variant in ${variants} ; do
if [[ err -ne 0 ]] ; then
echo "skipping: ${standard} ${variant}"
else
echo "running: ${standard} ${variant}"
cmake --fresh --config=${variant} -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${standard} ..
cmake --build . --verbose
cd test
./main
cd -
err=$?
fi
done
done
[[ $err -ne 0 ]] && false || "true"
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ add_library(lazycsv INTERFACE)
target_include_directories(lazycsv INTERFACE include/)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall -Wfatal-errors -Wextra -Wnon-virtual-dtor -pedantic)

add_subdirectory(test)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Build Status](https://travis-ci.com/ashtum/lazycsv.svg?branch=master)](https://travis-ci.com/ashtum/lazycsv)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/ashtum/lazycsv.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ashtum/lazycsv/context:cpp)
[![CI](https://github.com/ashtum/lazycsv/actions/workflows/ci.yml/badge.svg)](https://github.com/ashtum/lazycsv/actions/workflows/ci.yml)

![lazycsv](img/logo.png)

Expand Down
10 changes: 6 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
add_executable(driver main.cpp)
add_executable(main main.cpp)

target_link_libraries(driver lazycsv)
target_link_libraries(main lazycsv)

target_include_directories(driver SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/doctest)
target_include_directories(main SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/doctest)

add_custom_command(
TARGET driver
TARGET main
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/inputs
${CMAKE_CURRENT_BINARY_DIR}/inputs)

add_test(main main)

0 comments on commit 50319da

Please sign in to comment.