Skip to content

update datasets message #128

update datasets message

update datasets message #128

Workflow file for this run

name: Build and Test
on:
schedule:
- cron: 0 */24 * * *
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.head_ref || github.run_id }}
cancel-in-progress: true
env:
GEANT4_VERSION: 11.2.0
XERCES_VERSION: 3.2.4
jobs:
build-geant4:
name: "Geant4 Install - No Datasets"
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
steps:
- uses: lukka/get-cmake@v3.27.9
- name: Cache Xerces-C Installation
id: cache-xerces
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/xerces
key: xerces-${{ matrix.platform }}
- name: Build and Install Xerces-C
if: steps.cache-xerces.outputs.cache-hit != 'true'
run: |
git clone https://github.com/apache/xerces-c.git xerces-source
git -C xerces-source checkout tags/v${{ env.XERCES_VERSION }}
cmake -G Ninja -B xerces-build -S xerces-source -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/xerces -DCMAKE_CXX_STANDARD=20 -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -Dnetwork-accessor=socket -Dtranscoder=iconv -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC
cmake --build xerces-build --parallel $(nproc) --target install
- name: Cache Geant4 Installation
id: cache-geant4
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/geant4
key: geant4-${{ env.GEANT4_VERSION }}-${{ matrix.platform }}
- name: Build and Install Geant4 (without datasets)
if: steps.cache-geant4.outputs.cache-hit != 'true'
run: |
git clone https://github.com/Geant4/geant4.git ${{ github.workspace }}/geant4-source --depth 1 --branch v${{ env.GEANT4_VERSION }}
cmake -G Ninja -B geant4-build -S geant4-source -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/geant4 -DXERCESC_ROOT_DIR=${{ github.workspace }}/xerces -DCMAKE_CXX_STANDARD=20 -DCMAKE_BUILD_TYPE=Release -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_EXAMPLES=OFF -DGEANT4_INSTALL_DATA=OFF -DGEANT4_BUILD_TLS_MODEL=global-dynamic -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC -DGEANT4_USE_SYSTEM_EXPAT=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF
cmake --build geant4-build --parallel $(nproc) --target install
install-geant4-datasets:
name: "Geant4 Datasets"
needs: [build-geant4]
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
steps:
- name: Cache Geant4 Installation
id: cache-geant4
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/geant4
key: geant4-${{ env.GEANT4_VERSION }}-${{ matrix.platform }}
fail-on-cache-miss: true
- name: Cache Geant4 Datasets
id: cache-geant4-data
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/geant4-data
key: geant4-${{ env.GEANT4_VERSION }}-data
enableCrossOsArchive: true
lookup-only: true
- name: Move Geant4 Datasets
if: steps.cache-geant4-data.outputs.cache-hit != 'true'
run: |
source ${{ github.workspace }}/geant4/bin/geant4.sh
geant4-config --install-datasets
geant4-config --check-datasets
mv ${{ github.workspace }}/geant4/share/Geant4/data ${{ github.workspace }}/geant4-data
build-test:
name: "Build and Test"
needs: [install-geant4-datasets]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: lukka/get-cmake@v3.27.9
- name: Cache Xerces-C Installation
id: cache-xerces
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/xerces
key: xerces-${{ matrix.platform }}
fail-on-cache-miss: true
- name: Cache Geant4 Installation
id: cache-geant4
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/geant4
key: geant4-${{ env.GEANT4_VERSION }}-${{ matrix.platform }}
fail-on-cache-miss: true
- name: pip install the package
run: |
source ${{ github.workspace }}/geant4/bin/geant4.sh
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
# test ability to download datasets in one job and use the cache in the others
- name: Cache Geant4 Datasets
if: matrix.python-version != '3.11'
id: cache-geant4-data
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/geant4-data
key: geant4-${{ env.GEANT4_VERSION }}-data
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Move datasets
if: matrix.python-version != '3.11'
run: |
GEANT4_DATA_DIR=$(python -c "import geant4_python_application; print(geant4_python_application.data_dir)")
mkdir -p ${{ github.workspace }}/geant4-data $GEANT4_DATA_DIR
mv ${{ github.workspace }}/geant4-data/* $GEANT4_DATA_DIR
- name: Check import
run: |
python -c "import geant4_python_application; geant4_python_application.Application()"
- name: Run tests
run: |
python -m pytest -vv --reruns 3 --reruns-delay 30 --only-rerun "(?i)http|timeout|connection|socket|resolve"