diff --git a/.github/workflows/common-workflow.yml b/.github/workflows/common-workflow.yml new file mode 100644 index 00000000..46b48b11 --- /dev/null +++ b/.github/workflows/common-workflow.yml @@ -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 {} + + + diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 00000000..820b417f --- /dev/null +++ b/.github/workflows/config.yml @@ -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 + diff --git a/aare-environment.yml b/aare-environment.yml new file mode 100644 index 00000000..ea5c57e2 --- /dev/null +++ b/aare-environment.yml @@ -0,0 +1,9 @@ +name: aare +channels: + - conda-forge + - defaults +dependencies: + - fmt + - pybind11 + - nlohmann_json + - catch2 diff --git a/examples/json_example.cpp b/examples/json_example.cpp index 1541d934..1a552ea9 100644 --- a/examples/json_example.cpp +++ b/examples/json_example.cpp @@ -23,4 +23,4 @@ int main() { test(file, 0); test(file, 2); test(file, 9); -} \ No newline at end of file +}