base on miniconda docker image #7
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: | | |
mamba env list | |
mamba install -c conda-forge geant4=${{ matrix.geant4-version }} | |
mamba 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: | | |
mamba env list | |
mamba install -c conda-forge zlib | |
mamba list | |
- name: pip install the package | |
run: | | |
export CMAKE_PREFIX_PATH=${CONDA_PREFIX} | |
mamba env list | |
mamba list | |
pip install .[test] | |
- name: Check imports | |
run: | | |
python -c "import geant4_python_application; geant4_python_application.Application()" | |
- 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: | | |
python -m pytest -vv tests --reruns 3 --reruns-delay 30 --only-rerun "(?i)http|timeout|connection|socket|resolve" |