From d9933668bfcc8feb13de3800b43c393f2fb5ffaf Mon Sep 17 00:00:00 2001 From: Yi-Cheng Teng - NOAA GFDL <143743249+yichengt900@users.noreply.github.com> Date: Sat, 16 Nov 2024 21:44:08 -0500 Subject: [PATCH] Refactor GHA CI workflow (#116) * test artifact * fix artifact download path * Restore executable permission * try compress artifact * refactor cleanup section * Deactivate CEFI_MOM6_C6-CI --- .github/workflows/CEFI_MOM6-ci.yaml | 46 +++++++++++++------ ..._MOM6_c6-ci.yaml => CEFI_MOM6_c6-ci._yaml} | 0 2 files changed, 33 insertions(+), 13 deletions(-) rename .github/workflows/{CEFI_MOM6_c6-ci.yaml => CEFI_MOM6_c6-ci._yaml} (100%) diff --git a/.github/workflows/CEFI_MOM6-ci.yaml b/.github/workflows/CEFI_MOM6-ci.yaml index 53c329363..f7b035506 100644 --- a/.github/workflows/CEFI_MOM6-ci.yaml +++ b/.github/workflows/CEFI_MOM6-ci.yaml @@ -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) # @@ -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] @@ -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\"]}" diff --git a/.github/workflows/CEFI_MOM6_c6-ci.yaml b/.github/workflows/CEFI_MOM6_c6-ci._yaml similarity index 100% rename from .github/workflows/CEFI_MOM6_c6-ci.yaml rename to .github/workflows/CEFI_MOM6_c6-ci._yaml