From 4290b035f7bb262a3a19374db413360ec6579c48 Mon Sep 17 00:00:00 2001 From: Hara Prasad Date: Thu, 7 Nov 2024 16:34:09 -0600 Subject: [PATCH] Fix integration test workflow (#124) * Update integration test workflow * add skip conditions --- .github/workflows/integration_tests.yaml | 31 +++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/integration_tests.yaml b/.github/workflows/integration_tests.yaml index 19b54928..a4e07268 100644 --- a/.github/workflows/integration_tests.yaml +++ b/.github/workflows/integration_tests.yaml @@ -74,33 +74,28 @@ jobs: # - name: Enable Step Debugging # run: echo "ACTIONS_STEP_DEBUG=true >> $GITHUB_ENV" - # Checkout current branch of gen3-code-vigil if it is the repo under test - - name: Checkout integration test code from dev branch - if: ${{ github.event.repository.name == 'gen3-code-vigil' }} - uses: actions/checkout@v4 - - # Checkout master branch of gen3-code-vigil when another repo is under test - - name: Checkout integration test code from master branch - if: ${{ github.event.repository.name != 'gen3-code-vigil' }} - uses: actions/checkout@v4 - with: - repository: uc-cdis/gen3-code-vigil - ref: master - # Skip integration tests when the following PR labels are present: # not-ready-for-ci / decommission-environment - name: Skip integration tests for specific PR labels + working-directory: ${{ github.workspace }} run: | if gh api repos/$REPO_FN/pulls/$PR_NUM --jq '.labels | map(.name) | .[] | select(. == "not-ready-for-ci" or . == "decommission-environment")' | grep -q .; then echo "Skipping CI since one of the PR labels is present - not-ready-for-ci / decommission-environment" echo "SKIP_TESTS=true" >> $GITHUB_ENV fi + # Checkout current repo + - name: Checkout current repo + if: ${{ env.SKIP_TESTS != 'true' }} + uses: actions/checkout@v4 + # Skip tests when there are only markdown files - name: Skip integration tests if PR contains only Markdown files + if: ${{ env.SKIP_TESTS != 'true' }} + working-directory: ${{ github.workspace }} run: | git fetch -q - FILE_TYPES=$(git show --name-only ${{ env.COMMIT_SHA }} | awk -F . '{print $NF}' | sort -u) + FILE_TYPES=$(git show --name-only ${{ env.COMMIT_SHA }} | grep -o '\S\+\.\S\+' | grep -v '@' | awk -F . '{print $NF}' | sort -u) echo $FILE_TYPES # Check if the only file type is markdown @@ -109,6 +104,14 @@ jobs: echo "SKIP_TESTS=true" >> $GITHUB_ENV fi + # Checkout master branch of gen3-code-vigil when another repo is under test + - name: Checkout integration test code + if: ${{ env.SKIP_TESTS != 'true' && github.event.repository.name != 'gen3-code-vigil' }} + uses: actions/checkout@v4 + with: + repository: uc-cdis/gen3-code-vigil + ref: master + # gen3-integration-tests run with python 3.9 - name: Set up Python if: ${{ env.SKIP_TESTS != 'true' }}