DCPerf FeedSim CI workflow (facebookresearch/DCPerf)
The DCPerf FeedSim CI workflow from facebookresearch/DCPerf, explained and optimized by Latchkey.
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the DCPerf FeedSim CI workflow from the facebookresearch/DCPerf repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This workflow is used for DCPerf CI.
name: DCPerf FeedSim CI
on:
# PR Trigger
#
pull_request:
# Push Trigger (enable to catch errors coming out of multiple merges)
#
push:
branches:
- main
# Manual Trigger
#
workflow_dispatch:
concurrency:
# Cancel previous runs in the PR if a new commit is pushed
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Build on CPU hosts (generic GitHub runners)
build_artifact:
runs-on: ${{ matrix.host-machine.instance }}
container:
image: ${{ matrix.host-machine.container }}
options: --user root --privileged --pid=host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
defaults:
run:
shell: bash
env:
PRELUDE: .github/scripts/setup_env.bash
BUILD_ENV: build_env
continue-on-error: true
strategy:
fail-fast: false
matrix:
host-machine: [
{ arch: x86, instance: "ubuntu-latest", container: "ubuntu:22.04", type: "ubuntu" },
{ arch: aarch64, instance: "ubuntu-24.04-arm", container: "ubuntu:22.04", type: "ubuntu" },
{ arch: x86, instance: "ubuntu-latest", container: "quay.io/centos/centos:stream9", type: "centos" },
{ arch: aarch64, instance: "ubuntu-24.04-arm", container: "quay.io/centos/centos:stream9", type: "centos" },
]
python-version: [ "3.12" ]
steps:
- name: Setup Build Container (ubuntu-based)
if: ${{ matrix.host-machine.type == 'ubuntu' }}
run: apt update -y; apt install -y build-essential git pciutils socat sudo wget
- name: Setup Build Container (centos-based)
if: ${{ matrix.host-machine.type == 'centos' }}
run: dnf update -y; dnf install -y git pciutils which
- name: Checkout the Repository
uses: actions/checkout@v4
with:
submodules: true
- name: Free Disk Space on Host
run: . $PRELUDE; free_disk_space_on_host
- name: Display System Info
run: . $PRELUDE; print_system_info
- name: Install Build Tools
run: . $PRELUDE; install_build_tools
- name: Setup Miniconda
run: . $PRELUDE; setup_miniconda $HOME/miniconda
- name: Create Conda Environment
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}
- name: Install Python Tools
run: . $PRELUDE; install_python_tools $BUILD_ENV
- name: Install FeedSim
run: . $PRELUDE; install_feedsim $BUILD_ENV
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # This workflow is used for DCPerf CI. name: DCPerf FeedSim CI on: # PR Trigger # pull_request: # Push Trigger (enable to catch errors coming out of multiple merges) # push: branches: - main # Manual Trigger # workflow_dispatch: concurrency: # Cancel previous runs in the PR if a new commit is pushed group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: # Build on CPU hosts (generic GitHub runners) build_artifact: timeout-minutes: 30 runs-on: ${{ matrix.host-machine.instance }} container: image: ${{ matrix.host-machine.container }} options: --user root --privileged --pid=host volumes: - /var/run/docker.sock:/var/run/docker.sock defaults: run: shell: bash env: PRELUDE: .github/scripts/setup_env.bash BUILD_ENV: build_env continue-on-error: true strategy: fail-fast: false matrix: host-machine: [ { arch: x86, instance: "ubuntu-latest", container: "ubuntu:22.04", type: "ubuntu" }, { arch: aarch64, instance: "ubuntu-24.04-arm", container: "ubuntu:22.04", type: "ubuntu" }, { arch: x86, instance: "ubuntu-latest", container: "quay.io/centos/centos:stream9", type: "centos" }, { arch: aarch64, instance: "ubuntu-24.04-arm", container: "quay.io/centos/centos:stream9", type: "centos" }, ] python-version: [ "3.12" ] steps: - name: Setup Build Container (ubuntu-based) if: ${{ matrix.host-machine.type == 'ubuntu' }} run: apt update -y; apt install -y build-essential git pciutils socat sudo wget - name: Setup Build Container (centos-based) if: ${{ matrix.host-machine.type == 'centos' }} run: dnf update -y; dnf install -y git pciutils which - name: Checkout the Repository uses: actions/checkout@v4 with: submodules: true - name: Free Disk Space on Host run: . $PRELUDE; free_disk_space_on_host - name: Display System Info run: . $PRELUDE; print_system_info - name: Install Build Tools run: . $PRELUDE; install_build_tools - name: Setup Miniconda run: . $PRELUDE; setup_miniconda $HOME/miniconda - name: Create Conda Environment run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }} - name: Install Python Tools run: . $PRELUDE; install_python_tools $BUILD_ENV - name: Install FeedSim run: . $PRELUDE; install_feedsim $BUILD_ENV
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.