Repository navigation
Enable GCP CI for NVIDIA without collection-time authentication #224
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. | ||
| # All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from types import SimpleNamespace | ||
|
|
||
| import pytest | ||
| import yaml | ||
|
|
||
| from io_utils import fsutil | ||
|
|
||
|
|
||
| def workflow(name): | ||
| return yaml.safe_load(fsutil.read_text(f'.github/workflows/{name}.yml')) | ||
|
|
||
|
|
||
| def evaluate(expression, repository, event, source_repository, target): | ||
| expression = expression.removeprefix('${{').removesuffix('}}').strip() | ||
| expression = expression.replace('&&', 'and').replace('||', 'or') | ||
| github = SimpleNamespace( | ||
| repository=repository, event_name=event, | ||
| event=SimpleNamespace(pull_request=SimpleNamespace( | ||
| head=SimpleNamespace(repo=SimpleNamespace( | ||
| full_name=source_repository))))) | ||
| return eval(expression, {'__builtins__': {}}, { | ||
| 'github': github, 'matrix': SimpleNamespace(test_dir=target), | ||
| 'contains': lambda value, substring: substring in value, | ||
| }) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('repository', ['NVIDIA/kumo-engine', 'other/repo']) | ||
| @pytest.mark.parametrize('event,source', [ | ||
| ('pull_request', 'NVIDIA/kumo-engine'), ('pull_request', 'other/fork'), | ||
| ('push', ''), ('merge_group', ''), ('workflow_dispatch', ''), | ||
| ]) | ||
| @pytest.mark.parametrize('target,gcp', [ | ||
| ('test/io_utils/', True), ('test/connector/', True), | ||
| ('--splits 2 --group 1 test/rest/test_*.py', True), | ||
| ('test/data/', False), | ||
| ]) | ||
| def test_general_auth_routing(repository, event, source, target, gcp): | ||
| job = workflow('testing')['jobs']['pytest'] | ||
| eligible = (repository == 'NVIDIA/kumo-engine' and gcp | ||
| and (event != 'pull_request' or source == repository)) | ||
| enabled = evaluate(job['env']['KUMO_RUN_GCP_TESTS'], repository, | ||
| event, source, target) | ||
| environment = evaluate(job['environment']['name'], repository, | ||
| event, source, target) | ||
|
|
||
| assert enabled == ('1' if eligible else '0') | ||
| assert environment == ('gha-kumo-workflow-tests' if eligible | ||
| else 'azure-adls-tests') | ||
|
|
||
|
|
||
| def test_snowflake_has_no_google(): | ||
| job = workflow('testing_snowflake')['jobs']['pytest'] | ||
| assert not any('google-github-actions/auth' in step.get('uses', '') | ||
| for step in job['steps']) | ||
| assert job['name'] == 'all-snowflake-tests' | ||
|
|
||
|
|
||
| def test_gcs_runs_every_change(): | ||
| document = workflow('testing_gcs') | ||
| # YAML 1.1 interprets the workflow key "on" as True. | ||
| triggers = document[True] | ||
| assert 'pull_request' in triggers | ||
| assert 'paths-ignore' not in triggers['push'] | ||
| job = document['jobs']['pytest-gcs'] | ||
| assert not job.get('continue-on-error', False) | ||
| assert job['name'] == 'gcs-e2e-tests' | ||
| steps = job['steps'] | ||
| assert not any('changed-files' in step.get('uses', '') for step in steps) | ||
| run = next(step for step in steps if step['name'] == 'Run E2E tests') | ||
| assert 'if' not in run |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.