CI Additional workflow (xarray-contrib/pint-xarray)
The CI Additional workflow from xarray-contrib/pint-xarray, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the CI Additional workflow from the xarray-contrib/pint-xarray 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: CI Additional
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
doctests:
name: Doctests
runs-on: ubuntu-latest
if: github.repository == 'xarray-contrib/pint-xarray'
env:
FORCE_COLOR: 3
steps:
- name: checkout the repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
persist-credentials: false
- name: setup environment
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
with:
environments: "ci-py313"
- name: import pint-xarray
run: |
pixi run -e ci-py313 python -c 'import pint_xarray'
- name: run doctests
run: |
pixi run -e ci-py313 doctests
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI Additional on: push: branches: - main pull_request: branches: - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: {} jobs: doctests: timeout-minutes: 30 name: Doctests runs-on: latchkey-small if: github.repository == 'xarray-contrib/pint-xarray' env: FORCE_COLOR: 3 steps: - name: checkout the repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: # need to fetch all tags to get a correct version fetch-depth: 0 # fetch all branches and tags persist-credentials: false - name: setup environment uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 with: environments: "ci-py313" - name: import pint-xarray run: | pixi run -e ci-py313 python -c 'import pint_xarray' - name: run doctests run: | pixi run -e ci-py313 doctests
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. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.