Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Add GitHub Action to run tests on pull request
Browse files Browse the repository at this point in the history
Run tests on Apple macOS, MS Windows, and Ubuntu Linux hosts.

macOS-hosted tests are only run on latest, which is currently macOS 10.15.
GH will eventually update latest to macOS 11 and we can look at expanding
to two versions of macOS.

Windows-hosted tests run on Windows Server 2016 and latest.

Ubuntu-hosted tests only run on latest because g++ fails to build argparse
on ubuntu-18.04 (GCC 8) since charconv was added in commit ea2f16d.  But,
Ubuntu-hosted tests do run with g++ and clang++.

Closes p-ranav#128.

Signed-off-by: Sean Robinson <[email protected]>
  • Loading branch information
skrobinson committed Sep 13, 2021
1 parent b0cb28a commit 335e627
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

name: CI

on: pull_request

jobs:

test:

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

strategy:

matrix:

toolchain:
- macos-latest-clang
- ubuntu-latest-clang
- ubuntu-latest-gcc
- windows-2016-msvc
- windows-latest-msvc

include:
- toolchain: macos-latest-clang
os: macos-latest
c_compiler: clang
cxx_compiler: clang++

- toolchain: ubuntu-latest-clang
os: ubuntu-latest
c_compiler: clang
cxx_compiler: clang++

- toolchain: ubuntu-latest-gcc
os: ubuntu-latest
c_compiler: cc
cxx_compiler: g++

- toolchain: windows-latest-msvc
os: windows-latest
c_compiler: msvc
cxx_compiler: msvc

- toolchain: windows-2016-msvc
os: windows-2016
c_compiler: msvc
cxx_compiler: msvc

steps:

- name: Checkout Code
uses: actions/checkout@v2

- name: Configure
working-directory: test
run: cmake -S . -B build
env:
CC: ${{ matrix.c_compiler }}
CXX: ${{ matrix.cxx_compiler }}

- name: Build for ${{ matrix.os }} with ${{ matrix.compiler }}
working-directory: test
run: cmake --build build

- name: Test
if: ${{ ! startsWith(matrix.os, 'windows') }}
working-directory: test/build
run: ./tests

- name: Test (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
working-directory: test/build
run: ./Debug/tests.exe

0 comments on commit 335e627

Please sign in to comment.