Skip to content
Latchkey

Build Linux Wheels workflow (meta-pytorch/torchrec)

The Build Linux Wheels workflow from meta-pytorch/torchrec, explained and optimized by Latchkey.

F

CI health: F - at risk

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: meta-pytorch/torchrec.github/workflows/build-wheels-linux.ymlLicense BSD-3-ClauseView source

What it does

This is the Build Linux Wheels workflow from the meta-pytorch/torchrec repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Build Linux Wheels

on:
  pull_request:
    paths-ignore:
      - "docs/*"
      - "third_party/*"
      - .gitignore
      - "*.md"
      - ".github/workflows/[cdprvu]*.yml"
  push:
    branches:
      - nightly
      - main
      - release/*
    tags:
      # Release candidate tags look like: v1.11.0-rc1
      - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
  workflow_dispatch:

permissions:
  id-token: write
  contents: read

jobs:
  generate-matrix:
    uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
    with:
      package-type: wheel
      os: linux
      test-infra-repository: pytorch/test-infra
      test-infra-ref: main
      with-rocm: false
  filter-matrix:
    needs: generate-matrix
    runs-on: linux.24_04.4x
    outputs:
      matrix: ${{ steps.filter.outputs.matrix }}
    steps:
    - uses: actions/setup-python@v4
    - name: Checkout torchrec repository
      uses: actions/checkout@v4
      with:
        repository: meta-pytorch/torchrec
    - name: Filter Generated Built Matrix
      id: filter
      env:
        MAT: ${{ needs.generate-matrix.outputs.matrix }}
      run: |
        set -ex
        pwd
        ls
        MATRIX_BLOB="$(python .github/scripts/filter.py)"
        echo "${MATRIX_BLOB}"
        echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
  build:
    needs: filter-matrix
    name: meta-pytorch/torchrec
    uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
    with:
      repository: meta-pytorch/torchrec
      ref: ""
      test-infra-repository: pytorch/test-infra
      test-infra-ref: main
      build-matrix: ${{ needs.filter-matrix.outputs.matrix }}
      pre-script: ""
      post-script: .github/scripts/install_libs.sh
      package-name: torchrec
      smoke-test-script: ""
      trigger-event: ${{ github.event_name }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Build Linux Wheels
 
on:
  pull_request:
    paths-ignore:
      - "docs/*"
      - "third_party/*"
      - .gitignore
      - "*.md"
      - ".github/workflows/[cdprvu]*.yml"
  push:
    branches:
      - nightly
      - main
      - release/*
    tags:
      # Release candidate tags look like: v1.11.0-rc1
      - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
  workflow_dispatch:
 
permissions:
  id-token: write
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  generate-matrix:
    timeout-minutes: 30
    uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
    with:
      package-type: wheel
      os: linux
      test-infra-repository: pytorch/test-infra
      test-infra-ref: main
      with-rocm: false
  filter-matrix:
    timeout-minutes: 30
    needs: generate-matrix
    runs-on: linux.24_04.4x
    outputs:
      matrix: ${{ steps.filter.outputs.matrix }}
    steps:
    - uses: actions/setup-python@v4
      with:
        cache: 'pip'
    - name: Checkout torchrec repository
      uses: actions/checkout@v4
      with:
        repository: meta-pytorch/torchrec
    - name: Filter Generated Built Matrix
      id: filter
      env:
        MAT: ${{ needs.generate-matrix.outputs.matrix }}
      run: |
        set -ex
        pwd
        ls
        MATRIX_BLOB="$(python .github/scripts/filter.py)"
        echo "${MATRIX_BLOB}"
        echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
  build:
    timeout-minutes: 30
    needs: filter-matrix
    name: meta-pytorch/torchrec
    uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
    with:
      repository: meta-pytorch/torchrec
      ref: ""
      test-infra-repository: pytorch/test-infra
      test-infra-ref: main
      build-matrix: ${{ needs.filter-matrix.outputs.matrix }}
      pre-script: ""
      post-script: .github/scripts/install_libs.sh
      package-name: torchrec
      smoke-test-script: ""
      trigger-event: ${{ github.event_name }}
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 3 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow