rename action #2
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 | |
python-version: | |
- '3.9' | |
- '3.10' | |
- '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 | |
# # 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 | |
mkdir build && cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${CONDA_PREFIX} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} | |
make -j$(nproc) install | |
- name: Install the python bindings | |
run: python -m pip install .[test] | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
limit-access-to-actor: false | |
- name: Run tests | |
run: | | |
export PYTHONPATH=${CONDA_PREFIX}/lib | |
python -m pytest -vv tests |