From 3cb66da49a1cfc66f90d8072d79e08c7ea3f103e Mon Sep 17 00:00:00 2001 From: Ryan Cabell Date: Wed, 30 Jun 2021 16:08:47 -0600 Subject: [PATCH] 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. --- .github/workflows/test-pr.yml | 64 +++++++++++++++++++++++++++++++++ .travis.yml => .travis.yml.prev | 0 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/test-pr.yml rename .travis.yml => .travis.yml.prev (100%) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml new file mode 100644 index 000000000..7b311a7d0 --- /dev/null +++ b/.github/workflows/test-pr.yml @@ -0,0 +1,64 @@ +name: WRF-Hydro CI + +on: + push: + branches: [ master, v5.2.x ] + pull_request: + branches: [ master, 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: + matrix: + configuration: [nwm_ana, nwm_long_range, gridded, reach] + runs-on: ubuntu-latest + + steps: + - name: Checkout candidate (automatic) + if: ${{ github.event_name == 'pull_request' }} + uses: actions/checkout@v2 + 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 (automatic) + if: ${{ github.event_name == 'pull_request' }} + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.base.ref }} + 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 --track 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 + run: docker cp test_container:/home/docker/test_out $GITHUB_WORKSPACE/test_report + + - name: Archive test results to GitHub + uses: actions/upload-artifact@v2 + with: + name: test-reports + path: ${{ github.workspace }}/test_report/**.html + diff --git a/.travis.yml b/.travis.yml.prev similarity index 100% rename from .travis.yml rename to .travis.yml.prev