Skip to content

Update MOM6 and COBALT tags, all the parameter docs, and turn off glorys GHA for now #95

Update MOM6 and COBALT tags, all the parameter docs, and turn off glorys GHA for now

Update MOM6 and COBALT tags, all the parameter docs, and turn off glorys GHA for now #95

Workflow file for this run

name: CEFI-MOM6-ci
on:
# Triggers this workflow on pull request event with "CEFI_MOM6_RT_container" label
pull_request:
branches: [ "main" ]
types: [ labeled ]
#
env:
TEST_DIR: ${{ github.workspace }}/${{ github.run_id }}
PR_NUMBER: ${{ github.event.number }}
#
jobs:
checkout-build:
if: ${{ github.event.label.name == 'CEFI_MOM6_RT_container' }}
runs-on: [self-hosted]
timeout-minutes: 600
strategy:
max-parallel: 1
steps:
- name: Checkout CEFI-regional-MOM6
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}/CEFI_MOM6_CHECK
fetch-depth: 1
submodules: recursive
- name: Build MOM6SIS2 using container
run: |
cd ${{ env.TEST_DIR }}/CEFI_MOM6_CHECK/builds
#pwd
#img=/gpfs/f6/ira-cefi/world-shared/container/ubuntu22.04-intel-ufs-env-v1.8.0-llvm.img
#apptainer exec -B /gpfs -B /ncrc/home2/Yi-cheng.Teng:/ncrc/home2/Yi-cheng.Teng $img bash linux-build.bash -m docker -p linux-intel -t repro -f mom6sis2
jobid=$(sbatch --parsable ci_build_driver.sh | awk -F';' '{print $1}' | cut -f1)
#
sleep 1
while :; do
job_status=$(squeue -h -j "$jobid" -o "%T" 2>/dev/null)
if [ -z "$job_status" ]; then
echo "Job with ID $jobid is not found or completed."
break
else
echo "Job with ID $jobid is still running."
echo "Job Status: $job_status"
fi
sleep 60 # Adjust the sleep duration as needed
done
check_file="${{ env.TEST_DIR }}/CEFI_MOM6_CHECK/builds/build/docker-linux-intel/ocean_ice/repro/MOM6SIS2"
if [ -f "$check_file" ]; then
echo "PASSED: $check_file"
else
echo "FAILED: $check_file"
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: 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)
#
sleep 1
while :; do
job_status=$(squeue -h -j "$jobid" -o "%T" 2>/dev/null)
if [ -z "$job_status" ]; then
echo "Job with ID $jobid is not found or completed."
break
else
echo "Job with ID $jobid is still running."
echo "Job Status: $job_status"
fi
sleep 60 # Adjust the sleep duration as needed
done
#
expected_string="All restart files are identical, PASS"
check_file="${{ env.TEST_DIR }}/CEFI_MOM6_CHECK/exps/${{ matrix.case }}/${{ matrix.case }}_o.$jobid"
if [ -f "$check_file" ]; then
if grep -qF "$expected_string" $check_file; then
echo "PASSED: ${{ matrix.case }}"
else
echo "FAILED: ${{ matrix.case }}"
exit 1
fi
else
echo "Can not find $check_file. STOP"
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]
if: ${{ needs.run-CEFI_MOM6-ci.result == 'success' }}
steps:
- name: Add "pass_CEFI_MOM6_RT_container" label on success
run: |
TOKEN=${{ secrets.GITHUB_TOKEN }}
RT_TEST_LABEL="CEFI_MOM6_RT_container"
PASS_LABEL="pass_CEFI_MOM6_RT_container"
# Remove the "CEFI_MOM6_RT_container" label
curl -X DELETE \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ env.PR_NUMBER }}/labels/$RT_TEST_LABEL"
# Add the "pass_CEFI_MOM6_RT_container" label
curl -X POST \
-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\"]}"