Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI workflow for GitHub Actions #3

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

env:
PROJECT: OPTIONAL_FUN_LITE

on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

workflow_dispatch:

jobs:
gcc:
strategy:
matrix:
version: [9, 10, 11]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install GCC ${{ matrix.version }}
run: sudo apt-get install -y gcc-${{ matrix.version }} g++-${{ matrix.version }}

- name: Configure tests
env:
CXX: g++-${{ matrix.version }}
run: cmake -S . -B build
-D CMAKE_BUILD_TYPE:STRING=Release
-D ${{ env.PROJECT }}_OPT_SELECT_NONSTD=ON
-D ${{ env.PROJECT }}_OPT_BUILD_TESTS=ON
-D ${{ env.PROJECT }}_OPT_BUILD_EXAMPLES=OFF

- name: Build tests
run: cmake --build build -j 4

- name: Run tests
working-directory: build
run: ctest --output-on-failure -j 4

clang:
strategy:
matrix:
version: [11, 12]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Clang ${{ matrix.version }}
run: sudo apt-get install -y clang-${{ matrix.version }}

- name: Configure tests
env:
CXX: clang-${{ matrix.version }}
run: cmake -S . -B build
-D CMAKE_CXX_COMPILER=clang++
-D CMAKE_BUILD_TYPE:STRING=Release
-D ${{ env.PROJECT }}_OPT_SELECT_NONSTD=ON
-D ${{ env.PROJECT }}_OPT_BUILD_TESTS=ON
-D ${{ env.PROJECT }}_OPT_BUILD_EXAMPLES=OFF

- name: Build tests
run: cmake --build build -j 4

- name: Run tests
working-directory: build
run: ctest --output-on-failure -j 4

msvc:
strategy:
matrix:
os: [windows-2019, windows-2022]

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

steps:
- uses: actions/checkout@v3

- name: Configure tests
run: cmake -S . -B build
-D ${{ env.PROJECT }}_OPT_SELECT_NONSTD=ON
-D ${{ env.PROJECT }}_OPT_BUILD_TESTS=ON
-D ${{ env.PROJECT }}_OPT_BUILD_EXAMPLES=OFF

- name: Build tests
run: cmake --build build --config Release -j 4

- name: Run tests
working-directory: build
run: ctest -C Release --output-on-failure -j 4