Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internal] Skip integration tests on docs-only changes #4165

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Oct 28, 2024

Changes

Currently, integration tests run on every PR. This takes a considerable amount of time, up to around an hour and 15 minutes. When a change only affects the docs/ directory, there is no need to run integration tests, as that directory only includes the public documentation and user guides. Thus, integration tests can be skipped.

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@mgyucht mgyucht requested review from a team as code owners October 28, 2024 14:00
@mgyucht mgyucht requested review from hectorcast-db and removed request for a team October 28, 2024 14:00
steps:
- uses: actions/checkout@v3

- name: Check if all changes are in docs/ directory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an action to that does the grep for you.

      - uses: dorny/paths-filter@v3
        id: changes
        with:
          filters: |
            integration_tests_required:
              - '**/*'
              - '!docs/**'
needs: [changes]
if: '{{ needs.changes.outputs.integration_tests_required == "true" }}'

auto-approve:
if: github.event_name == 'merge_group'
needs: check-integration-test-changes
if: '{{ github.event_name == "merge_group" || env.integration_tests_required == "false" }}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this won't work in the merge queue. If the "need" job is skipped, this will be skipped too (even with the "if" condition). You can use always() to ensure it runs. Also, use the output
if: always() && (github.event_name == 'merge_group' || needs.check-integration-test-changes.outputs.integration_tests_required == 'true')


trigger-tests:
needs: check-integration-test-changes
if: '{{ env.integration_tests_required == "true" }}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an output, not an env.
Define the output and set an id for the job

jobs:
  changes:
    runs-on: ubuntu-latest
    outputs:  <----
      integration_tests_required: ${{ steps.filter.outputs.integration_tests_required }}
    steps:
      - uses: actions/checkout@v4
      
      - uses: dorny/paths-filter@v3
        id: filter <----
        with:
          filters: |
            integration_tests_required:
              - '!**/*.md'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants