Skip to content

Commit

Permalink
Merge branch 'develop' into model-run-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
meetagrawal09 committed Sep 23, 2024
2 parents a949401 + fbac460 commit 2a3d512
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/download-met-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name : Test Data Download
on :
# allow manual triggering
workflow_dispatch:

schedule:
# run Thursday 4:30 AM UTC
- cron: '30 4 * * 4'

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2
PGHOST: postgres
CI: true

jobs:
met-data-download:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

services:
postgres:
image: mdillon/postgis:9.5
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

container:
image: pecan/depends:R4.1

steps:
# checkout source code
- name: work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false

# install additional tools needed
- name: install utils
run: apt-get update && apt-get install -y postgresql-client qpdf
- name: install new dependencies
run: Rscript scripts/generate_dependencies.R && cd docker/depends && Rscript pecan.depends.R

# initialize database
- name: db setup
uses: docker://pecan/db:ci
- name: add models to db
run: ./scripts/add.models.sh

# compile PEcAn code
- name: build
run: make -j1

- name: CRUNCEP
run: |
Rscript ./tests/test_met_downloads.R --settings ./tests/met_download_settings/docker.CRUNCEP.xml
33 changes: 33 additions & 0 deletions tests/met_download_settings/docker.CRUNCEP.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<pecan>
<outdir>/data/tests/met_download/CRUNCEP</outdir>
<database>
<bety>
<driver>PostgreSQL</driver>
<user>bety</user>
<password>bety</password>
<host>postgres</host>
<dbname>bety</dbname>
<write>FALSE</write>
</bety>
</database>
<model>
<type>SIPNET</type>
</model>
<run>
<site>
<id>1000000057</id>
</site>
<inputs>
<met>
<source>CRUNCEP</source>
</met>
</inputs>
<start.date>2001-01-01</start.date>
<end.date>2001-12-31</end.date>
<dbfiles>/data/dbfiles</dbfiles>
</run>
<host>
<name>localhost</name>
</host>
</pecan>
6 changes: 6 additions & 0 deletions tests/test_met_downloads.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
library("PEcAn.all")

args <- PEcAn.settings::get_args()
settings <- PEcAn.settings::read.settings(args$settings)
settings <- PEcAn.settings::prepare.settings(settings, force = FALSE)
settings <- PEcAn.workflow::do_conversions(settings)

0 comments on commit 2a3d512

Please sign in to comment.