From 191aebca62d0aaa3f93dbf917a1ca56218d87607 Mon Sep 17 00:00:00 2001 From: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:15:14 -0700 Subject: [PATCH] use verify changes for docs to skip tests (#21620) (#22017) * use verify changes for docs to skip tests * add verify-changes to the needed jobs * skip go tests for doc/ui only changes * fix a job ref * change names, remove script * remove ui conditions * separate flags * feedback --- .github/workflows/build.yml | 17 +-------------- .github/workflows/ci.yml | 43 ++++++++++++++----------------------- 2 files changed, 17 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b78cb757..48e84d87b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,22 +21,7 @@ concurrency: jobs: # verify-changes determines if the changes are only for docs (website) verify-changes: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - outputs: - is_docs_change: ${{ steps.get-changeddir.outputs.is_docs_change }} - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 # Use fetch depth 0 for comparing changes to base branch - - name: Get changed directories - id: get-changeddir - env: - TYPE: ${{ github.event_name }} - REF_NAME: ${{ github.ref_name }} - BASE: ${{ github.base_ref }} - run: ./.github/scripts/verify_changes.sh ${{ env.TYPE }} ${{ env.REF_NAME }} ${{ env.BASE }} + uses: ./.github/workflows/verify_changes.yml product-metadata: # do not run build and test steps for docs changes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feb769310..e5762bc91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,20 +93,19 @@ jobs: run: | ./.github/scripts/oss-diff.sh ${{ steps.determine-branch.outputs.BRANCH }} HEAD + verify-changes: + name: Verify doc-ui only PRs + uses: ./.github/workflows/verify_changes.yml + test-go: name: Run Go tests needs: - setup - # Don't run this job for PR branches starting with: - # 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' - # OR - # the 'docs' label is present + - verify-changes + # Don't run this job for docs/ui only PRs if: | - !startsWith(github.head_ref, 'ui/') && - !startsWith(github.head_ref, 'backport/ui/') && - !startsWith(github.head_ref, 'docs/') && - !startsWith(github.head_ref, 'backport/docs/') && - !contains(github.event.pull_request.labels.*.name, 'docs') + needs.verify-changes.outputs.is_docs_change == 'false' && + needs.verify-changes.outputs.is_ui_change == 'false' uses: ./.github/workflows/test-go.yml with: # The regular Go tests use an extra runner to execute the @@ -124,17 +123,12 @@ jobs: name: Run Go tests with data race detection needs: - setup - # Don't run this job for PR branches starting with: - # 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' - # OR - # the 'docs' label is present + - verify-changes + # Don't run this job for docs/ui only PRs if: | github.event.pull_request.draft == false && - !startsWith(github.head_ref, 'ui/') && - !startsWith(github.head_ref, 'backport/ui/') && - !startsWith(github.head_ref, 'docs/') && - !startsWith(github.head_ref, 'backport/docs/') && - !contains(github.event.pull_request.labels.*.name, 'docs') + needs.verify-changes.outputs.is_docs_change == 'false' && + needs.verify-changes.outputs.is_ui_change == 'false' uses: ./.github/workflows/test-go.yml with: total-runners: 16 @@ -152,20 +146,15 @@ jobs: test-go-fips: name: Run Go tests with FIPS configuration - # Only run this job for the enterprise repo if the PR branch doesn't start with: - # 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' - # OR - # the 'docs' label is not present + # Only run this job for the enterprise repo if the PR is not docs/ui only if: | github.event.pull_request.draft == false && needs.setup.outputs.enterprise == 1 && - !startsWith(github.head_ref, 'ui/') && - !startsWith(github.head_ref, 'backport/ui/') && - !startsWith(github.head_ref, 'docs/') && - !startsWith(github.head_ref, 'backport/docs/') && - !contains(github.event.pull_request.labels.*.name, 'docs') + needs.verify-changes.outputs.is_docs_change == 'false' && + needs.verify-changes.outputs.is_ui_change == 'false' needs: - setup + - verify-changes uses: ./.github/workflows/test-go.yml with: total-runners: 16