|
| 1 | +name: WRF-Hydro CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, v5.2.x ] |
| 6 | + pull_request: |
| 7 | + branches: [ master, v5.2.x ] |
| 8 | + |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + pr: |
| 13 | + description: "PR to test" |
| 14 | + required: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + Model_Testing: |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + configuration: [nwm_ana, nwm_long_range, gridded, reach] |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout candidate (automatic) |
| 25 | + if: ${{ github.event_name == 'pull_request' }} |
| 26 | + uses: actions/checkout@v2 |
| 27 | + with: |
| 28 | + path: candidate |
| 29 | + |
| 30 | + - name: Checkout candidate (manual) |
| 31 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 32 | + env: |
| 33 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 34 | + run: gh repo clone ${{ github.repository }} candidate && cd candidate && gh pr checkout -R ${{ github.repository }} ${{ github.event.inputs.pr }} |
| 35 | + |
| 36 | + - name: Checkout reference (automatic) |
| 37 | + if: ${{ github.event_name == 'pull_request' }} |
| 38 | + uses: actions/checkout@v2 |
| 39 | + with: |
| 40 | + ref: ${{ github.event.pull_request.base.ref }} |
| 41 | + path: reference |
| 42 | + |
| 43 | + - name: Checkout reference (manual) |
| 44 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 47 | + run: gh repo clone ${{ github.repository }} reference && cd reference && git checkout --track origin/$(gh pr view ${{ github.event.inputs.pr }} --json baseRefName --jq '.baseRefName') |
| 48 | + |
| 49 | + - name: Run testing container |
| 50 | + run: | |
| 51 | + docker run -e TRAVIS=1 -t --name test_container \ |
| 52 | + -v $GITHUB_WORKSPACE/candidate:/home/docker/candidate \ |
| 53 | + -v $GITHUB_WORKSPACE/reference:/home/docker/reference \ |
| 54 | + wrfhydro/dev:modeltesting --config ${{ matrix.configuration }} --domain_tag dev |
| 55 | + |
| 56 | + - name: Copy test results from container |
| 57 | + run: docker cp test_container:/home/docker/test_out $GITHUB_WORKSPACE/test_report |
| 58 | + |
| 59 | + - name: Archive test results to GitHub |
| 60 | + uses: actions/upload-artifact@v2 |
| 61 | + with: |
| 62 | + name: test-reports |
| 63 | + path: ${{ github.workspace }}/test_report/**.html |
| 64 | + |
0 commit comments