Re-land Fix test report uploading (#64958)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64958

This is a re-do of #64846 which was missing a path prefix for windows test reports

Test Plan: Imported from OSS

Reviewed By: seemethere

Differential Revision: D30915253

Pulled By: driazati

fbshipit-source-id: d14d0a64d2f8aabc335db9c4d0d2b63512887c66
This commit is contained in:
driazati 2021-09-13 18:34:40 -07:00 committed by Facebook GitHub Bot
parent f159f12fee
commit ee554e2e96
19 changed files with 153 additions and 139 deletions

View file

@ -7,6 +7,7 @@ from typing import Dict, Set
import jinja2
import json
import os
import sys
from typing_extensions import Literal
YamlShellBool = Literal["''", 1]
@ -202,7 +203,11 @@ class CIWorkflow:
with open(output_file_path, "w") as output_file:
GENERATED = "generated" # Note that please keep the variable GENERATED otherwise phabricator will hide the whole file
output_file.writelines([f"# @{GENERATED} DO NOT EDIT MANUALLY\n"])
content = workflow_template.render(asdict(self))
try:
content = workflow_template.render(asdict(self))
except Exception as e:
print(f"Failed on template: {workflow_template}", file=sys.stderr)
raise e
output_file.write(content)
if content[-1] != "\n":
output_file.write("\n")

View file

@ -131,24 +131,7 @@ on:
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
if: always()
with:
name: test-reports
retention-days: 14
if-no-files-found: error
path:
test-reports-*.zip
!{{ common.upload_test_reports(name='bazel') }}
!{{ common.upload_test_statistics(build_environment) }}
!{{ common.teardown_ec2_linux() }}
{%- endblock %}

View file

@ -109,3 +109,55 @@ concurrency:
fetch-depth: 0
submodules: !{{ submodules }}
{%- endmacro -%}
{%- macro upload_test_reports(name) -%}
- name: Zip test reports for upload
if: always()
env:
{%- if name == 'linux' or name == 'windows' %}
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
{%- else %}
FILE_SUFFIX: '!{{ name }}-${{ github.job }}'
{%- endif %}
{%- if name == 'windows' %}
shell: powershell
run: |
# -ir => recursive include all files in pattern
7z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml'
{%- else %}
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
{%- endif %}
- uses: actions/upload-artifact@v2
name: Store Test Reports
if: always()
with:
{%- if name == 'linux' or name == 'windows' %}
name: test-reports-${{ matrix.config }}
{%- else %}
name: test-reports-!{{ name }}
{%- endif %}
retention-days: 14
if-no-files-found: error
path:
{%- if name == 'windows' %}
pytorch-${{ github.run_id }}/test-reports-*.zip
{%- else %}
test-reports-*.zip
{%- endif %}
- uses: !{{ upload_artifact_s3_action }}
name: Store Test Reports on S3
if: always()
with:
retention-days: 14
if-no-files-found: error
path:
{%- if name == 'windows' %}
pytorch-${{ github.run_id }}/test-reports-*.zip
{%- else %}
test-reports-*.zip
{%- endif %}
{%- endmacro -%}

View file

@ -349,33 +349,7 @@ jobs:
python3 -mpip install codecov==2.1.12
python3 -mcodecov
{%- endif %}
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
test-reports-*.zip
- uses: !{{ common.upload_artifact_s3_action }}
name: Store PyTorch Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
test-reports-*.zip
!{{ common.upload_test_reports(name='linux') }}
!{{ common.parse_ref() }}
!{{ common.upload_test_statistics(build_environment) }}
!{{ common.teardown_ec2_linux() }}

View file

@ -252,24 +252,7 @@ jobs:
export RUN_SMOKE_TESTS_ONLY=1
fi
.jenkins/pytorch/win-test.sh
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
shell: powershell
run: |
# -ir => recursive include all files in pattern
7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
!{{ common.upload_test_reports(name='windows') }}
!{{ wait_and_kill_ssh() }}
!{{ common.parse_ref() }}
!{{ common.upload_test_statistics(build_environment) }}

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -460,14 +460,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -476,10 +475,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -293,17 +293,24 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: 'bazel-${{ github.job }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-bazel
retention-days: 14
if-no-files-found: error
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store Test Reports on S3
if: always()
with:
name: test-reports
retention-days: 14
if-no-files-found: error
path:

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -456,14 +456,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -472,10 +471,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -454,14 +454,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
run: |
# Remove any previous test reports if they exist
rm -f test-reports-*.zip
zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -470,10 +469,9 @@ jobs:
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store PyTorch Test Reports on S3
name: Store Test Reports on S3
if: always()
with:
name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:

View file

@ -242,14 +242,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
shell: powershell
run: |
# -ir => recursive include all files in pattern
7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
7z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -257,6 +256,14 @@ jobs:
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store Test Reports on S3
if: always()
with:
retention-days: 14
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()

View file

@ -226,14 +226,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
shell: powershell
run: |
# -ir => recursive include all files in pattern
7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
7z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -241,6 +240,14 @@ jobs:
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store Test Reports on S3
if: always()
with:
retention-days: 14
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()

View file

@ -244,14 +244,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
shell: powershell
run: |
# -ir => recursive include all files in pattern
7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
7z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -259,6 +258,14 @@ jobs:
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store Test Reports on S3
if: always()
with:
retention-days: 14
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()

View file

@ -244,14 +244,13 @@ jobs:
- name: Zip test reports for upload
if: always()
env:
COMMIT_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
shell: powershell
run: |
# -ir => recursive include all files in pattern
7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
7z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
name: Store PyTorch Test Reports
name: Store Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
@ -259,6 +258,14 @@ jobs:
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
name: Store Test Reports on S3
if: always()
with:
retention-days: 14
if-no-files-found: error
path:
pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()