Skip to content

Actions: Create initial integration test for default filters #19239

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

Conversation

adityasharad
Copy link
Collaborator

  • First ensure autobuild invocations work when the CLI path contains spaces. This unblocks integration testing, since our integration tests always use a CLI with a space in its directory name.
  • Then add an integration test for default filter behaviour.
    • Include a reachable workflow, and several unreachable workflow files.
    • Include action metadata files at various depths, all reachable.
    • This test exercises the default filters when the user doesn't
      specify paths/paths-ignore.

There is currently no integration test workflow for Actions; I will add this in a separate internal PR. Those workflows will only work when there is at least one test case to run.

… spaces

Quote the paths to the CodeQL CLI dist or autobuild scripts when invoked.

This unblocks integration testing, since our integration tests always use
a CLI with a space in its directory name.
@adityasharad adityasharad requested a review from a team as a code owner April 8, 2025 00:10
@github-actions github-actions bot added the Actions Analysis of GitHub Actions label Apr 8, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an initial integration test for default filter behavior and verifies that autobuild invocations work correctly when the CLI path contains spaces.

  • Added a Python integration test that sets up a CodeQL database.
  • Created an unreachable workflow YAML to simulate non-reachable workflows.
  • Defined a composite action and a workflow file under .github for default filter testing.

Reviewed Changes

Copilot reviewed 4 out of 12 changed files in this pull request and generated no comments.

File Description
actions/ql/integration-tests/filters-default/test.py Added a simple integration test setting up a CodeQL database
actions/ql/integration-tests/filters-default/src/unreachable-workflow.yml Included an unreachable workflow configuration for testing default filters
actions/ql/integration-tests/filters-default/src/action.yml Added a composite action file to support the test scenario
actions/ql/integration-tests/filters-default/src/.github/workflows/workflow.yml Added a workflow definition that runs on push events
Files not reviewed (8)
  • actions/extractor/tools/autobuild-impl.ps1: Language not supported
  • actions/extractor/tools/autobuild.cmd: Language not supported
  • actions/extractor/tools/autobuild.sh: Language not supported
  • actions/ql/integration-tests/filters-default/actions.expected: Language not supported
  • actions/ql/integration-tests/filters-default/actions.ql: Language not supported
  • actions/ql/integration-tests/filters-default/src/.github/action.yaml: Language not supported
  • actions/ql/integration-tests/filters-default/src/.github/actions/action-name/action.yml: Language not supported
  • actions/ql/integration-tests/filters-default/src/.github/unreachable-workflow.yml: Language not supported
Comments suppressed due to low confidence (1)

actions/ql/integration-tests/filters-default/test.py:1

  • Consider adding assertions or validations within the test to confirm that the default filters are correctly applied, ensuring that the integration test exercises the intended behavior.
def test(codeql, actions):

Include a reachable workflow, and several unreachable workflow files.
Include action metadata files at various depths, all reachable.
This test exercises the default filters when the user doesn't
specify paths/paths-ignore.
@adityasharad adityasharad force-pushed the actions/integration-test-default-filters branch from 72a7a6d to 0bb4ab9 Compare April 8, 2025 00:15
| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
| src/action.yml:1:1:11:32 | name: ' ... action' |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct? I was not expecting it to be pulled in.

Copy link
Contributor

Choose a reason for hiding this comment

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

The autobuild.sh file includes include:**/action.yml as a pattern. So, this makes sense.

| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
| src/action.yml:1:1:11:32 | name: ' ... action' |
Copy link
Contributor

Choose a reason for hiding this comment

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

The autobuild.sh file includes include:**/action.yml as a pattern. So, this makes sense.

@adityasharad
Copy link
Collaborator Author

Thanks for reviews! The test workflow in an internal PR is passing for Linux and macOS but failing for Windows. To unblock further work on the internal and external changes, I'm merging this now and will follow up with fixes.

@adityasharad adityasharad merged commit c4c351c into github:main Apr 8, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Analysis of GitHub Actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants