1
{%- set upload_artifact_s3_action = "seemethere/upload-artifact-s3@v5" -%}
2
{%- set download_artifact_s3_action = "seemethere/download-artifact-s3@v4" -%}
3
{%- set upload_artifact_action = "actions/upload-artifact@v3" -%}
4
{%- set download_artifact_action = "actions/download-artifact@v3" -%}
6
{%- set timeout_minutes = 240 -%}
8
# NOTE: If testing pytorch/builder changes you can change this variable to change what pytorch/builder reference
9
# the binary builds will check out
10
{%- set builder_repo = "pytorch/builder" -%}
11
{%- set builder_branch = "main" -%}
13
{%- macro concurrency(build_environment) -%}
15
group: !{{ build_environment }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
16
cancel-in-progress: true
19
{%- macro display_ec2_information() -%}
20
- name: Display EC2 information
24
function get_ec2_metadata() {
25
# Pulled from instance metadata endpoint for EC2
26
# see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
28
curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
30
echo "ami-id: $(get_ec2_metadata ami-id)"
31
echo "instance-id: $(get_ec2_metadata instance-id)"
32
echo "instance-type: $(get_ec2_metadata instance-type)"
33
echo "system info $(uname -a)"
36
{%- macro setup_ec2_windows() -%}
37
!{{ display_ec2_information() }}
38
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
39
uses: pytorch/test-infra/.github/actions/setup-ssh@main
40
continue-on-error: true
42
github-secret: ${{ secrets.GITHUB_TOKEN }}
43
# Needed for binary builds, see: https://github.com/pytorch/pytorch/issues/73339#issuecomment-1058981560
44
- name: Enable long paths on Windows
47
Set-ItemProperty -Path "HKLM:\\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
48
# Since it's just a defensive command, the workflow should continue even the command fails. This step can be
49
# removed once Windows Defender is removed from the AMI
50
- name: Disables Windows Defender scheduled and real-time scanning for files in directories used by PyTorch
51
continue-on-error: true
54
Add-MpPreference -ExclusionPath $(Get-Location).tostring(),$Env:TEMP -ErrorAction Ignore
55
# Let's both exclude the path and disable Windows Defender completely just to be sure
56
# that it doesn't interfere
57
Set-MpPreference -DisableRealtimeMonitoring $True -ErrorAction Ignore
60
{%- macro apply_filter() -%}
61
- name: Check if the job is disabled
63
# Binary workflows checkout to pytorch subdirectory instead
64
uses: ./pytorch/.github/actions/filter-test-configs
66
github-token: ${{ secrets.GITHUB_TOKEN }}
67
# NB: Use a mock test matrix with a default value here. After filtering, if the
68
# returned matrix is empty, it means that the job is disabled
71
{ config: "default" },
75
{%- macro checkout(submodules="recursive", deep_clone=True, directory="", repository="pytorch/pytorch", branch="", checkout_pr_head=True) -%}
76
- name: Checkout !{{ 'PyTorch' if repository == "pytorch/pytorch" else repository }}
77
uses: malfet/checkout@silent-checkout
81
{%- elif checkout_pr_head %}
82
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
85
# deep clone, to allow use of git merge-base
88
submodules: !{{ submodules }}
89
{%- if repository != "pytorch/pytorch" %}
90
repository: !{{ repository }}
93
path: !{{ directory }}
96
- name: Clean !{{ 'PyTorch' if repository == "pytorch/pytorch" else repository }} checkout
98
# Remove any artifacts from the previous checkouts
101
working-directory: !{{ directory }}
105
{%- macro wait_and_kill_ssh_windows(pytorch_directory="") -%}
106
- name: Wait until all sessions have drained
108
{%- if pytorch_directory %}
109
working-directory: !{{ pytorch_directory }}
114
.github\scripts\wait_for_ssh_to_drain.ps1
115
- name: Kill active ssh sessions if still around (Useful if workflow was cancelled)
117
{%- if pytorch_directory %}
118
working-directory: !{{ pytorch_directory }}
122
.github\scripts\kill_active_ssh_sessions.ps1