-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add test runner workflow #1020
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
Closed
Closed
Add test runner workflow #1020
Changes from all commits
Commits
Show all changes
5 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: presubmit | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| checker: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| python-version: ['3.11'] | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install . | ||
| pip install pytest | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| tests/run_tests.sh | ||
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 |
|---|---|---|
|
|
@@ -118,6 +118,14 @@ def _get_shared_topics_parser() -> argparse.ArgumentParser: | |
| return shared | ||
|
|
||
|
|
||
| def _get_shared_competition_topics_parser() -> argparse.ArgumentParser: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make sure your PR only includes related changes. i.e. the changes to setup the test runner. |
||
| shared = argparse.ArgumentParser(add_help=False) | ||
| shared.add_argument("-p", "--page", dest="page", type=int, default=1, required=False, help=Help.param_page) | ||
| shared.add_argument("-v", "--csv", dest="csv_display", action="store_true", help=Help.param_csv) | ||
| shared.add_argument("-q", "--quiet", dest="quiet", action="store_true", help=Help.param_quiet) | ||
| return shared | ||
|
|
||
|
|
||
| def parse_competitions(subparsers) -> None: | ||
| parser_competitions = subparsers.add_parser( | ||
| "competitions", formatter_class=argparse.RawTextHelpFormatter, help=Help.group_competitions, aliases=["c"] | ||
|
|
@@ -380,13 +388,14 @@ def parse_competitions(subparsers) -> None: | |
| parser_competitions_pages.set_defaults(func=api.competition_list_pages_cli) | ||
|
|
||
| shared_topics = _get_shared_topics_parser() | ||
| shared_competition_topics = _get_shared_competition_topics_parser() | ||
|
|
||
| # Competitions list discussion topics (with 'show' and 'list' subcommands) | ||
| parser_competitions_topics = subparsers_competitions.add_parser( | ||
| "topics", | ||
| formatter_class=argparse.RawTextHelpFormatter, | ||
| help=Help.command_competitions_topics, | ||
| parents=[shared_topics], | ||
| parents=[shared_competition_topics], | ||
| ) | ||
| subparsers_competitions_topics = parser_competitions_topics.add_subparsers(title="commands", dest="command") | ||
| subparsers_competitions_topics.choices = Help.entity_topics_choices | ||
|
|
@@ -399,7 +408,7 @@ def parse_competitions(subparsers) -> None: | |
| "list", | ||
| formatter_class=argparse.RawTextHelpFormatter, | ||
| help=Help.command_competitions_topics, | ||
| parents=[shared_topics], | ||
| parents=[shared_competition_topics], | ||
| ) | ||
| parser_competitions_topics_list_optional = parser_competitions_topics_list._action_groups.pop() | ||
| parser_competitions_topics_list_optional.add_argument( | ||
|
|
@@ -415,9 +424,6 @@ def parse_competitions(subparsers) -> None: | |
| required=False, | ||
| help="Sort order. One of: " + ", ".join(KaggleApi.valid_forum_topic_sort_by), | ||
| ) | ||
| parser_competitions_topics_list_optional.add_argument( | ||
| "--search", dest="search", required=False, help=Help.param_search | ||
| ) | ||
| parser_competitions_topics_list._action_groups.append(parser_competitions_topics_list_optional) | ||
| parser_competitions_topics_list.set_defaults(func=api.competition_list_topics_cli) | ||
|
|
||
|
|
||
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,19 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Exit immediately if a command exits with a non-zero status. | ||
| set -e | ||
|
|
||
| # Ensure we are in the tests directory. | ||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
| cd "$SCRIPT_DIR" | ||
|
|
||
| echo "Running fast unit tests with pytest..." | ||
| (cd "$SCRIPT_DIR/.." && pytest) | ||
|
|
||
| # Run live integration tests only if stdin is a TTY (invoked interactively) | ||
| if [ -t 0 ]; then | ||
| echo "Running live integration tests (unit_tests.py)..." | ||
| python3 -m unittest unit_tests.py | ||
| fi | ||
|
|
||
| echo "All tests passed!" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All our CI/CD stuff is setup to use Google Cloud Build. We should stick with that rather than using GitHub workflow.
Can you add simply add a new "test step" after the existing step we already run on every PR:
kaggle-cli/tools/cicd/cloudbuild.yaml
Lines 38 to 43 in 31c7e28