Skip to content
Latchkey

Cron Tests workflow (astropy/halotools)

The Cron Tests workflow from astropy/halotools, explained and optimized by Latchkey.

D

CI health: D - needs work

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: astropy/halotools.github/workflows/cron_tests.yamlLicense BSD-3-ClauseView source

What it does

This is the Cron Tests workflow from the astropy/halotools 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: Cron Tests

on:
  workflow_dispatch: null
  schedule:
    # Runs "First of every month at 3:15am Central"
    - cron: '15 8 1 * *'
  pull_request:
    branches:
      - master

jobs:
  # Github Actions supports ubuntu, windows, and macos virtual environments:
  # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
  ci_tests:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: Ubuntu - Python 3.11 with all optional dependencies
            os: ubuntu-latest
            python: "3.11"
            toxenv: 'py311-test-alldeps'

          - name: MacOs - Python 3.11 with all optional dependencies
            os: macos-latest
            python: "3.11"
            toxenv: 'py311-test-alldeps'

          - name: Ubuntu - Python 3.12 with all optional dependencies
            os: ubuntu-latest
            python: "3.12"
            toxenv: 'py312-test-alldeps'

          - name: MacOs - Python 3.12 with all optional dependencies
            os: macos-latest
            python: "3.12"
            toxenv: 'py312-test-alldeps'

    steps:
    - name: Checkout code
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0
      with:
        fetch-depth: 0
    - name: Set up python ${{ matrix.python }} on ${{ matrix.os }}
      uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0
      with:
        python-version: ${{ matrix.python }}
    - name: Install base dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install tox codecov
    - name: Test with tox
      run: |
        tox -e ${{ matrix.toxenv }}

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: Cron Tests
 
on:
  workflow_dispatch: null
  schedule:
    # Runs "First of every month at 3:15am Central"
    - cron: '15 8 1 * *'
  pull_request:
    branches:
      - master
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  # Github Actions supports ubuntu, windows, and macos virtual environments:
  # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
  ci_tests:
    timeout-minutes: 30
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - name: Ubuntu - Python 3.11 with all optional dependencies
            os: ubuntu-latest
            python: "3.11"
            toxenv: 'py311-test-alldeps'
 
          - name: MacOs - Python 3.11 with all optional dependencies
            os: macos-latest
            python: "3.11"
            toxenv: 'py311-test-alldeps'
 
          - name: Ubuntu - Python 3.12 with all optional dependencies
            os: ubuntu-latest
            python: "3.12"
            toxenv: 'py312-test-alldeps'
 
          - name: MacOs - Python 3.12 with all optional dependencies
            os: macos-latest
            python: "3.12"
            toxenv: 'py312-test-alldeps'
 
    steps:
    - name: Checkout code
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0
      with:
        fetch-depth: 0
    - name: Set up python ${{ matrix.python }} on ${{ matrix.os }}
      uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0
      with:
        cache: 'pip'
        python-version: ${{ matrix.python }}
    - name: Install base dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install tox codecov
    - name: Test with tox
      run: |
        tox -e ${{ matrix.toxenv }}
 

What changed

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:

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

Actions used in this workflow