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
This commit is contained in:
Hamid Ghaf 2023-07-21 10:15:14 -07:00 committed by GitHub
parent ca31f71966
commit 191aebca62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 43 deletions

View file

@ -21,22 +21,7 @@ concurrency:
jobs: jobs:
# verify-changes determines if the changes are only for docs (website) # verify-changes determines if the changes are only for docs (website)
verify-changes: verify-changes:
if: github.event.pull_request.draft == false uses: ./.github/workflows/verify_changes.yml
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 }}
product-metadata: product-metadata:
# do not run build and test steps for docs changes # do not run build and test steps for docs changes

View file

@ -93,20 +93,19 @@ jobs:
run: | run: |
./.github/scripts/oss-diff.sh ${{ steps.determine-branch.outputs.BRANCH }} HEAD ./.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: test-go:
name: Run Go tests name: Run Go tests
needs: needs:
- setup - setup
# Don't run this job for PR branches starting with: - verify-changes
# 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' # Don't run this job for docs/ui only PRs
# OR
# the 'docs' label is present
if: | if: |
!startsWith(github.head_ref, 'ui/') && needs.verify-changes.outputs.is_docs_change == 'false' &&
!startsWith(github.head_ref, 'backport/ui/') && needs.verify-changes.outputs.is_ui_change == 'false'
!startsWith(github.head_ref, 'docs/') &&
!startsWith(github.head_ref, 'backport/docs/') &&
!contains(github.event.pull_request.labels.*.name, 'docs')
uses: ./.github/workflows/test-go.yml uses: ./.github/workflows/test-go.yml
with: with:
# The regular Go tests use an extra runner to execute the # The regular Go tests use an extra runner to execute the
@ -124,17 +123,12 @@ jobs:
name: Run Go tests with data race detection name: Run Go tests with data race detection
needs: needs:
- setup - setup
# Don't run this job for PR branches starting with: - verify-changes
# 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/' # Don't run this job for docs/ui only PRs
# OR
# the 'docs' label is present
if: | if: |
github.event.pull_request.draft == false && github.event.pull_request.draft == false &&
!startsWith(github.head_ref, 'ui/') && needs.verify-changes.outputs.is_docs_change == 'false' &&
!startsWith(github.head_ref, 'backport/ui/') && needs.verify-changes.outputs.is_ui_change == 'false'
!startsWith(github.head_ref, 'docs/') &&
!startsWith(github.head_ref, 'backport/docs/') &&
!contains(github.event.pull_request.labels.*.name, 'docs')
uses: ./.github/workflows/test-go.yml uses: ./.github/workflows/test-go.yml
with: with:
total-runners: 16 total-runners: 16
@ -152,20 +146,15 @@ jobs:
test-go-fips: test-go-fips:
name: Run Go tests with FIPS configuration name: Run Go tests with FIPS configuration
# Only run this job for the enterprise repo if the PR branch doesn't start with: # Only run this job for the enterprise repo if the PR is not docs/ui only
# 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/'
# OR
# the 'docs' label is not present
if: | if: |
github.event.pull_request.draft == false && github.event.pull_request.draft == false &&
needs.setup.outputs.enterprise == 1 && needs.setup.outputs.enterprise == 1 &&
!startsWith(github.head_ref, 'ui/') && needs.verify-changes.outputs.is_docs_change == 'false' &&
!startsWith(github.head_ref, 'backport/ui/') && needs.verify-changes.outputs.is_ui_change == 'false'
!startsWith(github.head_ref, 'docs/') &&
!startsWith(github.head_ref, 'backport/docs/') &&
!contains(github.event.pull_request.labels.*.name, 'docs')
needs: needs:
- setup - setup
- verify-changes
uses: ./.github/workflows/test-go.yml uses: ./.github/workflows/test-go.yml
with: with:
total-runners: 16 total-runners: 16