Skip to content

Commit

Permalink
allow to chose building geant4 and dd from actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaf-tahmid-chowdhury committed Dec 11, 2023
1 parent 2a1133e commit fca55ad
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 51 deletions.
28 changes: 24 additions & 4 deletions .github/actions/upstream-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
geant4_version:
description: Version of Geant4
required: false
default: 11.1.2
default: ''
ubuntu_version:
description: Underlying OS version
required: false
Expand All @@ -28,7 +28,7 @@ inputs:
double_down_version:
description: Version of Double Down
required: false
default: v1.1.0
default: ''

runs:
using: "composite"
Expand All @@ -40,14 +40,34 @@ runs:
username: ${{ github.repository_owner }}
password: ${{ inputs.token }}

- name: Configure docker image tag
shell: bash
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ inputs.ubuntu_version }}-${{ inputs.compiler}}-hdf5_${{ inputs.hdf5_version}}-moab_${{ inputs.moab_version }}
if [[ -n "${{ inputs.geant4_version }}" ]]; then
image_base_tag=${image_base_tag}-geant4_${{ inputs.geant4_version }}
GEANT4=ON
else
GEANT4=OFF
fi
if [[ -n "${{ inputs.double_down_version }}" ]]; then
image_base_tag=${image_base_tag}-double_down_${{ inputs.double_down_version }}
DOUBLE_DOWN=ON
else
DOUBLE_DOWN=OFF
fi
echo "image_base_tag=${image_base_tag}" >> $GITHUB_ENV
echo "GEANT4=${GEANT4}" >> $GITHUB_ENV
echo "DOUBLE_DOWN=${DOUBLE_DOWN}" >> $GITHUB_ENV
- name: Installing Dependencies in Docker image
uses: firehed/multistage-docker-build-action@v1
with:
repository: ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ inputs.ubuntu_version }}-${{ inputs.compiler}}-geant4_${{ inputs.geant_version }}-hdf5_${{ inputs.hdf5_version }}-moab_${{ inputs.moab_version }}
repository: ${{ env.image_base_tag }}
stages: base, external_deps, hdf5, moab, dagmc
server-stage: dagmc_test
quiet: false
parallel: true
tag-latest-on-default: false
dockerfile: CI/Dockerfile
build-args: COMPILER=${{ inputs.compiler }}, Geant4_VERSION=${{ inputs.geant4_version }}, UBUNTU_VERSION=${{ inputs.ubuntu_version }}, HDF5_VERSION=${{ inputs.hdf5_version }}, MOAB_VERSION=${{ inputs.moab_version }}, DOUBLE_DOWN_VERSION=${{ inputs.double_down_version }}
build-args: UBUNTU_VERSION=${{ inputs.ubuntu_version }}, COMPILER=${{ inputs.compiler }}, HDF5_VERSION=${{ inputs.hdf5_version }}, MOAB_VERSION=${{ inputs.moab_version }}, GEANT4=${{ env.GEANT4 }}, GEANT4_VERSION=${{ inputs.geant4_version }}, DOUBLE_DOWN=${{ env.DOUBLE_DOWN }}, DOUBLE_DOWN_VERSION=${{ inputs.double_down_version }}
64 changes: 45 additions & 19 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ jobs:
ubuntu_version : [
20.04,
22.04,
]
]
compiler : [
gcc,
clang,
]
]
hdf5_version : [
1.10.4,
]
moab_version : [
5.3.0,
]
double_down_version : [
v1.1.0,
]
geant4_version : [
10.7.4,
11.1.2
]
double_down_version : [

]

name: Installing Dependencies, Building DAGMC and running tests
steps:
Expand All @@ -57,17 +57,36 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Configure docker image tag and build arguments
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}
if [[ -n "${{ matrix.geant4_version }}" ]]; then
image_base_tag=${image_base_tag}-geant4_${{ matrix.geant4_version }}
GEANT4=ON
else
GEANT4=OFF
fi
if [[ -n "${{ matrix.double_down_version }}" ]]; then
image_base_tag=${image_base_tag}-double_down_${{ matrix.double_down_version }}
DOUBLE_DOWN=ON
else
DOUBLE_DOWN=OFF
fi
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"
echo "GEANT4=${GEANT4}" >> "$GITHUB_ENV"
echo "DOUBLE_DOWN=${DOUBLE_DOWN}" >> "$GITHUB_ENV"
- name: Installing Dependencies in Docker image
uses: firehed/multistage-docker-build-action@v1
with:
repository: ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-geant4_${{ matrix.geant4_version }}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}
repository: $image_base_tag
stages: base, external_deps, hdf5, moab, dagmc
server-stage: dagmc_test
quiet: false
parallel: true
tag-latest-on-default: ${{ env.tag-latest-on-default }}
tag-latest-on-default: $tag-latest-on-default
dockerfile: CI/Dockerfile
build-args: DOUBLE_DOWN_VERSION=${{ matrix.double_down_version}}, Geant4_VERSION=${{ matrix.geant4_version }}, COMPILER=${{ matrix.compiler }}, UBUNTU_VERSION=${{ matrix.ubuntu_version }}, HDF5_VERSION=${{ matrix.hdf5_version }}, MOAB_VERSION=${{ matrix.moab_version }}
build-args: UBUNTU_VERSION=${{ matrix.ubuntu_version }}, COMPILER=${{ matrix.compiler }}, HDF5_VERSION=${{ matrix.hdf5_version }}, MOAB_VERSION=${{ matrix.moab_version }}, GEANT4=$GEANT4, GEANT4_VERSION=${{ matrix.geant4_version }}, DOUBLE_DOWN=$DOUBLE_DOWN, DOUBLE_DOWN_VERSION=${{ matrix.double_down_version}}


push_stable_ci_img:
Expand All @@ -79,24 +98,24 @@ jobs:
ubuntu_version : [
20.04,
22.04,
]
]
compiler : [
gcc,
clang,
]
]
hdf5_version : [
1.10.4,
]
moab_version : [
5.3.0,
]
double_down_version : [
v1.1.0,
]
geant4_version : [
10.7.4,
11.1.2
]
double_down_version : [

]

name: Pushing final images
steps:
Expand All @@ -108,21 +127,28 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Store image name
- name: Configure docker image tag
if: ${{ github.repository_owner == 'svalinn' }}
run: |
echo "image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler }}-geant4_${{ matrix.geant4_version }}-hdf5_${{ matrix.hdf5_version }}-moab_${{ matrix.moab_version }}" >> "$GITHUB_ENV"
image_base_tag=ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}
if [[ -n "${{ matrix.geant4_version }}" ]]; then
image_base_tag=${image_base_tag}-geant4_${{ matrix.geant4_version }}
fi
if [[ -n "${{ matrix.double_down_version }}" ]]; then
image_base_tag=${image_base_tag}-double_down_${{ matrix.double_down_version }}
fi
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"
- name: Push Image as latest img
if: ${{ github.repository_owner == 'svalinn' && github.ref == 'refs/heads/develop' }}
uses: akhilerm/[email protected]
with:
src: ${{ env.image_base_tag }}/dagmc:latest
dst: ${{ env.image_base_tag }}:latest
src: $image_base_tag/dagmc:latest
dst: $image_base_tag:latest

- name: Push Image as latest img
if: ${{ github.repository_owner == 'svalinn' && github.ref == 'refs/heads/develop' }}
uses: akhilerm/[email protected]
with:
src: ${{ env.image_base_tag }}:latest
dst: ${{ env.image_base_tag }}:stable
src: $image_base_tag:latest
dst: $image_base_tag:stable
11 changes: 7 additions & 4 deletions .github/workflows/linux_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
ubuntu_version : [
20.04,
22.04,
]
]
compiler : [
gcc,
clang,
Expand All @@ -53,9 +53,12 @@ jobs:
geant_version : [
10.7.4,
]
double_down_version : [

]

container:
image: ghcr.io/svalinn/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-geant4_${{ matrix.geant_version }}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}/moab:latest
image: ghcr.io/svalinn/dagmc-ci-ubuntu-${{ matrix.ubuntu_version }}-${{ matrix.compiler}}-hdf5_${{ matrix.hdf5_version}}-moab_${{ matrix.moab_version }}${{ matrix.geant_version != '' && '-geant4_' || '' }}${{ matrix.geant_version }}${{ matrix.double_down_version != '' && '-double_down_' || '' }}${{ matrix.double_down_version }}/moab:latest

steps:
- name: Checkout repository
Expand All @@ -70,7 +73,7 @@ jobs:
cd ./build
git config --global --add safe.directory $GITHUB_WORKSPACE
cmake ../ -DMOAB_DIR=${moab_install_dir} \
-DBUILD_GEANT4=ON \
-DBUILD_GEANT4=${{ matrix.geant_version != '' && 'ON' || 'OFF' }} \
-DGEANT4_DIR=${geant4_install_dir} \
-DBUILD_CI_TESTS=ON \
-DBUILD_MW_REG_TESTS=OFF \
Expand All @@ -80,7 +83,7 @@ jobs:
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_INSTALL_PREFIX=${install_dir}/dagmc \
-DDOUBLE_DOWN=ON \
-DDOUBLE_DOWN=${{ matrix.double_down_version != '' && 'ON' || 'OFF' }} \
-DCMAKE_CXX_FLAGS="-Werror=reorder" \
-Ddd_ROOT=${double_down_install_dir} && \
make -j2 && \
Expand Down
54 changes: 30 additions & 24 deletions CI/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
ARG UBUNTU_VERSION=22.04
ARG HDF5_VERSION=1.10.4
ARG EMBREE_VERSION=v4.0.1
ARG Geant4_VERSION=11.1.2
ARG GEANT4=ON
ARG GEANT4_VERSION=11.1.2
ARG MOAB_VERSION=5.3.0
ARG DOUBLE_DOWN=ON
ARG DOUBLE_DOWN_VERSION=v1.1.0
ARG CI_JOBS=4

Expand All @@ -29,25 +31,27 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install Build Dependencies
RUN apt-get update --yes && \
apt-get install --yes \
git \
wget \
autoconf \
clang \
cmake \
g++ \
gcc \
gfortran \
libhdf5-dev \
libtool \
libeigen3-dev\
python3-numpy \
python3 \
python3-pip \
python3-setuptools \
python3-dev \
libpython3-dev \
software-properties-common && \
git \
wget \
autoconf \
clang \
cmake \
g++ \
gcc \
gfortran \
libhdf5-dev \
libtool \
libeigen3-dev\
python3-numpy \
python3 \
python3-pip \
python3-setuptools \
python3-dev \
libpython3-dev \
software-properties-common && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10 && \
pip3 install "cython<3";

ARG build_dir
Expand All @@ -69,22 +73,22 @@ ENV CXX=clang++
FROM compiler-${COMPILER} as external_deps

# accessing gloabl ARGs in build stage
ARG Geant4_VERSION
ARG GEANT4_VERSION
ARG EMBREE_VERSION
ARG install_dir
ARG build_dir
ARG CI_JOBS
ARG CXX
ARG CC

ENV geant4_basename=geant4-v${Geant4_VERSION}
ENV geant4_basename=geant4-v${GEANT4_VERSION}
ENV geant4_tarball=${geant4_basename}.tar.gz
ENV geant4_build_dir=${build_dir}/geant4
ENV geant4_install_dir=${install_dir}/geant4

RUN mkdir -p ${geant4_build_dir}/build && \
cd ${geant4_build_dir} && \
wget https://gitlab.cern.ch/geant4/geant4/-/archive/v${Geant4_VERSION}/${geant4_tarball} --no-check-certificate && \
wget https://gitlab.cern.ch/geant4/geant4/-/archive/v${GEANT4_VERSION}/${geant4_tarball} --no-check-certificate && \
tar -xzf ${geant4_tarball} && \
cd build && \
cmake ../${geant4_basename} \
Expand Down Expand Up @@ -210,6 +214,8 @@ ARG install_dir
ARG build_dir
ARG CXX
ARG CC
ARG GEANT4
ARG DOUBLE_DOWN

ENV dagmc_build_dir=${build_dir}/dagmc
ENV dagmc_install_dir=${install_dir}/dagmc
Expand All @@ -224,7 +230,7 @@ RUN mkdir -p ${dagmc_build_dir}/build && \
cd build && \
cmake ../ \
-DMOAB_DIR=${moab_install_dir} \
-DBUILD_GEANT4=ON \
-DBUILD_GEANT4=${GEANT4} \
-DGEANT4_DIR=${geant4_install_dir} \
-DBUILD_CI_TESTS=ON \
# reg tests disabled see issue https://github.com/svalinn/DAGMC/issues/858
Expand All @@ -235,7 +241,7 @@ RUN mkdir -p ${dagmc_build_dir}/build && \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_INSTALL_PREFIX=${dagmc_install_dir} \
-DDOUBLE_DOWN=ON \
-DDOUBLE_DOWN=${DOUBLE_DOWN} \
-Ddd_ROOT=${double_down_install_dir} && \
make -j${CI_JOBS} && \
make install
Expand Down

0 comments on commit fca55ad

Please sign in to comment.