Skip to content
Latchkey

Tests and coverage workflow (liiight/notifiers)

The Tests and coverage workflow from liiight/notifiers, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: liiight/notifiers.github/workflows/pythonpackage.ymlLicense MITView source

What it does

This is the Tests and coverage workflow from the liiight/notifiers 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

workflow (.yml)
name: Tests and coverage

on: [ push ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version:
          - 3.9
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
    steps:
      - uses: actions/checkout@v4
      - name: Install uv and set the python version
        uses: astral-sh/setup-uv@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Test with pytest
        shell: bash
        run: uv run pytest --cov=./ --junit-xml=report.xml
        env:
          NOTIFIERS_EMAIL_PASSWORD: ${{secrets.NOTIFIERS_EMAIL_PASSWORD}}
          NOTIFIERS_EMAIL_TO: ${{secrets.NOTIFIERS_EMAIL_TO}}
          NOTIFIERS_EMAIL_USERNAME: ${{secrets.NOTIFIERS_EMAIL_USERNAME}}
          NOTIFIERS_GITTER_ROOM_ID: ${{secrets.NOTIFIERS_GITTER_ROOM_ID}}
          NOTIFIERS_GITTER_TOKEN: ${{secrets.NOTIFIERS_GITTER_TOKEN}}
          NOTIFIERS_GMAIL_PASSWORD: ${{secrets.NOTIFIERS_GMAIL_PASSWORD}}
          NOTIFIERS_GMAIL_TO: ${{secrets.NOTIFIERS_GMAIL_TO}}
          NOTIFIERS_GMAIL_USERNAME: ${{secrets.NOTIFIERS_GMAIL_USERNAME}}
          NOTIFIERS_ICLOUD_TO: ${{secrets.NOTIFIERS_ICLOUD_TO}}
          NOTIFIERS_ICLOUD_FROM: ${{secrets.NOTIFIERS_ICLOUD_FROM}}
          NOTIFIERS_ICLOUD_USERNAME: ${{secrets.NOTIFIERS_ICLOUD_USERNAME}}
          NOTIFIERS_ICLOUD_PASSWORD: ${{secrets.NOTIFIERS_ICLOUD_PASSWORD}}
          NOTIFIERS_JOIN_APIKEY: ${{secrets.NOTIFIERS_JOIN_APIKEY}}
          NOTIFIERS_MAILGUN_API_KEY: ${{secrets.NOTIFIERS_MAILGUN_API_KEY}}
          NOTIFIERS_MAILGUN_DOMAIN: ${{secrets.NOTIFIERS_MAILGUN_DOMAIN}}
          NOTIFIERS_MAILGUN_FROM: ${{secrets.NOTIFIERS_MAILGUN_FROM}}
          NOTIFIERS_MAILGUN_TO: ${{secrets.NOTIFIERS_MAILGUN_TO}}
          NOTIFIERS_PAGERDUTY_ROUTING_KEY: ${{secrets.NOTIFIERS_PAGERDUTY_ROUTING_KEY}}
          NOTIFIERS_POPCORNNOTIFY_API_KEY: ${{secrets.NOTIFIERS_POPCORNNOTIFY_API_KEY}}
          NOTIFIERS_POPCORNNOTIFY_RECIPIENTS: ${{secrets.NOTIFIERS_POPCORNNOTIFY_RECIPIENTS}}
          NOTIFIERS_PUSHBULLET_TOKEN: ${{secrets.NOTIFIERS_PUSHBULLET_TOKEN}}
          NOTIFIERS_PUSHOVER_TOKEN: ${{secrets.NOTIFIERS_PUSHOVER_TOKEN}}
          NOTIFIERS_PUSHOVER_USER: ${{secrets.NOTIFIERS_PUSHOVER_USER}}
          NOTIFIERS_SIMPLEPUSH_KEY: ${{secrets.NOTIFIERS_SIMPLEPUSH_KEY}}
          NOTIFIERS_SLACK_WEBHOOK_URL: ${{secrets.NOTIFIERS_SLACK_WEBHOOK_URL}}
          NOTIFIERS_STATUSPAGE_API_KEY: ${{secrets.NOTIFIERS_STATUSPAGE_API_KEY}}
          NOTIFIERS_STATUSPAGE_PAGE_ID: ${{secrets.NOTIFIERS_STATUSPAGE_PAGE_ID}}
          NOTIFIERS_TELEGRAM_CHAT_ID: ${{secrets.NOTIFIERS_TELEGRAM_CHAT_ID}}
          NOTIFIERS_TELEGRAM_TOKEN: ${{secrets.NOTIFIERS_TELEGRAM_TOKEN}}
          NOTIFIERS_TWILIO_ACCOUNT_SID: ${{secrets.NOTIFIERS_TWILIO_ACCOUNT_SID}}
          NOTIFIERS_TWILIO_AUTH_TOKEN: ${{secrets.NOTIFIERS_TWILIO_AUTH_TOKEN}}
          NOTIFIERS_TWILIO_FROM: ${{secrets.NOTIFIERS_TWILIO_FROM}}
          NOTIFIERS_TWILIO_TO: ${{secrets.NOTIFIERS_TWILIO_TO}}
          NOTIFIERS_ZULIP_API_KEY: ${{secrets.NOTIFIERS_ZULIP_API_KEY}}
          NOTIFIERS_ZULIP_EMAIL: ${{secrets.NOTIFIERS_ZULIP_EMAIL}}
          NOTIFIERS_ZULIP_TO: ${{secrets.NOTIFIERS_ZULIP_TO}}
          NOTIFIERS_VICTOROPS_REST_URL: ${{secrets.NOTIFIERS_VICTOROPS_REST_URL}}
      - name: JUnit Report Action
        uses: mikepenz/action-junit-report@v5
        if: success() || failure()
        with:
          report_paths: report.xml
      - name: Upload coverage to Codecov
        if: success()
        uses: codecov/codecov-action@v2
        with:
          token: ${{secrets.CODECOV_TOKEN}}

The same workflow, on Latchkey

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

name: Tests and coverage
 
on: [ push ]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      max-parallel: 1
      matrix:
        python-version:
          - 3.9
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
    steps:
      - uses: actions/checkout@v4
      - name: Install uv and set the python version
        uses: astral-sh/setup-uv@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Test with pytest
        shell: bash
        run: uv run pytest --cov=./ --junit-xml=report.xml
        env:
          NOTIFIERS_EMAIL_PASSWORD: ${{secrets.NOTIFIERS_EMAIL_PASSWORD}}
          NOTIFIERS_EMAIL_TO: ${{secrets.NOTIFIERS_EMAIL_TO}}
          NOTIFIERS_EMAIL_USERNAME: ${{secrets.NOTIFIERS_EMAIL_USERNAME}}
          NOTIFIERS_GITTER_ROOM_ID: ${{secrets.NOTIFIERS_GITTER_ROOM_ID}}
          NOTIFIERS_GITTER_TOKEN: ${{secrets.NOTIFIERS_GITTER_TOKEN}}
          NOTIFIERS_GMAIL_PASSWORD: ${{secrets.NOTIFIERS_GMAIL_PASSWORD}}
          NOTIFIERS_GMAIL_TO: ${{secrets.NOTIFIERS_GMAIL_TO}}
          NOTIFIERS_GMAIL_USERNAME: ${{secrets.NOTIFIERS_GMAIL_USERNAME}}
          NOTIFIERS_ICLOUD_TO: ${{secrets.NOTIFIERS_ICLOUD_TO}}
          NOTIFIERS_ICLOUD_FROM: ${{secrets.NOTIFIERS_ICLOUD_FROM}}
          NOTIFIERS_ICLOUD_USERNAME: ${{secrets.NOTIFIERS_ICLOUD_USERNAME}}
          NOTIFIERS_ICLOUD_PASSWORD: ${{secrets.NOTIFIERS_ICLOUD_PASSWORD}}
          NOTIFIERS_JOIN_APIKEY: ${{secrets.NOTIFIERS_JOIN_APIKEY}}
          NOTIFIERS_MAILGUN_API_KEY: ${{secrets.NOTIFIERS_MAILGUN_API_KEY}}
          NOTIFIERS_MAILGUN_DOMAIN: ${{secrets.NOTIFIERS_MAILGUN_DOMAIN}}
          NOTIFIERS_MAILGUN_FROM: ${{secrets.NOTIFIERS_MAILGUN_FROM}}
          NOTIFIERS_MAILGUN_TO: ${{secrets.NOTIFIERS_MAILGUN_TO}}
          NOTIFIERS_PAGERDUTY_ROUTING_KEY: ${{secrets.NOTIFIERS_PAGERDUTY_ROUTING_KEY}}
          NOTIFIERS_POPCORNNOTIFY_API_KEY: ${{secrets.NOTIFIERS_POPCORNNOTIFY_API_KEY}}
          NOTIFIERS_POPCORNNOTIFY_RECIPIENTS: ${{secrets.NOTIFIERS_POPCORNNOTIFY_RECIPIENTS}}
          NOTIFIERS_PUSHBULLET_TOKEN: ${{secrets.NOTIFIERS_PUSHBULLET_TOKEN}}
          NOTIFIERS_PUSHOVER_TOKEN: ${{secrets.NOTIFIERS_PUSHOVER_TOKEN}}
          NOTIFIERS_PUSHOVER_USER: ${{secrets.NOTIFIERS_PUSHOVER_USER}}
          NOTIFIERS_SIMPLEPUSH_KEY: ${{secrets.NOTIFIERS_SIMPLEPUSH_KEY}}
          NOTIFIERS_SLACK_WEBHOOK_URL: ${{secrets.NOTIFIERS_SLACK_WEBHOOK_URL}}
          NOTIFIERS_STATUSPAGE_API_KEY: ${{secrets.NOTIFIERS_STATUSPAGE_API_KEY}}
          NOTIFIERS_STATUSPAGE_PAGE_ID: ${{secrets.NOTIFIERS_STATUSPAGE_PAGE_ID}}
          NOTIFIERS_TELEGRAM_CHAT_ID: ${{secrets.NOTIFIERS_TELEGRAM_CHAT_ID}}
          NOTIFIERS_TELEGRAM_TOKEN: ${{secrets.NOTIFIERS_TELEGRAM_TOKEN}}
          NOTIFIERS_TWILIO_ACCOUNT_SID: ${{secrets.NOTIFIERS_TWILIO_ACCOUNT_SID}}
          NOTIFIERS_TWILIO_AUTH_TOKEN: ${{secrets.NOTIFIERS_TWILIO_AUTH_TOKEN}}
          NOTIFIERS_TWILIO_FROM: ${{secrets.NOTIFIERS_TWILIO_FROM}}
          NOTIFIERS_TWILIO_TO: ${{secrets.NOTIFIERS_TWILIO_TO}}
          NOTIFIERS_ZULIP_API_KEY: ${{secrets.NOTIFIERS_ZULIP_API_KEY}}
          NOTIFIERS_ZULIP_EMAIL: ${{secrets.NOTIFIERS_ZULIP_EMAIL}}
          NOTIFIERS_ZULIP_TO: ${{secrets.NOTIFIERS_ZULIP_TO}}
          NOTIFIERS_VICTOROPS_REST_URL: ${{secrets.NOTIFIERS_VICTOROPS_REST_URL}}
      - name: JUnit Report Action
        uses: mikepenz/action-junit-report@v5
        if: success() || failure()
        with:
          report_paths: report.xml
      - name: Upload coverage to Codecov
        if: success()
        uses: codecov/codecov-action@v2
        with:
          token: ${{secrets.CODECOV_TOKEN}}
 

What changed

3 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.

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

Actions used in this workflow