Skip to content

Commit 3cb66da

Browse files
committed
Create test-pr.yml, rename .travis.yml
Converted TravisCI workflow to use GitHub Actions. Renamed .travis.yml to .travis.yml.prev, so it's not picked up automatically by Travis, and added a new `.github/workflows/test-pr.yml` GitHub workflow file. The GitHub Actions workflow will execute automatically with PR events, and can also be triggered manually from the Actions tab.
1 parent d87e523 commit 3cb66da

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/test-pr.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
File renamed without changes.

0 commit comments

Comments
 (0)