mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/63440 Signed-off-by: Eli Uriegas <eliuriegas@fb.com> Test Plan: Imported from OSS Reviewed By: janeyx99 Differential Revision: D30521460 Pulled By: seemethere fbshipit-source-id: e987e170e73fb4f9d9f024bed0e58404ed206848
310 lines
12 KiB
YAML
Generated
310 lines
12 KiB
YAML
Generated
# @generated DO NOT EDIT MANUALLY
|
|
|
|
# Template is at: .github/templates/windows_ci_workflow.yml.j2
|
|
# Generation script: .github/scripts/generate_ci_workflows.py
|
|
name: win-vs2019-cpu-py3
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, unassigned]
|
|
push:
|
|
branches:
|
|
- master
|
|
- release/*
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
BUILD_ENVIRONMENT: win-vs2019-cpu-py3
|
|
BUILD_WHEEL: 1
|
|
CUDA_VERSION: "cpu"
|
|
IN_CI: 1
|
|
INSTALL_WINDOWS_SDK: 1
|
|
PYTHON_VERSION: "3.8"
|
|
SCCACHE_BUCKET: "ossci-compiler-cache"
|
|
VC_PRODUCT: "BuildTools"
|
|
VC_VERSION: ""
|
|
VS_VERSION: "16.8.6"
|
|
VC_YEAR: "2019"
|
|
ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
|
|
no_proxy: localhost,127.0.0.1,amazonaws.com,s3.amazonaws.com,169.254.169.254,169.254.170.2,/var/run/docker.sock
|
|
|
|
concurrency:
|
|
group: win-vs2019-cpu-py3-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
ciflow_should_run:
|
|
runs-on: ubuntu-18.04
|
|
if: ${{ (github.event_name != 'pull_request') || (github.event.action !='unassigned') || (contains(github.event.pull_request.labels.*.name, 'ciflow/cpu') || contains(github.event.pull_request.labels.*.name, 'ciflow/default') || contains(github.event.pull_request.labels.*.name, 'ciflow/win')) }}
|
|
steps:
|
|
- name: noop
|
|
run: echo running ciflow_should_run
|
|
build:
|
|
if: ${{ github.repository_owner == 'pytorch' }}
|
|
runs-on: "windows.4xlarge"
|
|
defaults:
|
|
run:
|
|
working-directory: pytorch-${{ github.run_id }}
|
|
needs: [ciflow_should_run]
|
|
env:
|
|
JOB_BASE_NAME: win-vs2019-cpu-py3-build
|
|
http_proxy: "http://internal-tf-lb-20210727220640487900000002-835786077.us-east-1.elb.amazonaws.com:3128"
|
|
https_proxy: "http://internal-tf-lb-20210727220640487900000002-835786077.us-east-1.elb.amazonaws.com:3128"
|
|
steps:
|
|
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
|
|
uses: seemethere/add-github-ssh-key@v1
|
|
with:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Checkout PyTorch
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
path: pytorch-${{ github.run_id }}
|
|
# deep clone, to allow use of git merge-base
|
|
fetch-depth: 0
|
|
- name: Display EC2 information
|
|
shell: bash
|
|
run: |
|
|
.github/scripts/display_ec2_information.sh
|
|
- name: Install Visual Studio 2019 toolchain
|
|
shell: powershell
|
|
run: |
|
|
.\.circleci\scripts\vs_install.ps1
|
|
- name: Build
|
|
shell: bash
|
|
env:
|
|
PYTORCH_FINAL_PACKAGE_DIR: /c/${{ github.run_id }}/build-results/
|
|
run: |
|
|
.jenkins/pytorch/win-build.sh
|
|
# Upload to github so that people can click and download artifacts
|
|
- name: Upload artifacts to Github
|
|
if: always()
|
|
uses: actions/upload-artifact@v2
|
|
# Don't fail on upload to GH since it's only for user convenience
|
|
continue-on-error: true
|
|
with:
|
|
retention-days: 14
|
|
if-no-files-found: error
|
|
name: ${{ env.BUILD_ENVIRONMENT }}
|
|
path: C:\${{ github.run_id }}\build-results
|
|
- name: Upload artifacts to s3
|
|
if: always()
|
|
uses: seemethere/upload-artifact-s3@9d7ceb0ab39c2c88d93ef7792b27425b27d59162
|
|
with:
|
|
retention-days: 14
|
|
if-no-files-found: error
|
|
name: ${{ env.BUILD_ENVIRONMENT }}
|
|
path: C:\${{ github.run_id }}\build-results
|
|
- name: Wait until all sessions have drained
|
|
shell: powershell
|
|
if: always()
|
|
timeout-minutes: 120
|
|
run: |
|
|
.github\scripts\wait_for_ssh_to_drain.ps1
|
|
- name: Kill active ssh sessions if still around (Useful if workflow was cancelled)
|
|
shell: powershell
|
|
if: always()
|
|
run: |
|
|
.github\scripts\kill_active_ssh_sessions.ps1
|
|
- name: Cleanup build-results and workspaces
|
|
if: always()
|
|
shell: bash
|
|
env:
|
|
PYTORCH_FINAL_PACKAGE_DIR: /c/${{ github.run_id }}/build-results/
|
|
# Should remove the entirety of pytorch-${{ github.run_id }}
|
|
run: |
|
|
rm -rf "${PYTORCH_FINAL_PACKAGE_DIR}"
|
|
rm -rf ./*
|
|
|
|
generate-test-matrix:
|
|
if: ${{ github.repository_owner == 'pytorch' }}
|
|
needs: [ciflow_should_run]
|
|
runs-on: ubuntu-18.04
|
|
env:
|
|
TEST_RUNNER_TYPE: windows.4xlarge
|
|
NUM_TEST_SHARDS: 2
|
|
NUM_TEST_SHARDS_ON_PULL_REQUEST: 2
|
|
PR_BODY: ${{ github.event.pull_request.body }}
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
render-matrix: ${{ steps.set-matrix.outputs.render-matrix }}
|
|
ignore-disabled-issues: ${{ steps.set-matrix.outputs.ignore-disabled-issues }}
|
|
container:
|
|
image: python:3.9
|
|
steps:
|
|
- name: Install dependencies
|
|
run: pip install typing-extensions
|
|
- name: Clone pytorch/pytorch
|
|
uses: actions/checkout@v2
|
|
- name: Generating test matrix
|
|
id: set-matrix
|
|
run: .github/scripts/generate_pytorch_test_matrix.py
|
|
|
|
test:
|
|
env:
|
|
JOB_BASE_NAME: win-vs2019-cpu-py3-test
|
|
SHARD_NUMBER: ${{ matrix.shard }}
|
|
NUM_TEST_SHARDS: ${{ matrix.num_shards }}
|
|
TEST_CONFIG: ${{ matrix.config }}
|
|
http_proxy: "http://internal-tf-lb-20210727220640487900000002-835786077.us-east-1.elb.amazonaws.com:3128"
|
|
https_proxy: "http://internal-tf-lb-20210727220640487900000002-835786077.us-east-1.elb.amazonaws.com:3128"
|
|
RUN_SMOKE_TESTS_ONLY_ON_PR: False
|
|
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
|
|
needs: [build, generate-test-matrix, ciflow_should_run]
|
|
strategy:
|
|
matrix: ${{ fromJson(needs.generate-test-matrix.outputs.matrix) }}
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.runner }}
|
|
defaults:
|
|
run:
|
|
working-directory: pytorch-${{ github.run_id }}
|
|
steps:
|
|
- name: Checkout PyTorch
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
path: pytorch-${{ github.run_id }}
|
|
# deep clone, to allow use of git merge-base
|
|
fetch-depth: 0
|
|
- name: Display EC2 information
|
|
shell: bash
|
|
run: |
|
|
.github/scripts/display_ec2_information.sh
|
|
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
|
|
uses: seemethere/add-github-ssh-key@v1
|
|
with:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Install Visual Studio 2019 toolchain
|
|
shell: powershell
|
|
run: |
|
|
.\.circleci\scripts\vs_install.ps1
|
|
- uses: seemethere/download-artifact-s3@0504774707cbc8603d7dca922e8026eb8bf3b47b
|
|
name: Download PyTorch Build Artifacts
|
|
with:
|
|
name: ${{ env.BUILD_ENVIRONMENT }}
|
|
path: C:\${{ github.run_id }}\build-results
|
|
- name: Check build-results folder
|
|
shell: powershell
|
|
run: |
|
|
tree /F C:\$Env:GITHUB_RUN_ID\build-results
|
|
# Needed for coverage in win-test.sh
|
|
- uses: actions/setup-python@v2
|
|
name: Setup Python3
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Run test scripts
|
|
shell: bash
|
|
env:
|
|
PYTORCH_FINAL_PACKAGE_DIR: /c/${{ github.run_id }}/build-results/
|
|
run: |
|
|
if [[ $NUM_TEST_SHARDS -ne 2 ]]; then
|
|
export SHARD_NUMBER=0
|
|
fi
|
|
if [[ -n $GITHUB_HEAD_REF && "$RUN_SMOKE_TESTS_ONLY_ON_PR" == "true" ]]; then
|
|
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
|
|
- name: Wait until all sessions have drained
|
|
shell: powershell
|
|
if: always()
|
|
timeout-minutes: 120
|
|
run: |
|
|
.github\scripts\wait_for_ssh_to_drain.ps1
|
|
- name: Kill active ssh sessions if still around (Useful if workflow was cancelled)
|
|
shell: powershell
|
|
if: always()
|
|
run: |
|
|
.github\scripts\kill_active_ssh_sessions.ps1
|
|
- name: Cleanup workspace
|
|
if: always()
|
|
shell: bash
|
|
# Should remove the entirety of pytorch-${{ github.run_id }}
|
|
run: |
|
|
rm -rf ./*
|
|
|
|
# this is a separate step from test because the log files from test are too
|
|
# long: basically, GitHub tries to render all of the log files when you click
|
|
# through an action causing extreme slowdown on actions that contain too many
|
|
# logs (like test); we can always move it back to the other one, but it
|
|
# doesn't create the best experience
|
|
render_test_results:
|
|
needs: [generate-test-matrix, test, ciflow_should_run]
|
|
if: ${{ needs.test.result != 'skipped' || failure() }}
|
|
runs-on: linux.2xlarge
|
|
strategy:
|
|
matrix: ${{ fromJson(needs.generate-test-matrix.outputs.render-matrix) }}
|
|
fail-fast: false
|
|
# TODO: Make this into a composite step
|
|
steps:
|
|
- name: Log in to ECR
|
|
run: |
|
|
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
|
|
bash /tmp/ecr-login.sh
|
|
rm /tmp/ecr-login.sh
|
|
- name: Chown workspace
|
|
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: Clean workspace
|
|
run: |
|
|
rm -rf "${GITHUB_WORKSPACE:?}/*"
|
|
- name: Checkout PyTorch
|
|
uses: actions/checkout@v2
|
|
with:
|
|
# deep clone, to allow tools/stats/print_test_stats.py to use Git commands
|
|
fetch-depth: 0
|
|
- name: Display EC2 information
|
|
shell: bash
|
|
run: |
|
|
.github/scripts/display_ec2_information.sh
|
|
- uses: actions/download-artifact@v2
|
|
name: Download PyTorch Test Reports
|
|
with:
|
|
name: test-reports-${{ matrix.config }}
|
|
path: .
|
|
- name: Unzip test reports
|
|
run: |
|
|
unzip -o 'test-reports-*.zip'
|
|
- name: Install dependencies
|
|
# boto3 version copied from .circleci/docker/common/install_conda.sh
|
|
run: |
|
|
pip3 install -r requirements.txt
|
|
pip3 install boto3==1.16.34 junitparser rich
|
|
- name: Output Test Results (Click Me)
|
|
run: |
|
|
python3 tools/render_junit.py test
|
|
- name: Parse ref
|
|
id: parse-ref
|
|
run: .github/scripts/parse_ref.py
|
|
- name: Display and upload test statistics (Click Me)
|
|
# temporary hack: set CIRCLE_* vars, until we update
|
|
# tools/stats/print_test_stats.py to natively support GitHub Actions
|
|
env:
|
|
AWS_DEFAULT_REGION: us-east-1
|
|
CIRCLE_BRANCH: ${{ steps.parse-ref.outputs.branch }}
|
|
JOB_BASE_NAME: win-vs2019-cpu-py3-test
|
|
CIRCLE_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
CIRCLE_SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
CIRCLE_TAG: ${{ steps.parse-ref.outputs.tag }}
|
|
CIRCLE_WORKFLOW_ID: '${{ github.run_id }}_${{ github.run_number }}'
|
|
run: |
|
|
python3 -m tools.stats.print_test_stats --upload-to-s3 --compare-with-s3 test
|