Skip to content

Commit

Permalink
Docker will checkout PR if being run during PR CI
Browse files Browse the repository at this point in the history
  • Loading branch information
scrasmussen committed Jul 25, 2024
1 parent 5eaa43f commit 58a292f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci_test_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [pull_request,workflow_dispatch]

env:
TEST_TAG: dtcenter/ccpp-scm:test
PR_NUMBER: ${{ github.event.number }}


jobs:
docker:
Expand All @@ -26,4 +28,7 @@ jobs:
run: |
mkdir $HOME/output
chmod a+rw $HOME/output
docker run --rm -v $HOME/output:/home ${{ env.TEST_TAG }} ./run_scm.py -f ../../test/rt_test_cases.py --runtime_mult 0.1 -d -a
docker run \
-e PR_NUMBER="${PR_NUMBER}" \
--rm -v $HOME/output:/home ${{ env.TEST_TAG }} \
./run_scm.py -f ../../test/rt_test_cases.py --runtime_mult 0.1 -d -a
20 changes: 15 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,21 @@ ENV sp_ROOT=/comsoftware/nceplibs
ENV w3emc_ROOT=/comsoftware/nceplibs

# Obtain CCPP SCM source code, build code, and download static data
RUN cd /comsoftware \
&& git clone --recursive -b main https://github.com/NCAR/ccpp-scm \
&& mkdir /comsoftware/ccpp-scm/scm/bin

RUN cd /comsoftware/ccpp-scm/scm/bin \
RUN if [ -z "$PR_NUMBER" ]; then \
cd /comsoftware \
&& git clone https://github.com/NCAR/ccpp-scm \
&& cd ccpp-scm \
&& git checkout origin pull/${PR_NUMBER}/head:test_pr \
&& git checkout test_pr \
&& git submodule update --init --recursive; \
else \
cd /comsoftware \
&& git clone --recursive -b main https://github.com/NCAR/ccpp-scm; \
fi


RUN mkdir /comsoftware/ccpp-scm/scm/bin \
&& cd /comsoftware/ccpp-scm/scm/bin \
&& cmake ../src \
&& make -j

Expand Down

0 comments on commit 58a292f

Please sign in to comment.