Skip to content
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

Refactor GHA CI workflow #116

Merged
merged 6 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 33 additions & 13 deletions .github/workflows/CEFI_MOM6-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,35 @@ jobs:
exit 1
fi

- name: Compress CEFI_MOM6_CHECK
run: tar -czvf CEFI_MOM6_CHECK.tar.gz -C ${{ env.TEST_DIR }} CEFI_MOM6_CHECK

- name: Upload the whole MOM6_CHECK as an artifact
uses: actions/upload-artifact@v3
with:
name: CEFI_MOM6_CHECK
path: CEFI_MOM6_CHECK.tar.gz

run-CEFI_MOM6-ci:
needs: checkout-build
runs-on: [self-hosted]
strategy:
max-parallel: 1
max-parallel: 2
matrix:
case: ["NWA12.COBALT", "NEP10.COBALT"]
steps:
- name: Download CEFI_MOM6_CHECK compressed artifact
uses: actions/download-artifact@v3
with:
name: CEFI_MOM6_CHECK
path: ${{ env.TEST_DIR }}

- name: Extract the artifact
run: tar -xzvf ${{ env.TEST_DIR }}/CEFI_MOM6_CHECK.tar.gz -C ${{ env.TEST_DIR }}

- name: Run Experiment ${{ matrix.case }}
run: |
#chmod +x ${{ env.TEST_DIR }}/CEFI_MOM6_CHECK/builds/build/docker-linux-intel/ocean_ice/repro/MOM6SIS2
cd ${{ env.TEST_DIR }}/CEFI_MOM6_CHECK/exps/${{ matrix.case }}
jobid=$(sbatch --parsable driver.sh | awk -F';' '{print $1}' | cut -f1)
#
Expand Down Expand Up @@ -97,6 +116,18 @@ jobs:
exit 10
fi

- name: Clean-up workspace for ${{ matrix.case }}
run: |
echo "Cleaning up ${{ env.TEST_DIR }}"
rm -rf ${{ env.TEST_DIR }}
# Check if the tar.gz file exists and delete it if found
if [ -f "${{ github.workspace }}/CEFI_MOM6_CHECK.tar.gz" ]; then
echo "Found CEFI_MOM6_CHECK.tar.gz, deleting it."
rm "${{ github.workspace }}/CEFI_MOM6_CHECK.tar.gz"
else
echo "CEFI_MOM6_CHECK.tar.gz not found, skipping deletion."
fi

add-pass-label:
needs: run-CEFI_MOM6-ci
runs-on: [self-hosted]
Expand All @@ -119,15 +150,4 @@ jobs:
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ env.PR_NUMBER }}/labels" \
-d "{\"labels\":[\"$PASS_LABEL\"]}"

clean-up:
needs: add-pass-label
runs-on: [self-hosted]
strategy:
max-parallel: 1
steps:
- name: Clean-up
run: |
cd ${{ github.workspace }}
rm -rf ${{ github.run_id }}
-d "{\"labels\":[\"$PASS_LABEL\"]}"
Loading