Skip to content

Commit

Permalink
Fix job identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ZainRizvi committed May 5, 2023
1 parent bf09740 commit 4f121e5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/actions/pytest-cache-download/action.yml
Expand Up @@ -6,8 +6,8 @@ inputs:
cache_dir:
description: Path to the pytest cache directory, relative to $GITHUB_WORKSPACE. This is where the merged cache will be placed.
required: true
build_environment:
description: The build environment
job_identifier:
description: Text that uniquely identifies a given job type within a workflow. All shards of a job should share the same job identifier.
required: true
github-token:
description: GITHUB_TOKEN
Expand All @@ -26,17 +26,17 @@ runs:
max_attempts: 5
retry_wait_seconds: 30
command: |
set -eux
set -eu
python3 -m pip install boto3==1.19.12
- name: Download the cache
shell: bash
env:
CACHE_DIR: ${{ inputs.cache_dir }}
JOB_IDENTIFIER: ${{ github.workflow }}_${{ github.job }}_${{ inputs.build_environment }}
JOB_IDENTIFIER: ${{ inputs.job_identifier }}
SHARD: ${{ inputs.shard }}
run: |
set +x
set -eux
echo "all the commands sent to the below script:"
echo "cache_dir: $GITHUB_WORKSPACE/$CACHE_DIR"
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/pytest-cache-upload/action.yml
Expand Up @@ -10,8 +10,8 @@ inputs:
description: Shard number for the current job
required: false
default: "0"
build_environment:
description: The build environment
job_identifier:
description: Text that uniquely identifies a given job type within a workflow. All shards of a job should share the same job identifier.
required: true
github-token:
description: GITHUB_TOKEN
Expand All @@ -30,17 +30,17 @@ runs:
max_attempts: 5
retry_wait_seconds: 30
command: |
set -eux
set -eu
python3 -m pip install boto3==1.19.12
- name: Upload the cache
shell: bash
env:
CACHE_DIR: ${{ inputs.cache_dir }}
JOB_IDENTIFIER: ${{ github.workflow }}_${{ github.job }}_${{ inputs.build_environment }}
JOB_IDENTIFIER: ${{ inputs.job_identifier }}
SHARD: ${{ inputs.shard }}
run: |
set -x
set -eux
echo "all the commands sent to the below script:"
echo "cache_dir: $GITHUB_WORKSPACE/$CACHE_DIR"
Expand Down
7 changes: 5 additions & 2 deletions .github/scripts/pytest_cache.py
Expand Up @@ -38,6 +38,9 @@ def main():

args = parser.parse_args()

pr_identifier = PRIdentifier(args.pr_identifier)
print(f"PR identifier for `{args.pr_identifier}` is `{pr_identifier}`")

if args.upload:
print(f"Uploading cache with args {args}")

Expand All @@ -50,7 +53,7 @@ def main():
# Does the cache even mark any failed tests?

upload_pytest_cache(
pr_identifier=PRIdentifier(args.pr_identifier),
pr_identifier=pr_identifier,
job_identifier=args.job_identifier,
shard=args.shard,
cache_dir=args.cache_dir,
Expand All @@ -61,7 +64,7 @@ def main():
if args.download:
print(f"Downloading cache with args {args}")
download_pytest_cache(
pr_identifier=PRIdentifier(args.pr_identifier),
pr_identifier=pr_identifier,
job_identifier=args.job_identifier,
dest_cache_dir=args.cache_dir,
bucket=args.bucket,
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_linux-build.yml
Expand Up @@ -112,12 +112,13 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# Just for testing
- name: Download pytest cache
uses: ./.github/actions/pytest-cache-download
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
cache_dir: .pytest_cache
build_environment: ${{ inputs.build-environment }}
job_identifier: ${{ github.workflow }}_${{ inputs.build_environment }}_${{ github.job }}_default

# Apply the filter logic to the build step too if the test-config label is already there
- name: Select all requested test configurations (if the test matrix is available)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_linux-test.yml
Expand Up @@ -120,7 +120,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
cache_dir: .pytest_cache
build_environment: ${{ inputs.build-environment }}
job_identifier: ${{ github.workflow }}_${{ inputs.build_environment }}_${{ github.job }}_${{ matrix.config }}

- name: Set Test step time
id: test-timeout
Expand Down Expand Up @@ -238,6 +238,7 @@ jobs:
cache_dir: .pytest_cache
shard: ${{ matrix.shard }}
build_environment: ${{ inputs.build-environment }}
job_identifier: ${{ github.workflow }}_${{ inputs.build_environment }}_${{ github.job }}_${{ matrix.config }}

- name: Print remaining test logs
shell: bash
Expand Down

0 comments on commit 4f121e5

Please sign in to comment.