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 continuous integration #93

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
29 changes: 29 additions & 0 deletions .github/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"config": [
{
"name": "Linux GCC 11",
"compiler": "gcc",
"version": "11",
"os": "ubuntu-22.04"
},
{
"name": "Linux Clang 14",
"compiler": "clang",
"version": "14",
"os": "ubuntu-22.04"
},
{
"name": "macOS apple-clang 13.0.1",
"compiler": "apple-clang",
"version": "13.0.1",
"os": "macos-11"
},
{
"name": "Windows VS2019",
"compiler": "Visual Studio",
"version": "16",
"os": "windows-2019",
"cmake_toolset": "Visual Studio 16 2019"
}
]
}
112 changes: 112 additions & 0 deletions .github/workflows/adobe_source_libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build and Tests

on:
pull_request:
push:
branches:
- main

jobs:
generate-matrix:
name: Generate job matrix
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2

- name: Generate job matrix
id: set-matrix
# Note: The json in this variable must be a single line for parsing to succeed.
run: echo "::set-output name=matrix::$(cat .github/matrix.json | scripts/flatten_json.py)"

builds:
needs: generate-matrix
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
name: ${{ matrix.config.name }}

steps:
- uses: actions/checkout@v2

- name: Install dependencies (macos)
if: ${{ startsWith(matrix.config.os, 'macos') }}
run: |
brew install ninja
shell: bash

- name: Install dependencies (ubuntu)
if: ${{ startsWith(matrix.config.os, 'ubuntu') }}
run: |
sudo apt-get install -y ninja-build
shell: bash

- name: Install dependencies (Windows)
if: ${{ startsWith(matrix.config.os, 'windows') }}
run: |
choco install --yes ninja
shell: cmd

- name: Set enviroment variables (Linux+GCC)
if: ${{ matrix.config.compiler == 'gcc' }}
shell: bash
run: |
echo "CC=gcc-${{matrix.config.version}}" >> $GITHUB_ENV
echo "CXX=g++-${{matrix.config.version}}" >> $GITHUB_ENV

- name: Set enviroment variables (Linux+Clang)
if: ${{ matrix.config.compiler == 'clang' }}
shell: bash
run: |
echo "CC=clang-${{matrix.config.version}}" >> $GITHUB_ENV
echo "CXX=clang++-${{matrix.config.version}}" >> $GITHUB_ENV

- name: Set enviroment variables (MacOS)
if: ${{ matrix.config.compiler == 'apple-clang' }}
shell: bash
run: |
echo "CC=$(brew --prefix llvm@13)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm@13)/bin/clang++" >> $GITHUB_ENV

- name: Configure (Ubuntu)
if: ${{ startsWith(matrix.config.os, 'ubuntu') }}
shell: bash
run: |
mkdir ../build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23

- name: Configure (MacOS)
if: ${{ startsWith(matrix.config.os, 'macos') }}
shell: bash
run: |
mkdir ../build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23

- name: Configure (Windows)
if: ${{ startsWith(matrix.config.os, 'windows') }}
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir ..\build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23

- name: Build (Unix)
if: ${{ startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos') }}
shell: bash
run: |
cmake --build ../build/

- name: Build (windows)
if: ${{ startsWith(matrix.config.os, 'windows') }}
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake --build ../build/

- name: Test
shell: bash
run: |
cd ../build/
ctest
8 changes: 8 additions & 0 deletions scripts/flatten_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python

import functools as ft
import json
import sys

input = ft.reduce(lambda acc, i: acc + i, sys.stdin, "")
print(json.dumps(json.loads(input), separators=(',', ':')))