OpenCue Rust Build Pipeline workflow (AcademySoftwareFoundation/OpenCue)
The OpenCue Rust Build Pipeline workflow from AcademySoftwareFoundation/OpenCue, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get run de-duplication, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the OpenCue Rust Build Pipeline workflow from the AcademySoftwareFoundation/OpenCue repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: OpenCue Rust Build Pipeline
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
# Incremental compilation hurts CI clean builds (extra disk I/O, larger
# target dirs, no benefit since each runner is ephemeral) - turn it off.
CARGO_INCREMENTAL: 0
# Be more tolerant of registry hiccups on Windows.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Install X11 dev libs
run: |
sudo apt-get update && sudo apt-get install -y libx11-dev protobuf-compiler libcurl4-openssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-install.sh
bash ./rust-install.sh -y
- name: Cache cargo deps
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
cache-on-failure: true
- name: Build
run: |
cd rust
cargo build --release --verbose
- name: Run tests
run: |
cd rust
cargo test --verbose
clippy:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install X11 dev libs
run: |
sudo apt-get update && sudo apt-get install -y libx11-dev protobuf-compiler libcurl4-openssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-install.sh
bash ./rust-install.sh -y
- name: Cache cargo deps
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
cache-on-failure: true
- name: Run Clippy
run: |
cd rust
cargo clippy --verbose
windows-clippy:
runs-on: windows-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install Protobuf
run: choco install protoc -y
- name: Export PROTOC path
run: echo "PROTOC=C:\ProgramData\chocolatey\bin\protoc.exe" >> $env:GITHUB_ENV
- name: Cache cargo deps
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
cache-on-failure: true
- name: Run Clippy
working-directory: rust
run: cargo clippy -p rqd
windows-tests:
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Protobuf
run: choco install protoc -y
- name: Export PROTOC path
run: echo "PROTOC=C:\ProgramData\chocolatey\bin\protoc.exe" >> $env:GITHUB_ENV
- name: Cache cargo deps
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
cache-on-failure: true
# Build tests first so we see compile-vs-run timing separately and the
# cache is populated even if a test later fails. `--verbose` is dropped
# - log volume noticeably slows Windows runners and the failure output
# is enough for triage.
- name: Build tests
working-directory: rust
run: cargo test -p rqd --no-run
- name: Run tests
working-directory: rust
run: cargo test -p rqd
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: OpenCue Rust Build Pipeline on: push: branches: ["master"] pull_request: branches: ["master"] env: CARGO_TERM_COLOR: always # Incremental compilation hurts CI clean builds (extra disk I/O, larger # target dirs, no benefit since each runner is ephemeral) - turn it off. CARGO_INCREMENTAL: 0 # Be more tolerant of registry hiccups on Windows. CARGO_NET_RETRY: 10 RUSTUP_MAX_RETRIES: 10 concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: latchkey-small timeout-minutes: 45 steps: - uses: actions/checkout@v4 - name: Install X11 dev libs run: | sudo apt-get update && sudo apt-get install -y libx11-dev protobuf-compiler libcurl4-openssl-dev curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-install.sh bash ./rust-install.sh -y - name: Cache cargo deps uses: Swatinem/rust-cache@v2 with: workspaces: rust cache-on-failure: true - name: Build run: | cd rust cargo build --release --verbose - name: Run tests run: | cd rust cargo test --verbose clippy: runs-on: latchkey-small timeout-minutes: 30 steps: - uses: actions/checkout@v4 - name: Install X11 dev libs run: | sudo apt-get update && sudo apt-get install -y libx11-dev protobuf-compiler libcurl4-openssl-dev curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-install.sh bash ./rust-install.sh -y - name: Cache cargo deps uses: Swatinem/rust-cache@v2 with: workspaces: rust cache-on-failure: true - name: Run Clippy run: | cd rust cargo clippy --verbose windows-clippy: runs-on: windows-latest timeout-minutes: 45 steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: components: clippy - name: Install Protobuf run: choco install protoc -y - name: Export PROTOC path run: echo "PROTOC=C:\ProgramData\chocolatey\bin\protoc.exe" >> $env:GITHUB_ENV - name: Cache cargo deps uses: Swatinem/rust-cache@v2 with: workspaces: rust cache-on-failure: true - name: Run Clippy working-directory: rust run: cargo clippy -p rqd windows-tests: runs-on: windows-latest timeout-minutes: 60 steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Install Protobuf run: choco install protoc -y - name: Export PROTOC path run: echo "PROTOC=C:\ProgramData\chocolatey\bin\protoc.exe" >> $env:GITHUB_ENV - name: Cache cargo deps uses: Swatinem/rust-cache@v2 with: workspaces: rust cache-on-failure: true # Build tests first so we see compile-vs-run timing separately and the # cache is populated even if a test later fails. `--verbose` is dropped # - log volume noticeably slows Windows runners and the failure output # is enough for triage. - name: Build tests working-directory: rust run: cargo test -p rqd --no-run - name: Run tests working-directory: rust run: cargo test -p rqd
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
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
- Network fetches
This workflow runs 4 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.