• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{% import 'common.yml.j2' as common %}
2
3{%- macro binary_env(config, is_windows=False) -%}
4    env:!{{ binary_env_as_input(config, is_windows, True) }}
5{%- endmacro %}
6
7{%- macro binary_env_as_input(config, is_windows=False, include_skip_tests=False) -%}
8{%- if is_windows %}
9      PYTORCH_ROOT: ${{ github.workspace }}/pytorch
10      BUILDER_ROOT: ${{ github.workspace }}/builder
11{%- else %}
12      PYTORCH_ROOT: /pytorch
13      BUILDER_ROOT: /builder
14{%- endif %}
15      PACKAGE_TYPE: !{{ config["package_type"] }}
16      # TODO: This is a legacy variable that we eventually want to get rid of in
17      #       favor of GPU_ARCH_VERSION
18      DESIRED_CUDA: !{{ config["desired_cuda"] }}
19{%- if config["gpu_arch_version"] %}
20      GPU_ARCH_VERSION: !{{ config["gpu_arch_version"] }}
21{%- endif %}
22      GPU_ARCH_TYPE: !{{ config["gpu_arch_type"] }}
23{%- if include_skip_tests %}
24      SKIP_ALL_TESTS: 1
25{%- endif %}
26{%- if not is_windows %}
27      DOCKER_IMAGE: !{{ config["container_image"] }}
28{%- endif %}
29{%- if config["package_type"] == "manywheel" %}
30  {%- if config["devtoolset"] %}
31      DESIRED_DEVTOOLSET: !{{ config["devtoolset"] }}
32  {%- endif %}
33  {%- if config.use_split_build is defined %}
34      use_split_build: !{{ config["use_split_build"] }}
35  {%- endif %}
36{%- endif %}
37{%- if config["package_type"] == "libtorch" %}
38  {%- if config["libtorch_config"] %}
39      LIBTORCH_CONFIG: !{{ config["libtorch_config"] }}
40  {%- endif %}
41      LIBTORCH_VARIANT: !{{ config["libtorch_variant"] }}
42  {%- if config["devtoolset"] %}
43      DESIRED_DEVTOOLSET: !{{ config["devtoolset"] }}
44  {%- endif %}
45  {%- if is_windows %}
46      # This is a dummy value for libtorch to work correctly with our batch scripts
47      # without this value pip does not get installed for some reason
48      DESIRED_PYTHON: "3.9"
49  {%- endif %}
50
51{%- else %}
52      DESIRED_PYTHON: "!{{ config["python_version"] }}"
53{%- endif %}
54{%- endmacro %}
55
56
57{%- macro upload_binaries(config, is_windows=False, has_test=True, use_s3=True) -%}
58!{{ config["build_name"] }}-upload:  # Uploading
59    if: ${{ github.repository_owner == 'pytorch' }}
60    permissions:
61      id-token: write
62      contents: read
63{%- if has_test %}
64    {%- if config["gpu_arch_type"] == "cuda-aarch64" %}
65    needs: !{{ config["build_name"] }}-build
66    {%- else %}
67    needs: !{{ config["build_name"] }}-test
68    {%- endif %}
69{%- else %}
70    needs: !{{ config["build_name"] }}-build
71{%- endif %}
72    with:!{{ binary_env_as_input(config, is_windows) }}
73      build_name: !{{ config["build_name"] }}
74      {%- if not use_s3 %}
75      use_s3: False
76      {%- endif %}
77    secrets:
78      github-token: ${{ secrets.GITHUB_TOKEN }}
79      conda-pytorchbot-token: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
80      conda-pytorchbot-token-test: ${{ secrets.CONDA_PYTORCHBOT_TOKEN_TEST }}
81    uses: ./.github/workflows/_binary-upload.yml
82{%- endmacro %}
83