Skip to content

Commit

Permalink
standalone-ghci
Browse files Browse the repository at this point in the history
  • Loading branch information
mahf708 committed Sep 28, 2024
1 parent ec75228 commit 6d46d5e
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/standalone-ghci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: ghci

on:
pull_request:
branches: [ main ]
paths:
- 'standalone-ghci/**'
- '.github/workflows/standalone-ghci.yaml'
push:
branches: [ main ]
paths:
- 'standalone-ghci/**'
- '.github/workflows/standalone-ghci.yaml'
tags:
- 'standalone-ghci-*'

env:
GCC_VERSION: "11.4.0"
MPICH_VERSION: "4.2.1"
SZIP_VERSION: "2.1.1"
HDF5_VERSION: "1.12.3"
NETCDFC_VERSION: "4.9.2"
NETCDFCXX_VERSION: "4.2"
NETCDFFORTRAN_VERSION: "4.6.1"
PNETCDF_VERSION: "1.12.1"

jobs:
ocis:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
show-progress: false
persist-credentials: false
-
name: GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}-standalone-ghci
-
name: QEMU
uses: docker/setup-qemu-action@v3
-
name: Buildx
uses: docker/setup-buildx-action@v3
-
name: Push
uses: docker/build-push-action@v6
with:
context: standalone-ghci/
file: standalone-ghci/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GCC_VERSION=${{ env.GCC_VERSION }}
MPICH_VERSION=${{ env.MPICH_VERSION }}
SZIP_VERSION=${{ env.SZIP_VERSION }}
HDF5_VERSION=${{ env.HDF5_VERSION }}
NETCDFC_VERSION=${{ env.NETCDFC_VERSION }}
NETCDFCXX_VERSION=${{ env.NETCDFCXX_VERSION }}
NETCDFFORTRAN_VERSION=${{ env.NETCDFFORTRAN_VERSION }}
PNETCDF_VERSION=${{ env.PNETCDF_VERSION }}
116 changes: 116 additions & 0 deletions standalone-ghci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
FROM ghcr.io/e3sm-project/containers-inputdata-files-standalone:main

ARG GCC_VERSION=11.4.0
ARG MPICH_VERSION=4.2.1
ARG SZIP_VERSION=2.1.1
ARG HDF5_VERSION=1.12.3
ARG NETCDFC_VERSION=4.9.2
ARG NETCDFCXX_VERSION=4.2
ARG NETCDFFORTRAN_VERSION=4.6.1
ARG PNETCDF_VERSION=1.12.1

ENV GCC_VERSION=${GCC_VERSION}
ENV MPICH_VERSION=${MPICH_VERSION}
ENV SZIP_VERSION=${SZIP_VERSION}
ENV HDF5_VERSION=${HDF5_VERSION}
ENV NETCDFC_VERSION=${NETCDFC_VERSION}
ENV NETCDFCXX_VERSION=${NETCDFCXX_VERSION}
ENV NETCDFFORTRAN_VERSION=${NETCDFFORTRAN_VERSION}
ENV PNETCDF_VERSION=${PNETCDF_VERSION}

RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y remove cmake
RUN apt-get -y install software-properties-common
RUN add-apt-repository universe
RUN apt-get update && apt-get -y install \
locales csh m4 libcurl4-openssl-dev \
libz-dev gcc g++ gfortran liblapack-dev make git \
git wget subversion libxml2-dev libxml2-utils libxml-libxml-perl \
libswitch-perl build-essential checkinstall zlib1g-dev libssl-dev \
python3-distutils python-is-python3 python3-pip python3-full

RUN python -m pip install netcdf4 pyyaml psutil pylint nanobind

RUN python -m pip cache purge
RUN apt-get -y autoremove

# TODO: move to env file (spack.yaml)?
RUN mkdir -p /opt/spack-environment \
&& (echo "spack:" \
&& echo " " \
&& echo " definitions:" \
&& echo " - compilers: [gcc@${GCC_VERSION}]" \
&& echo " - mpis: [mpich@${MPICH_VERSION}]" \
&& echo " - mpipkgs:" \
&& echo " - hdf5@${HDF5_VERSION}" \
&& echo " - netcdf-c@${NETCDFC_VERSION}" \
&& echo " - netcdf-cxx@${NETCDFCXX_VERSION}" \
&& echo " - netcdf-fortran@${NETCDFFORTRAN_VERSION}" \
&& echo " - parallel-netcdf@${PNETCDF_VERSION}" \
&& echo " - othpkgs:" \
&& echo " - cmake" \
&& echo " - cprnc" \
&& echo " - yaml-cpp" \
&& echo " - fmt" \
&& echo " - spdlog" \
&& echo " " \
&& echo " specs:" \
&& echo " - szip" \
&& echo " - matrix:" \
&& echo " - [\$mpis]" \
&& echo " - [\$%compilers]" \
&& echo " - matrix:" \
&& echo " - [\$othpkgs]" \
&& echo " - [\$%compilers]" \
&& echo " - matrix:" \
&& echo " - [\$mpipkgs]" \
&& echo " - [\$^mpis]" \
&& echo " - [\$%compilers]" \
&& echo " " \
&& echo " concretizer:" \
&& echo " unify: true" \
&& echo " " \
&& echo " config:" \
&& echo " install_tree: /opt/software" \
&& echo " " \
&& echo " view: /usr/local/packages" \
&& echo "") > /opt/spack-environment/spack.yaml

# TODO: do these intervene with each other?
# https://cache.spack.io/tag/v0.22.2/
RUN spack mirror add v0.22.2 https://binaries.spack.io/v0.22.2
RUN spack buildcache keys --install --trust
# https://cache.spack.io/tag/v0.22.1/?stack=e4s
RUN spack mirror add v0.22.2-e4s https://binaries.spack.io/v0.22.2/e4s
RUN spack buildcache keys --install --trust
# https://cache.spack.io/tag/v0.22.2/?stack=root#
RUN spack mirror add v0.22.2-root https://binaries.spack.io/v0.22.2/root
RUN spack buildcache keys --install --trust

# TODO: add e4s inventory when they support ubuntu 22.04+
# # https://oaciss.uoregon.edu/e4s/inventory.html
# RUN spack mirror add E4S-24.0 https://cache.e4s.io/24.0
# RUN spack buildcache keys -it
# RUN spack mirror add E4S https://cache.e4s.io
# RUN spack buildcache keys -it

RUN cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y

RUN cd /opt/spack-environment && \
spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh

ENV USER=ghciocitester

RUN git config --global user.email "${USER}@${USER}.${USER}"
RUN git config --global user.name "${USER}"

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles

ENV LANGUAGE=en_US:en \
LANG=en_US.UTF-8

# TODO: maybe add a test here or in the workflow?

ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]
7 changes: 7 additions & 0 deletions standalone-ghci/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The standalone-ghci container is mainly for testing eamxx standalone on github actions

Design notes
- the container is based on ghcr.io/e3sm-project/containers-inputdata-files-standalone:main
- the container relies on binary cache to accelerate builds
- the container is based on gcc 11, native to ubuntu 22.04 (jammy)
- the container has mpich 3.4.3, to ensure compatibility with craympich

0 comments on commit 6d46d5e

Please sign in to comment.