• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: linux-build
2
3on:
4  workflow_call:
5    inputs:
6      build-environment:
7        required: true
8        type: string
9        description: Top-level label for what's being built/tested.
10      docker-image-name:
11        required: true
12        type: string
13        description: Name of the base docker image to build with.
14      build-generates-artifacts:
15        required: false
16        type: boolean
17        default: true
18        description: If set, upload generated build artifacts.
19      build-with-debug:
20        required: false
21        type: boolean
22        default: false
23        description: If set, build in debug mode.
24      sync-tag:
25        required: false
26        type: string
27        default: ""
28        description: |
29          If this is set, our linter will use this to make sure that every other
30          job with the same `sync-tag` is identical.
31      cuda-arch-list:
32        required: false
33        type: string
34        default: "5.2"
35        description: Runner label to select worker type
36      runner:
37        required: false
38        type: string
39        default: "linux.2xlarge"
40        description: |
41          List of CUDA architectures CI build should target.
42      test-matrix:
43        required: false
44        type: string
45        description: |
46          An option JSON description of what test configs to run later on. This
47          is moved here from the Linux test workflow so that we can apply filter
48          logic using test-config labels earlier and skip unnecessary builds
49      s3-bucket:
50        description: S3 bucket to download artifact
51        required: false
52        type: string
53        default: "gha-artifacts"
54      aws-role-to-assume:
55        description: role to assume for downloading artifacts
56        required: false
57        type: string
58        default: ""
59    secrets:
60      HUGGING_FACE_HUB_TOKEN:
61        required: false
62        description: |
63          HF Auth token to avoid rate limits when downloading models or datasets from hub
64
65    outputs:
66      docker-image:
67        value: ${{ jobs.build.outputs.docker-image }}
68        description: The docker image containing the built PyTorch.
69      test-matrix:
70        value: ${{ jobs.build.outputs.test-matrix }}
71        description: An optional JSON description of what test configs to run later on.
72
73jobs:
74  build:
75    # Don't run on forked repos
76    if: github.repository_owner == 'pytorch'
77    runs-on: ${{ inputs.runner }}
78    timeout-minutes: 240
79    outputs:
80      docker-image: ${{ steps.linux-build.outputs.docker-image }}
81      test-matrix: ${{ steps.linux-build.outputs.test-matrix }}
82    steps:
83      - name: Setup SSH (Click me for login details)
84        uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
85        with:
86          github-secret: ${{ secrets.GITHUB_TOKEN }}
87
88      # [pytorch repo ref]
89      # Use a pytorch/pytorch reference instead of a reference to the local
90      # checkout because when we run this action we don't *have* a local
91      # checkout. In other cases you should prefer a local checkout.
92      - name: Checkout PyTorch
93        uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
94
95      - name: Linux Build
96        id: linux-build
97        uses: ./.github/actions/linux-build
98        with:
99          build-environment: ${{ inputs.build-environment }}
100          docker-image-name: ${{ inputs.docker-image-name }}
101          build-generates-artifacts: ${{ inputs.build-generates-artifacts }}
102          build-with-debug: ${{ inputs.build-with-debug }}
103          sync-tag: ${{ inputs.sync-tag }}
104          cuda-arch-list: ${{ inputs.cuda-arch-list }}
105          test-matrix: ${{ inputs.test-matrix }}
106          s3-bucket: ${{ inputs.s3-bucket }}
107          aws-role-to-assume: ${{ inputs.aws-role-to-assume }}
108          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109          HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
110