add github ci (#40)

* add github ci with mamba

* disable python bindings from ci

---------

Co-authored-by: Bechir <bechir.brahem420@gmail.com>
This commit is contained in:
Bechir Braham 2024-04-03 11:00:28 +02:00 committed by GitHub
parent 6644406535
commit 9413efa9e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 88 additions and 0 deletions

51
.github/workflows/common-workflow.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Build and run tests
on:
workflow_call:
inputs:
use-system-libraries: # the variable you can use in place of a matrix
required: true
type: string
default: OFF
build-type:
required: true
type: string
default: Debug
use-python-bindings:
# required: true
type: string
default: OFF
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
if: ${{ contains(inputs.use-system-libraries, 'ON')}}
with:
micromamba-version: '1.5.6-0' # any version from https://github.com/mamba-org/micromamba-releases
environment-file: aare-environment.yml
init-shell: bash
cache-environment: true
post-cleanup: 'all'
- name: build
shell: bash -el {0}
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{inputs.build-type}} -DAARE_PYTHON_BINDINGS=${{inputs.use-python-bindings}} -DAARE_SYSTEM_LIBRARIES=${{inputs.use-system-libraries}}
cmake --build . -j
- name: run tests
run: |
cd build/
./run_tests
- name: run examples
# find all examples in build/examples and run them
run: |
pwd
export PROJECT_ROOT_DIR="."
ls build/examples/*_example
find build/examples -name "*_example" | xargs -I {} -n 1 -t bash -c {}

28
.github/workflows/config.yml vendored Normal file
View File

@ -0,0 +1,28 @@
# config file to run multiple jobs in parallel with matrix strategy
name: Config Workflow
on:
push:
jobs:
build-and-test:
strategy:
# super important if you want to see all results, even if one fails
# fail-fast is true by default
fail-fast: false
matrix:
use-system-libraries: ["OFF","ON"]
build-type: ["Debug","Release"]
# use-python-bindings: ["OFF","ON"]
# exclude:
# # excludes combinations that are not supported
# - use-python-bindings: "ON"
# use-sanitizers: "ON"
uses: ./.github/workflows/common-workflow.yml # calls the one above
with:
use-system-libraries: ${{ matrix.use-system-libraries }}
build-type: ${{ matrix.build-type }}
# use-python-bindings: ${{ matrix.use-python-bindings }}
secrets: inherit

9
aare-environment.yml Normal file
View File

@ -0,0 +1,9 @@
name: aare
channels:
- conda-forge
- defaults
dependencies:
- fmt
- pybind11
- nlohmann_json
- catch2