• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: buck
2
3on:
4  workflow_call:
5    inputs:
6      test-matrix:
7        required: true
8        type: string
9        description: |
10          A JSON description of what configs to run later on.
11
12defaults:
13  run:
14    shell: bash -e -l {0}
15
16jobs:
17  filter:
18    if: github.repository_owner == 'pytorch'
19    runs-on: [self-hosted, linux.large]
20    outputs:
21      test-matrix: ${{ steps.filter.outputs.test-matrix }}
22      is-test-matrix-empty: ${{ steps.filter.outputs.is-test-matrix-empty }}
23      keep-going: ${{ steps.filter.outputs.keep-going }}
24    steps:
25      - name: Checkout PyTorch
26        uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
27        with:
28          fetch-depth: 1
29          submodules: false
30
31      - name: Select all requested test configurations
32        id: filter
33        uses: ./.github/actions/filter-test-configs
34        with:
35          github-token: ${{ secrets.GITHUB_TOKEN }}
36          test-matrix: ${{ inputs.test-matrix }}
37
38  buck-build-test:
39    needs: filter
40    if: github.repository_owner == 'pytorch' && needs.filter.outputs.is-test-matrix-empty == 'False'
41    strategy:
42      matrix: ${{ fromJSON(needs.filter.outputs.test-matrix) }}
43      fail-fast: false
44    runs-on: ${{ matrix.runner }}
45    steps:
46      - name: Checkout PyTorch
47        uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
48
49      - name: Set up JDK 8
50        uses: actions/setup-java@v3
51        with:
52          java-version: '8'
53          distribution: 'temurin'
54
55      - name: Setup miniconda
56        uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
57        with:
58          python-version: 3.8
59          environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}
60
61      - name: Install Buck
62        uses: nick-fields/retry@3e91a01664abd3c5cd539100d10d33b9c5b68482
63        with:
64          timeout_minutes: 10
65          max_attempts: 5
66          command: |
67            sudo apt update -q
68            wget -q https://github.com/facebook/buck/releases/download/v2021.01.12.01/buck.2021.01.12.01_all.deb
69            sudo apt install ./buck.2021.01.12.01_all.deb
70
71      - name: Download third party libraries and generate wrappers
72        uses: nick-fields/retry@3e91a01664abd3c5cd539100d10d33b9c5b68482
73        with:
74          timeout_minutes: 10
75          max_attempts: 5
76          command: |
77            bash scripts/buck_setup.sh
78
79      - name: Build tools
80        run: |
81          buck build tools: --keep-going
82
83      - name: Run tools tests
84        run: |
85          buck test tools:selective_build_test tools:gen_oplist_test tools:gen_operators_yaml_test
86
87      - name: Build c10
88        run: |
89          buck build c10:c10
90
91      - name: Build XNNPACK
92        run: |
93          buck build third_party:XNNPACK
94
95      - name: Build QNNPACK
96        run: |
97          buck build aten/src/ATen/native/quantized/cpu/qnnpack:pytorch_qnnpack
98
99      - name: Test QNNPACK
100        run: |
101          buck test aten/src/ATen/native/quantized/cpu/qnnpack:pytorch_qnnpack_test
102
103      - name: Build aten_cpu
104        run: |
105          buck build :aten_cpu
106
107      - name: Build torch_mobile_core
108        run: |
109          buck build :torch_mobile_core
110
111      - name: Build pt_ops_full
112        run: |
113          buck build :pt_ops_full
114
115      - name: Build mobile benchmark
116        run: |
117          buck build :ptmobile_benchmark
118
119      - name: Run lite interpreter model
120        run: |
121          buck run :ptmobile_benchmark -- --model=ios/TestApp/models/mobilenet_v2.ptl --input_dims=1,3,224,224 --input_type=float
122
123      - name: Build everything
124        run: |
125          buck build //... --keep-going
126
127      - name: Build aten_cpu@shared
128        run: |
129          buck build :aten_cpu#linux-x86_64,shared
130