Skip to content

Merge pull request #743 from scrasmussen/enhancement/liquidWaterFract… #62

Merge pull request #743 from scrasmussen/enhancement/liquidWaterFract…

Merge pull request #743 from scrasmussen/enhancement/liquidWaterFract… #62

Workflow file for this run

name: build
on:
push:
branches: [ main, v5.2.x ]
pull_request:
branches: [ main, v5.2.x ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
pr:
description: "PR to test"
required: true
jobs:
Model_Testing:
strategy:
fail-fast: false
matrix:
configuration: [nwm_ana, nwm_long_range, gridded, reach]
runs-on: ubuntu-latest
steps:
- name: Checkout candidate (pull request / push)
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
uses: actions/checkout@v3
with:
path: candidate
- name: Checkout candidate (manual)
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh repo clone ${{ github.repository }} candidate && cd candidate && gh pr checkout -R ${{ github.repository }} ${{ github.event.inputs.pr }}
- name: Checkout reference (pull request)
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.ref }}
path: reference
- name: Checkout reference (push)
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.before }}
path: reference
- name: Checkout reference (manual)
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh repo clone ${{ github.repository }} reference && cd reference && git checkout origin/$(gh pr view ${{ github.event.inputs.pr }} --json baseRefName --jq '.baseRefName')
- name: Run testing container
run: |
docker run -e TRAVIS=1 -t --name test_container \
-v $GITHUB_WORKSPACE/candidate:/home/docker/candidate \
-v $GITHUB_WORKSPACE/reference:/home/docker/reference \
wrfhydro/dev:modeltesting --config ${{ matrix.configuration }} --domain_tag dev
- name: Copy test results from container
if: ${{ always() }}
run: docker cp test_container:/home/docker/test_out $GITHUB_WORKSPACE/test_report
- name: Checkout Github API
if: ${{ always() }}
run: |
pip install pygithub
- name: Attach diff plots to PR
if: ${{ always() }}
run: |
cd $GITHUB_WORKSPACE/candidate/tests/local/utils
bash attach_all_plots.bash $(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") ${{ matrix.configuration }}
- name: Archive test results to GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-reports
path: |
${{ github.workspace }}/test_report/**.html
${{ github.workspace }}/test_report/*/diff_plots