Skip to content

Commit

Permalink
Refactor GHA CI workflow (#116)
Browse files Browse the repository at this point in the history
* test artifact

* fix artifact download path

* Restore executable permission

* try compress artifact

* refactor cleanup section

* Deactivate CEFI_MOM6_C6-CI
  • Loading branch information
yichengt900 authored Nov 17, 2024
1 parent 0ac7670 commit d993366
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
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\"]}"
File renamed without changes.

0 comments on commit d993366

Please sign in to comment.