cadc-trigger-monitoring #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions to automatically run the dry corridor drought trigger monitoring. | |
# script. | |
name: cadc-trigger-monitoring | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '10 8-23/3 * * *' # start at 8:10 AM run every 3 hours until midnight | |
# - cron: '0 0,3,6 * * *' # then run at midnight, 3 am, 6 am | |
jobs: | |
monitor: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: '4.x' | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install System Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libxml2-dev \ | |
libgdal-dev \ | |
libproj-dev \ | |
libgeos-dev \ | |
libudunits2-dev \ | |
libsodium-dev | |
- name: Create authorization JSON | |
id: create-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "sa_auth.json" | |
json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Cache R dependencies | |
id: cache-r-deps | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: R-dependency-cache-${{ hashFiles('.github/depends.R') }} | |
- name: Install R dependencies | |
if: steps.cache-r-deps.outputs.cache-hit != 'true' | |
run: | | |
Rscript .github/depends.R | |
- name: Cache additional R dependencies | |
id: cache-r-deps-additional | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: R-dependency-cache-${{ hashFiles('.github/depends_additional.R') }} | |
- name: Install additonal R dependencies | |
if: steps.cache-r-deps-additional.outputs.cache-hit != 'true' | |
run: | | |
Rscript .github/depends_additional.R | |
- name: Run cadc-trigger-monitoring | |
run: | | |
source(file.path("src", "monitor_cds_forecast.R")) | |
shell: Rscript {0} | |
env: | |
CADC_MONITORING_JSON: "sa_auth.json" | |
CHD_DS_EMAIL_USERNAME: ${{ secrets.CHD_DS_EMAIL_USERNAME }} | |
CHD_DS_EMAIL_PASSWORD: ${{ secrets.CHD_DS_EMAIL_PASSWORD }} | |
CHD_DS_HOST: ${{ secrets.CHD_DS_HOST }} | |
CHD_DS_PORT: ${{ secrets.CHD_DS_PORT }} | |
ECMWF_USER_UID: ${{ secrets.ECMWF_USER_UID }} | |
ECMWF_USER_KEY: ${{ secrets.ECMWF_USER_KEY }} | |
DSCI_AZ_ENDPOINT: ${{ secrets.DSCI_AZ_ENDPOINT }} | |
DSCI_AZ_SAS_DEV: ${{ secrets.DSCI_AZ_SAS_DEV}} |