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 os: required: true type: string default: ubuntu-latest jobs: build-and-test: name: "Build and test[os: ${{ inputs.os }}, build-type: ${{ inputs.build-type }}, use-system-libraries: ${{ inputs.use-system-libraries }}, use-python-bindings: ${{ inputs.use-python-bindings }}]" runs-on: ${{ inputs.os }} steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} JOB_CONTEXT: ${{ toJson(job) }} STEPS_CONTEXT: ${{ toJson(steps) }} RUNNER_CONTEXT: ${{ toJson(runner) }} run: | echo "$GITHUB_CONTEXT" echo "$JOB_CONTEXT" echo "$STEPS_CONTEXT" echo "$RUNNER_CONTEXT" echo "The job_id is: $GITHUB_JOB" # reference the default environment variables echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables echo "The run id is: $GITHUB_RUN_ID" echo "The GitHub Actor's username is: $GITHUB_ACTOR" echo "GitHub SHA: $GITHUB_SHA" - name: print inputs run: | echo "use-system-libraries: ${{inputs.use-system-libraries}}" echo "build-type: ${{inputs.build-type}}" echo "use-python-bindings: ${{inputs.use-python-bindings}}" - uses: actions/checkout@v4 - 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 if: ${{ inputs.os != 'windows-latest' }} - name: run tests run: | cd build/ dir cd Debug/ dir start run_tests.exe # start /B /WAIT "run_tests.exe" if: ${{ inputs.os == 'windows-latest' }} - name: run examples if: ${{ inputs.os != 'windows-latest' }} # find all examples in build/examples and run them run: | pwd export AARE_ROOT_DIR="$PWD" ls build/examples/*_example # examples to run cd build/examples examples=(raw_example json_example logger_example multiport_example mythen_example) examples+=(numpy_read_example numpy_write_example) for example in "${examples[@]}"; do echo "Running example: $example" ./$example done