Skip to content

Commit

Permalink
Migrate from Travis to GitHub Actions.
Browse files Browse the repository at this point in the history
* WIP

* Tweak things

* Add gcc-10 job

* Add Clang workflows

* WIP

* Fix Clang build

* WIP

* More small fixes

* Migrate releases

* More tweaks to Clang and deployments

* Try to fix Clang 10 build

* Try to debug Clang build

* Ditch Travis

* Include Catch more directly

* Fix Clang build

* Remove deployment configurations
  • Loading branch information
tmadden committed Dec 30, 2020
1 parent c86708e commit 07946a6
Show file tree
Hide file tree
Showing 27 changed files with 477 additions and 364 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Clang

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:

clang-5:
runs-on: ubuntu-18.04

strategy:
matrix:
config: [Debug, Release]

steps:
- uses: actions/checkout@v2

- name: Install
run: |
sudo apt install clang-5.0
sudo pip install gcovr
- name: Configure
run: |
export CC=`which clang-5.0`
export CXX=`which clang++-5.0`
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} .
- name: Build
run: >
cmake --build build --config ${{matrix.config}}
--target unit_test_runner -j4
cmake --build build --config ${{matrix.config}}
--target single_header_tester
- name: Test
run: |
cd build
ctest --build-config ${{matrix.config}}
clang-10:
runs-on: ubuntu-20.04

strategy:
matrix:
config: [Debug, Release]

steps:
- uses: actions/checkout@v2

- name: Install
run: |
sudo pip install gcovr
- name: Configure
run: |
export CC=`which clang-10`
export CXX=`which clang++-10`
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} .
- name: Build
run: >
cmake --build build --config ${{matrix.config}}
--target unit_test_runner -j4
cmake --build build --config ${{matrix.config}}
--target single_header_tester
- name: Test
run: |
cd build
ctest --build-config ${{matrix.config}}
- name: Upload coverage report
run: bash <(curl -s https://codecov.io/bash) -X gcov
76 changes: 76 additions & 0 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: GCC

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:

gcc-7:
runs-on: ubuntu-20.04

strategy:
matrix:
config: [Debug, Release]

steps:
- uses: actions/checkout@v2

- name: Configure
run: |
export CC=`which gcc-7`
export CXX=`which g++-7`
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} .
- name: Build
run: >
cmake --build build --config ${{matrix.config}}
--target unit_test_runner -j4
cmake --build build --config ${{matrix.config}}
--target single_header_tester
- name: Test
run: |
cd build
ctest --build-config ${{matrix.config}}
gcc-10:
runs-on: ubuntu-20.04

strategy:
matrix:
config: [Debug, Release]

steps:
- uses: actions/checkout@v2

- name: Install
run: |
sudo apt install gcc-10
- name: Configure
run: |
export CC=`which gcc-10`
export CXX=`which g++-10`
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} .
- name: Build
run: >
cmake --build build --config ${{matrix.config}}
--target unit_test_runner -j4
cmake --build build --config ${{matrix.config}}
--target single_header_tester
- name: Test
run: |
cd build
ctest --build-config ${{matrix.config}}
28 changes: 28 additions & 0 deletions .github/workflows/latest-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Latest Deployment

on:
push:
branches:
- master

jobs:

alia-single-header:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Build
run: |
python3 scripts/generate-distributables.py
mkdir build
mv alia.hpp build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: build
CLEAN: true
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml → .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows
name: MSVC

on:
push:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.config}} .
- name: Build tests
- name: Build
run: >
cmake --build build --config ${{matrix.config}}
--target unit_test_runner -j4
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/release-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release Deployment

on:
push:
tags:
- '*'

jobs:

alia-single-header:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Build
run: python3 scripts/generate-distributables.py

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: alia.hpp
tag: ${{ github.ref }}
overwrite: true
17 changes: 17 additions & 0 deletions .github/workflows/test-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test Deployment

on:
pull_request:
branches:
- master

jobs:

alia-single-header:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Build
run: python3 scripts/generate-distributables.py
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

30 changes: 12 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
cmake_minimum_required(VERSION 3.14)
project(alia)

include(FetchContent)

# Include Catch.
FetchContent_Declare(
catch
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.0
)
FetchContent_MakeAvailable(catch)

# Detect the compiler.
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(IS_CLANG true)
Expand Down Expand Up @@ -57,9 +47,6 @@ elseif(IS_MSVC)
# Disable "unreferenced local function has been removed".
# (As far as I can tell, this warning seems to be broken.)
add_compile_options(/wd4505)
# On VS2015, disable "unreachable code".
# (Again, this warning seems to be broken.)
add_compile_options(/wd4702)
elseif(IS_CLANG)
add_compile_options(-Wall -Werror)
endif()
Expand All @@ -79,24 +66,31 @@ include_directories(src)
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "src/*.cpp")
add_library(alia STATIC ${SRC_FILES})

# Download Catch.
file(DOWNLOAD
https://github.com/catchorg/Catch2/releases/download/v2.13.4/catch.hpp
${CMAKE_CURRENT_BINARY_DIR}/catch2/catch.hpp)

# Add the unit test runner.
include_directories(src)
file(GLOB_RECURSE UNIT_TEST_FILES CONFIGURE_DEPENDS "unit_tests/*.cpp")
add_executable(unit_test_runner ${UNIT_TEST_FILES})
target_link_libraries(unit_test_runner alia Catch2::Catch2)
target_link_libraries(unit_test_runner alia)
target_include_directories(unit_test_runner
PRIVATE ${PROJECT_SOURCE_DIR}/unit_tests)
PRIVATE ${PROJECT_SOURCE_DIR}/unit_tests ${CMAKE_CURRENT_BINARY_DIR})

# Create another version of the unit tests that run against the single-header
# version of the library.
# (Note that this comes as an empty test and requires some external setup to
# run properly. This is normally only done within Travis.)
# run properly. This is normally only done within CI.)
file(GLOB_RECURSE SINGLE_HEADER_TEST_FILES CONFIGURE_DEPENDS
"single_header_tests/*.cpp")
add_executable(single_header_tester ${SINGLE_HEADER_TEST_FILES})
target_link_libraries(single_header_tester alia Catch2::Catch2)
target_link_libraries(single_header_tester alia)
target_include_directories(single_header_tester
PRIVATE ${PROJECT_SOURCE_DIR}/single_header_tests)
PRIVATE
${PROJECT_SOURCE_DIR}/single_header_tests
${CMAKE_CURRENT_BINARY_DIR})

# Add tests that are supposed to cause compilation errors.
# Specifically, find all .cpp files in the compilation_tests/ directory and
Expand Down

0 comments on commit 07946a6

Please sign in to comment.