Skip to content

Commit 565d548

Browse files
authored
Merge pull request #572 from scrasmussen/bugfix/docker-test-and-push-ci
bugfix: Github CI and Dockerfile
2 parents c8e4138 + 432bfa9 commit 565d548

File tree

3 files changed

+72
-28
lines changed

3 files changed

+72
-28
lines changed

.github/workflows/ci_build_scm_ubuntu_nvidia.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
name: build the CCPP-SCM with Nvidia
22

3-
on: [pull_request,workflow_dispatch]
3+
on:
4+
workflow_run:
5+
workflows: ["build and run SCM regression tests"]
6+
types:
7+
- completed
48

59
jobs:
610

711
build_scm:
8-
# The type of runner that the job will run on
12+
# trigger only after the SCM regression tests have completed from a PR or workflow event
13+
if: |
14+
github.event.workflow_run.event == 'pull_request' ||
15+
github.event.workflow_run.event == 'workflow_dispatch'
916
runs-on: ubuntu-latest
1017
strategy:
1118
fail-fast: false

.github/workflows/ci_test_docker.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: build test and push docker
22

3-
on: [pull_request,workflow_dispatch]
3+
on:
4+
# not listing pull_request closed, since it would run when merged
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
workflow_dispatch:
48

59
env:
610
TEST_TAG: dtcenter/ccpp-scm:test

docker/Dockerfile

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,59 @@
1-
FROM debian:12
1+
FROM debian:12-slim
22
LABEL maintainer="Michael Kavulich <kavulich@ucar.edu>"
33

44
# arguments that can be passed in
55
ARG PR_NUMBER
6+
# build variables
7+
ARG GNU_VERSION=12
8+
ARG VERBOSE=0
9+
610

711
# Set up base OS environment
812
RUN apt-get -y update
913

1014
# Get "essential" tools and libraries
11-
RUN apt-get -y install build-essential \
12-
&& apt-get -y install cmake cmake-curses-gui curl git file gfortran-12 ksh m4 python3 tcsh time wget vim emacs-nox \
13-
&& apt-get -y install libnetcdf-pnetcdf-19 libnetcdff7 libnetcdf-dev libnetcdff-dev libxml2 \
14-
&& apt-get -y install python3-pip python3.11-venv python3-netcdf4 \
15-
&& apt-get -y install openmpi-bin libopenmpi-dev
15+
RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends \
16+
build-essential \
17+
cmake \
18+
cmake-curses-gui \
19+
curl \
20+
git \
21+
file \
22+
gfortran-$GNU_VERSION \
23+
ksh \
24+
m4 \
25+
tcsh \
26+
time \
27+
wget \
28+
vim \
29+
emacs-nox \
30+
python3 \
31+
python3-pip \
32+
python3.11-venv \
33+
python3-netcdf4 \
34+
libnetcdf-pnetcdf-19 \
35+
libnetcdff7 \
36+
libnetcdf-dev \
37+
libnetcdff-dev \
38+
libxml2 \
39+
openmpi-bin \
40+
libopenmpi-dev \
41+
&& apt-get clean \
42+
&& rm -rf /var/lib/apt/lists/*
43+
1644
RUN ln -s /usr/bin/python3 /usr/bin/python
45+
RUN ln -s /usr/bin/gfortran-$GNU_VERSION /usr/bin/gfortran
1746

1847
# Set up python needed packages, preferred Docker method is apt-get but
1948
# f90nml can't be installed for debian that way
2049
RUN pip install f90nml --break-system-packages
2150

2251
#Compiler environment variables
23-
ENV CC=/usr/bin/gcc
24-
ENV FC=/usr/bin/gfortran
25-
ENV CXX=/usr/bin/g++
26-
ENV F77=/usr/bin/gfortran
27-
ENV F90=/usr/bin/gfortran
52+
ENV CC=gcc
53+
ENV FC=gfortran
54+
ENV CXX=g++
55+
ENV F77=gfortran
56+
ENV F90=gfortran
2857

2958
# Other necessary environment variables
3059
ENV LD_LIBRARY_PATH=/usr/lib/
@@ -47,24 +76,24 @@ WORKDIR /home
4776
ENV NCEPLIBS_DIR=/comsoftware/nceplibs
4877

4978
RUN mkdir -p $NCEPLIBS_DIR/src && cd $NCEPLIBS_DIR/src \
50-
&& git clone -b v2.4.1 --recursive https://github.com/NOAA-EMC/NCEPLIBS-bacio \
51-
&& mkdir NCEPLIBS-bacio/build && cd NCEPLIBS-bacio/build \
52-
&& cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \
53-
&& make VERBOSE=1 -j \
54-
&& make install
79+
&& git clone -b v2.4.1 --depth 1 --recursive https://github.com/NOAA-EMC/NCEPLIBS-bacio \
80+
&& mkdir NCEPLIBS-bacio/build && cd NCEPLIBS-bacio/build \
81+
&& cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \
82+
&& make VERBOSE=$VERBOSE -j \
83+
&& make install
5584

5685
RUN cd $NCEPLIBS_DIR/src \
57-
&& git clone -b v2.3.3 --recursive https://github.com/NOAA-EMC/NCEPLIBS-sp \
86+
&& git clone -b v2.3.3 --depth 1 --recursive https://github.com/NOAA-EMC/NCEPLIBS-sp \
5887
&& mkdir NCEPLIBS-sp/build && cd NCEPLIBS-sp/build \
5988
&& cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \
60-
&& make VERBOSE=1 -j \
89+
&& make VERBOSE=$VERBOSE -j \
6190
&& make install
6291

6392
RUN cd $NCEPLIBS_DIR/src \
64-
&& git clone -b v2.11.0 --recursive https://github.com/NOAA-EMC/NCEPLIBS-w3emc \
93+
&& git clone -b v2.11.0 --depth 1 --recursive https://github.com/NOAA-EMC/NCEPLIBS-w3emc \
6594
&& mkdir NCEPLIBS-w3emc/build && cd NCEPLIBS-w3emc/build \
6695
&& cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \
67-
&& make VERBOSE=1 -j \
96+
&& make VERBOSE=$VERBOSE -j \
6897
&& make install
6998

7099
ENV bacio_ROOT=/comsoftware/nceplibs
@@ -81,17 +110,14 @@ RUN if [ -z "$PR_NUMBER" ]; then \
81110
&& cd ccpp-scm \
82111
&& git fetch origin pull/${PR_NUMBER}/head:test_pr \
83112
&& git checkout test_pr \
84-
&& git submodule update --init --recursive; \
113+
&& git submodule update --init --recursive --depth 1; \
85114
fi
86115

87116
RUN mkdir /comsoftware/ccpp-scm/scm/bin \
88117
&& cd /comsoftware/ccpp-scm/scm/bin \
89118
&& cmake ../src \
90119
&& make -j
91120

92-
RUN cd /comsoftware/ccpp-scm/ \
93-
&& ./contrib/get_all_static_data.sh \
94-
&& ./contrib/get_thompson_tables.sh
95121

96122
# The analysis scripts have options for using LaTeX when making figure labels.
97123
# If you would like to install LaTeK, uncomment the section below.
@@ -109,4 +135,11 @@ ENV SCM_ROOT=/comsoftware/ccpp-scm/
109135
# For interactive use, vim mouse settings are infuriating
110136
RUN echo "set mouse=" > ~/.vimrc
111137

112-
ENTRYPOINT ["sh", "-c", "./contrib/get_aerosol_climo.sh && cd /comsoftware/ccpp-scm/scm/bin"]
138+
# only download test data when PR is being tested
139+
ENTRYPOINT ["sh", "-c", "\
140+
if [ -n \"$PR_NUMBER\" ]; then \
141+
./contrib/get_aerosol_climo.sh && \
142+
./contrib/get_all_static_data.sh && \
143+
./contrib/get_thompson_tables.sh; \
144+
fi && \
145+
cd /comsoftware/ccpp-scm/scm/bin"]

0 commit comments

Comments
 (0)