Skip to content
Latchkey

General checks workflow (Lightning-AI/torchmetrics)

The General checks workflow from Lightning-AI/torchmetrics, explained and optimized by Latchkey.

A

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 →
Source: Lightning-AI/torchmetrics.github/workflows/ci-checks.ymlLicense Apache-2.0View source

What it does

This is the General checks workflow from the Lightning-AI/torchmetrics 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

workflow (.yml)
name: General checks

on:
  push:
    branches: [master, "release/*"]
  pull_request:
    branches: [master, "release/*"]
    types: [opened, reopened, ready_for_review, synchronize]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
  cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}

jobs:
  check-code:
    uses: Lightning-AI/utilities/.github/workflows/check-typing.yml@2094525f99d94e25998563f5f7c960d48c12dc87 # v0.15.2
    with:
      actions-ref: v0.15.2
      extra-typing: "typing"

  check-schema:
    uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@2094525f99d94e25998563f5f7c960d48c12dc87 # v0.15.2
    with:
      actions-ref: v0.15.2
      azure-schema-version: "v1.208.0"

  check-package:
    if: github.event.pull_request.draft == false
    uses: Lightning-AI/utilities/.github/workflows/check-package.yml@86fe1b20b4609835ba9e8c8739cd39707ba76868 # v0.15.3
    with:
      actions-ref: v0.15.2
      artifact-name: dist-packages-${{ github.sha }}
      import-name: "torchmetrics"
      testing-matrix: |
        {
          "os": ["ubuntu-22.04", "macOS-14", "windows-2022"],
          "python-version": ["3.10", "3.11"]
        }

  check-md-links:
    uses: Lightning-AI/utilities/.github/workflows/check-md-links.yml@2094525f99d94e25998563f5f7c960d48c12dc87 # v0.15.2
    with:
      base-branch: master
      config-file: ".github/markdown-links-config.json"

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: General checks
 
on:
  push:
    branches: [master, "release/*"]
  pull_request:
    branches: [master, "release/*"]
    types: [opened, reopened, ready_for_review, synchronize]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
  cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
 
jobs:
  check-code:
    timeout-minutes: 30
    uses: Lightning-AI/utilities/.github/workflows/check-typing.yml@2094525f99d94e25998563f5f7c960d48c12dc87 # v0.15.2
    with:
      actions-ref: v0.15.2
      extra-typing: "typing"
 
  check-schema:
    timeout-minutes: 30
    uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@2094525f99d94e25998563f5f7c960d48c12dc87 # v0.15.2
    with:
      actions-ref: v0.15.2
      azure-schema-version: "v1.208.0"
 
  check-package:
    timeout-minutes: 30
    if: github.event.pull_request.draft == false
    uses: Lightning-AI/utilities/.github/workflows/check-package.yml@86fe1b20b4609835ba9e8c8739cd39707ba76868 # v0.15.3
    with:
      actions-ref: v0.15.2
      artifact-name: dist-packages-${{ github.sha }}
      import-name: "torchmetrics"
      testing-matrix: |
        {
          "os": ["ubuntu-22.04", "macOS-14", "windows-2022"],
          "python-version": ["3.10", "3.11"]
        }
 
  check-md-links:
    timeout-minutes: 30
    uses: Lightning-AI/utilities/.github/workflows/check-md-links.yml@2094525f99d94e25998563f5f7c960d48c12dc87 # v0.15.2
    with:
      base-branch: master
      config-file: ".github/markdown-links-config.json"
 

What changed

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