-
Notifications
You must be signed in to change notification settings - Fork 21.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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,52 @@ | ||
import argparse | ||
import sys | ||
from pytest_caching_utils import * | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description="Upload this job's the pytest cache to S3") | ||
|
||
mode = parser.add_mutually_exclusive_group(required=True) | ||
mode.add_argument('--upload', action='store_true', help='Upload the pytest cache to S3') | ||
mode.add_argument('--download', action='store_true', help='Download the pytest cache from S3, merging it with any local cache') | ||
|
||
parser.add_argument('--cache_dir', required=True, help='Path to the folder pytest uses for its cache') | ||
parser.add_argument('--pr_identifier', required=True, help='A unique PR identifier') | ||
parser.add_argument('--workflow', required=True, help='The workflow name') | ||
parser.add_argument('--job', required=True, help='The job name') | ||
parser.add_argument('--shard', required='--upload' in sys.argv, help='The shard id') # Only required for upload | ||
|
||
parser.add_argument('--temp_dir', required=False, help='Directory to store temp files') | ||
parser.add_argument('--bucket', required=False, help='The S3 bucket to upload the cache to') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.upload: | ||
print(f"Uploading cache with args {args}") | ||
|
||
# TODO: First check if it's even worth uploading a new cache: | ||
# Does the cache even mark any failed tests? | ||
|
||
upload_pytest_cache( | ||
pr_identifier=args.pr_identifier, | ||
workflow=args.workflow, | ||
job=args.job, | ||
shard=args.shard, | ||
pytest_cache_dir=args.pytest_cache_dir, | ||
bucket=args.bucket, | ||
temp_dir=args.temp_dir, | ||
) | ||
|
||
if args.download: | ||
print(f"Downloading cache with args {args}") | ||
download_pytest_cache( | ||
Check failure on line 41 in .github/scripts/pytest_cache.py
|
||
pr_identifier=args.pr_identifier, | ||
workflow=args.workflow, | ||
job=args.job, | ||
pytest_cache_dir=args.pytest_cache_dir, | ||
bucket=args.bucket, | ||
temp_dir=args.temp_dir, | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
This file was deleted.
Oops, something went wrong.