comment ctest #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate) | |
required: false | |
default: false | |
pull_request: | |
push: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-test: | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, macos-latest] | |
geant4-version: [11.1.3, 11.0.3] | |
python-version: [3.9, 3.11] | |
runs-on: ${{ matrix.platform }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
- name: Install Geant4 via conda | |
run: | | |
conda env list | |
mamba install -c conda-forge geant4=${{ matrix.geant4-version }} | |
conda list | |
- name: Install additional dependencies (ubuntu) | |
if: matrix.platform == 'ubuntu-latest' | |
# TODO: fix the cmake so it doesn't try to find graphical libraries | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y mesa-common-dev libglu1-mesa-dev python3-dev | |
- name: Install additional dependencies (macos) | |
if: matrix.platform == 'macos-latest' | |
run: | | |
conda env list | |
mamba install -c conda-forge zlib | |
conda list | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
limit-access-to-actor: false | |
# # This doesn't work in the CI for some reason. ctest is somewhat redundant, but it's useful during development. | |
# - name: Build the c++ library and run tests | |
# run: | | |
# cd application | |
# mkdir -p build | |
# cd build | |
# cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON -DCMAKE_PREFIX_PATH=${CONDA_PREFIX} | |
# make | |
# cd tests | |
# ctest | |
- name: Build the c++ library | |
run: | | |
cd application | |
rm -rf build | |
mkdir -p build | |
cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${CONDA_PREFIX} | |
make | |
ls ../lib | |
- name: Install the python bindings | |
run: pip install .[test] | |
- name: Run tests | |
run: | | |
export PYTHONPATH=$PYTHONPATH:$(pwd)/application/lib | |
python -m pytest -vv tests |