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 1627269
Show file tree
Hide file tree
Showing 2 changed files with 20 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
19 changes: 14 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,20 @@ 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 --recursive -b main https://github.com/NCAR/ccpp-scm; \
else \
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; \
fi

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

Expand Down

0 comments on commit 1627269

Please sign in to comment.