Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration Testing for do_conversions workflow #3306

Merged
merged 18 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading