forked from ufs-community/regional_workflow
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add github actions workflow to test SRWA build #352
Merged
christinaholtNOAA
merged 11 commits into
NOAA-GSL:rrfs_ci
from
robgpita:feature/CI_build_test
Jun 27, 2022
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e0d9a21
Add github actions workflow to run on self-hosted runner
fce6085
Checkout base branch of SRWA, modi
648acb5
Remove duplicate calling of build.sh
5824998
Merge remote-tracking branch 'origin/rrfs_ci' into feature/CI_build_test
64ad80f
Remove insertion of UFS SRWA env files from seperate repository, prin…
b22ff0f
Refactor build_SRWA.yml to clone concurrent PR from the same author a…
31e48db
Add Comment addressing relative file paths, add new line at the end o…
c2f1e7c
Add more detailed comments
f989f56
Try cloning RRFS using actions/checkout within the srwa clone
b415769
Fix merge
23a6665
Remove outdated comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# This workflow Builds the UFS SRWEATHER APP | ||
name: Build SRWA | ||
|
||
on: | ||
# Enable the ability to manually run this workflow, as well as when the ci-aws-intel-build label is attached to a PR, and if the PR is updated | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- rrfs_ci | ||
types: | ||
- labeled | ||
|
||
# Use a default login shell which loads intel/oneapi/setvars.sh, and lmod path | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
jobs: | ||
|
||
Set_Repo_and_Branch: | ||
name: Set the SRWA repo and branch names | ||
runs-on: self-hosted | ||
if: ${{ github.event.label.name == 'ci-aws-intel-build' }} | ||
outputs: | ||
SRWA_REPO: ${{ steps.set_repo.outputs.SRWA_REPO }} | ||
SRWA_BRANCH: ${{ steps.set_repo.outputs.SRWA_BRANCH }} | ||
|
||
# If a developer submits a concurrent PR to the App, set the SRWA_REPO & SRWA_BRANCH env variables to their repo and branch, | ||
# if not, set the outputs to the rrfs_ci branch of NOAA-GSL/ufs-srweather-app | ||
steps: | ||
- name: Set Repo and Branch Variables | ||
id: set_repo | ||
run: | | ||
new_branch=`git ls-remote https://github.com/${{ github.actor }}/ufs-srweather-app.git ${{ github.head_ref }}` | ||
if [ -n "$new_branch" ]; then | ||
echo "SRWA_REPO is being set to : ${{ github.actor }}/ufs-srweather-app.git" | ||
echo "::set-output name=SRWA_REPO::${{ github.actor }}/ufs-srweather-app" | ||
echo "SRWA_BRANCH is being set to : " ${{ github.head_ref }} | ||
echo "::set-output name=SRWA_BRANCH::${{ github.head_ref }}" | ||
else | ||
echo "There is not a head_ref with the same name as this PR in the SRW App, the default SRW App (NOAA-GSL fork) repository will be used." | ||
echo "::set-output name=SRWA_REPO::NOAA-GSL/ufs-srweather-app" | ||
echo "There is not a similar branch name associated with this PR in the SRW App, the default SRWA App branch (rrfs_ci) will be used." | ||
echo "::set-output name=SRWA_BRANCH::rrfs_ci" | ||
fi | ||
|
||
# Clone the SRWA - with github.run_id in filepath to avoid multiple PR Conflicts, & track build tests by their run_id | ||
Clone_SRWA: | ||
name: Clone SRWA and move into parent directory | ||
runs-on: self-hosted | ||
if: ${{ github.event.label.name == 'ci-aws-intel-build' }} | ||
needs: [ Set_Repo_and_Branch ] | ||
|
||
steps: | ||
- name: Clone SRWA | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ needs.Set_Repo_and_Branch.outputs.SRWA_REPO }} | ||
ref: ${{ needs.Set_Repo_and_Branch.outputs.SRWA_BRANCH }} | ||
path: ufs-srweather-app-${{ github.run_id }} | ||
|
||
Configure_SRWA: | ||
name: Checkout_Externals and replace with 'this' version of regional_workflow | ||
runs-on: self-hosted | ||
if: ${{ github.event.label.name == 'ci-aws-intel-build' }} | ||
needs: [ Set_Repo_and_Branch, Clone_SRWA ] | ||
|
||
steps: | ||
- name: Checkout Externals & Delete Regional Workflow | ||
run: | | ||
cd ufs-srweather-app-${{ github.run_id }} | ||
./manage_externals/checkout_externals | ||
rm -rf regional_workflow | ||
|
||
- name: Checkout 'this' version of Regional Workflow | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ufs-srweather-app-${{ github.run_id }}/regional_workflow | ||
clean: false | ||
|
||
Build_SRWA: | ||
name: Build SRWA | ||
runs-on: self-hosted | ||
if: ${{ github.event.label.name == 'ci-aws-intel-build' }} | ||
needs: [ Set_Repo_and_Branch, Clone_SRWA, Configure_SRWA ] | ||
steps: | ||
- name: Build Short Range Weather App using test/build.sh | ||
run: | | ||
cd ufs-srweather-app-${{ github.run_id }}/test/ | ||
./build.sh aws 2>&1 | tee build_test.out | ||
|
||
Build_Status: | ||
name: Check Build Sucess or Failure | ||
runs-on: self-hosted | ||
if: ${{ github.event.label.name == 'ci-aws-intel-build' }} | ||
needs: [ Set_Repo_and_Branch, Clone_SRWA, Configure_SRWA, Build_SRWA ] | ||
|
||
steps: | ||
- name: Get build status | ||
run: | | ||
cd ufs-srweather-app-${{ github.run_id }}/test/ | ||
status=`tail -1 build_test.out |cut -d ' ' -f 3-` | ||
if [ $status == PASS ]; then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it need to move up one directory? Can you not clone SRW where you want it, and then clone regional_workflow inside that clone using the
path
option for both?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christinaholtNOAA, you pose some great questions, and this a much better approach. I updated the GHA workflow to clone SRW and place the regional_workflow inside of that clone using the
path
option.