Skip to content

Commit

Permalink
Merge pull request #4495 from ESMCI/update-docker
Browse files Browse the repository at this point in the history
- Adds lapack and blas packages
- Adds separate workflow for containers
- Changes publishing to ghcr.io from hub.docker

Test suite:
Test baseline:
Test namelist changes:
Test status: [bit for bit, roundoff, climate changing]

Fixes [CIME Github issue #]
User interface changes?:
Update gh-pages html (Y/N)?:
  • Loading branch information
jasonb5 authored Oct 9, 2023
2 parents 0065e63 + 52a1bbd commit d1b1074
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 64 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: container build/publish

on:
push:
branches:
- master
paths:
- 'docker/**'

pull_request:
branches:
- master
paths:
- 'docker/**'

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
# Only build container if there has been a change.
build-containers:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/ESMCI/cime
flavor: |
latest=auto
tags: |
type=sha
- name: Build and push
uses: docker/build-push-action@v3
with:
target: base
context: docker/
push: ${{ github.event == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
82 changes: 22 additions & 60 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ on:
push:
branches:
- master
paths-ignore:
- 'doc/**'
paths:
- 'CIME/**'
- 'scripts/**'
- 'tools/**'
- 'utils/**'

pull_request:
branches:
- master
paths-ignore:
- 'doc/**'
paths:
- 'CIME/**'
- 'scripts/**'
- 'tools/**'
- 'utils/**'

concurrency:
group: ${{ github.ref }}
Expand Down Expand Up @@ -43,64 +49,16 @@ jobs:
pre-commit run -a
# Check if there has been a change to any file under docker/
get-docker-changes:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.get-changed-files.outputs.any_changed }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get changed files
id: get-changed-files
uses: tj-actions/changed-files@v29
with:
files: docker

# Only build container if there has been a change.
build-containers:
runs-on: ubuntu-latest
needs: get-docker-changes
if: ${{ needs.get-docker-changes.outputs.any_changed == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: jasonb87/cime
tags: |
type=raw,value=latest
type=sha,prefix={{ date 'YYYYMMDD' }}_,format=short
- name: Build and push
uses: docker/build-push-action@v3
with:
target: base
context: docker/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=jasonb87/cime:buildcache
cache-to: type=registry,ref=jasonb87/cime:buildcache,mode=max

# Runs unit testing under different python versions.
unit-testing:
runs-on: ubuntu-latest
needs: build-containers
if: ${{ always() && ! cancelled() }}
container: jasonb87/cime:latest
container:
image: ghcr.io/esmci/cime:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: '--pull=always'
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
Expand Down Expand Up @@ -134,9 +92,13 @@ jobs:
# Run system tests
system-testing:
runs-on: ubuntu-latest
needs: build-containers
if: ${{ always() && ! cancelled() }}
container: jasonb87/cime:latest
container:
image: ghcr.io/esmci/cime:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: '--pull=always'
strategy:
matrix:
model: ["e3sm", "cesm"]
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ RUN mamba install --yes -c conda-forge \
# gcc, gxx, gfortran provide symlinks for x86_64-conda-linux-gnu-*
# ar and ranlib are not symlinked
RUN mamba install --yes -c conda-forge \
lapack \
blas \
libnetcdf=${LIBNETCDF_VERSION}=*openmpi* \
netcdf-fortran=${NETCDF_FORTRAN_VERSION}=*openmpi* \
esmf=${ESMF_VERSION}=*openmpi* \
Expand Down
2 changes: 2 additions & 0 deletions docker/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<environment_variables>
<env name="OMPI_ALLOW_RUN_AS_ROOT">1</env>
<env name="OMPI_ALLOW_RUN_AS_ROOT_CONFIRM">1</env>
<env name="NETCDF_PATH">/opt/conda</env>
<env name="PNETCDF_PATH">/opt/conda</env>
</environment_variables>
</machine>
</config_machines>
5 changes: 1 addition & 4 deletions docker/docker.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
string(APPEND CXXFLAGS " -std=c++14")
string(APPEND CXX_LIBS " -lstdc++")
string(APPEND SLIBS " -L/opt/conda/lib -lnetcdf -lnetcdff")
string(APPEND FFLAGS " -I/opt/conda/include")
string(APPEND SLIBS " -L/opt/conda/lib")
set(MPI_PATH "/opt/conda")
set(NETCDF_C_PATH "/opt/conda")
set(NETCDF_FORTRAN_PATH "/opt/conda")
set(PNETCDF_PATH "/opt/conda")
if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
string(APPEND FFLAGS " -fallow-argument-mismatch -fallow-invalid-boz ")
endif()

0 comments on commit d1b1074

Please sign in to comment.