import jinja2
import json
import os
-import sys
from typing_extensions import Literal
YamlShellBool = Literal["''", 1]
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"])
- try:
- content = workflow_template.render(asdict(self))
- except Exception as e:
- print(f"Failed on template: {workflow_template}", file=sys.stderr)
- raise e
+ content = workflow_template.render(asdict(self))
output_file.write(content)
if content[-1] != "\n":
output_file.write("\n")
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)" .
- !{{ common.upload_test_reports(name='bazel') }}
+ - 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_statistics(build_environment) }}
!{{ common.teardown_ec2_linux() }}
{%- endblock %}
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:
- test-reports-*.zip
- - uses: !{{ upload_artifact_s3_action }}
- name: Store Test Reports on S3
- if: always()
- with:
- retention-days: 14
- if-no-files-found: error
- path:
- test-reports-*.zip
-{%- endmacro -%}
python3 -mpip install codecov==2.1.12
python3 -mcodecov
{%- endif %}
- !{{ common.upload_test_reports(name='linux') }}
+ - 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.parse_ref() }}
!{{ common.upload_test_statistics(build_environment) }}
!{{ common.teardown_ec2_linux() }}
export RUN_SMOKE_TESTS_ONLY=1
fi
.jenkins/pytorch/win-test.sh
- !{{ common.upload_test_reports(name='windows') }}
+ - 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
!{{ wait_and_kill_ssh() }}
!{{ common.parse_ref() }}
!{{ common.upload_test_statistics(build_environment) }}
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: 'bazel-${{ github.job }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- 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
+ name: Store PyTorch Test Reports
if: always()
with:
+ name: test-reports
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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-${FILE_SUFFIX}.zip" test -i '*.xml'
+ zip -r "test-reports-${COMMIT_SHA1}-${WORKFLOW_ID}.zip" test -i '*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ name: Store PyTorch Test Reports
if: always()
with:
name: test-reports-${{ matrix.config }}
path:
test-reports-*.zip
- uses: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
+ name: Store PyTorch Test Reports on S3
if: always()
with:
+ name: test-reports-${{ matrix.config }}
retention-days: 14
if-no-files-found: error
path:
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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:FILE_SUFFIX.zip" -ir'!test\*.xml'
+ 7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ 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: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
- if: always()
- with:
- retention-days: 14
- if-no-files-found: error
- path:
- test-reports-*.zip
+ pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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:FILE_SUFFIX.zip" -ir'!test\*.xml'
+ 7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ 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: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
- if: always()
- with:
- retention-days: 14
- if-no-files-found: error
- path:
- test-reports-*.zip
+ pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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:FILE_SUFFIX.zip" -ir'!test\*.xml'
+ 7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ 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: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
- if: always()
- with:
- retention-days: 14
- if-no-files-found: error
- path:
- test-reports-*.zip
+ pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()
- name: Zip test reports for upload
if: always()
env:
- FILE_SUFFIX: '${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}'
+ 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:FILE_SUFFIX.zip" -ir'!test\*.xml'
+ 7z a "test-reports-$Env:COMMIT_SHA1-$Env:WORKFLOW_ID.zip" -ir'!test\*.xml'
- uses: actions/upload-artifact@v2
- name: Store Test Reports
+ 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: seemethere/upload-artifact-s3@v3
- name: Store Test Reports on S3
- if: always()
- with:
- retention-days: 14
- if-no-files-found: error
- path:
- test-reports-*.zip
+ pytorch-${{ github.run_id }}/test-reports-*.zip
- name: Wait until all sessions have drained
shell: powershell
if: always()