From 6934bc91c707ccf804972374d02434d5708ca59c Mon Sep 17 00:00:00 2001 From: meetagrawal09 Date: Sat, 27 Jul 2024 22:50:27 +0530 Subject: [PATCH] added model run --- .github/workflows/model-run.yml | 59 ++++++++++++++++++++++++++++ tests/test.xml | 68 +++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 .github/workflows/model-run.yml create mode 100644 tests/test.xml diff --git a/.github/workflows/model-run.yml b/.github/workflows/model-run.yml new file mode 100644 index 00000000000..8428c8635f5 --- /dev/null +++ b/.github/workflows/model-run.yml @@ -0,0 +1,59 @@ +name : Sipnet Model Run +on : + pull_request: + + # allow manual triggering + workflow_dispatch: + + schedule: + # run Thursday 4:30 AM UTC + - cron: '30 4 * * 4' +jobs: + test: + runs-on: ubuntu-20.04 + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + container: + image: pecan/base:develop + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Set up Docker Compose + run: | + sudo apt-get update + sudo apt-get -y install docker-compose + + - name: Build Containers + run: | + cp docker/env.example .env + echo "COMPOSE_PROJECT_NAME=pecan" >> .env + echo "PECAN_VERSION=develop" >> .env + echo "UID=$(id -u)" >> .env + echo "GID=$(id -g)" >> .env + docker-compose up -d postgres + docker run --rm --network pecan_pecan pecan/db + + docker-compose run bety user guestuser guestuser "Guest User" guestuser@example.com 4 4 + docker-compose run bety user carya illinois "Carya Demo User" carya@example.com 1 1 + + docker run --rm --network pecan_pecan --volume pecan_pecan:/data --env FQDN=docker pecan/data:develop + docker run --rm --network pecan_pecan --volume pecan_pecan:/data pecan/data:develop chown -R "$(id -u).$(id -g)" /data + + docker run --user="$(id -u)" --rm --network pecan_pecan --volume pecan_pecan:/data --env FQDN=docker pecan/data:develop + + - name: Run required containers + run: | + docker-compose up pecan bety sipnet rstudio -d + + - name: Check if containers are running # This will be updated soon to a loop + run: | + docker ps + sleep 50 + + - name: Run SIPNET + run: | + docker exec --workdir /pecan/tests pecan-rstudio-1 R CMD ../web/workflow.R --settings test.xml \ No newline at end of file diff --git a/tests/test.xml b/tests/test.xml new file mode 100644 index 00000000000..0644149831a --- /dev/null +++ b/tests/test.xml @@ -0,0 +1,68 @@ + + /data/workflows/PEcAn_99000000021 + + + bety + bety + postgres + 5432 + bety + PostgreSQL + true + + /data/dbfiles + + + + semiarid.grassland + + + + 3000 + + FALSE + TRUE + + + + 1 + NPP + + + uniform + + + sampling + + + + + 1000000014 + + + 99000000029 + + + + 2000001297 + 2004/01/01 + 2004/12/31 + + + + CRUNCEP + SIPNET + + + + 2004/01/01 + 2004/12/31 + + + localhost + + amqp://carya:illinois@rabbitmq/%2F + SIPNET_r136 + + + \ No newline at end of file