Skip to content
Latchkey

Code testing workflow (scikit-rf/scikit-rf)

The Code testing workflow from scikit-rf/scikit-rf, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, 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: scikit-rf/scikit-rf.github/workflows/testing.ymlLicense BSD-3-ClauseView source

What it does

This is the Code testing workflow from the scikit-rf/scikit-rf 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: Code testing

on: [push, pull_request]

jobs:
  Tests:

    runs-on: ubuntu-latest
    permissions:
      checks: write
      pull-requests: write
    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

    steps:
    - uses: actions/checkout@v7
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}
    - uses: astral-sh/setup-uv@v8.2.0

    - name: Install minimal dependencies
      run: |
        uv venv
        uv pip install -e .
        . .venv/bin/activate
        python -c "import skrf; print(skrf.__version__)"  # Test import with minimal dependencies

    # run the tests located in skrf/
    - name: Test the code, tutorials and examples
      if: ${{ always() }}
      run: |
        uv pip install -e .[visa,netw,xlsx,plot] --group dev --compile -v
        echo "Finished installing dependencies, now running tests"
        . .venv/bin/activate
        echo "Running tests with Python ${{ matrix.python-version }}"
        python -m pytest -n auto --timeout=60 -v --junitxml=test-results/junit-${{ matrix.python-version }}.xml --junit-prefix=${{ matrix.python-version }} --dist loadscope

    - name: Upload Test Results
      if: always()
      uses: actions/upload-artifact@v7
      with:
        name: Test Results (Python ${{ matrix.python-version }})
        path: test-results/*.xml


    # Upload coverage data to coveralls.io
    - name: Upload coverage data to coveralls.io
      continue-on-error: true
      if: ${{ always() }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
        COVERALLS_PARALLEL: true
      run: |
        pip install coveralls
        coveralls --service=github

  coveralls:
    name: Indicate completion to coveralls.io (Finish)
    continue-on-error: true
    if: ${{ always() }}
    needs: Tests
    runs-on: ubuntu-latest
    container: python:3-slim
    steps:
      - name: Finished
        run: |
          pip3 install --upgrade coveralls
          coveralls --finish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


  publish-test-results:
    name: "Publish Tests Results"
    needs: Tests
    runs-on: ubuntu-latest
    permissions:
      checks: write

      # only needed unless run with comment_mode: off
      pull-requests: write

    if: always()

    steps:
      - name: Download Artifacts
        uses: actions/download-artifact@v8
        with:
          path: artifacts

      - name: Publish Test Results
        uses: EnricoMi/publish-unit-test-result-action@v2
        with:
          files: "artifacts/**/*.xml"

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: Code testing
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  Tests:
    timeout-minutes: 30
 
    runs-on: latchkey-small
    permissions:
      checks: write
      pull-requests: write
    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
 
    steps:
    - uses: actions/checkout@v7
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        cache: 'pip'
        python-version: ${{ matrix.python-version }}
    - uses: astral-sh/setup-uv@v8.2.0
 
    - name: Install minimal dependencies
      run: |
        uv venv
        uv pip install -e .
        . .venv/bin/activate
        python -c "import skrf; print(skrf.__version__)"  # Test import with minimal dependencies
 
    # run the tests located in skrf/
    - name: Test the code, tutorials and examples
      if: ${{ always() }}
      run: |
        uv pip install -e .[visa,netw,xlsx,plot] --group dev --compile -v
        echo "Finished installing dependencies, now running tests"
        . .venv/bin/activate
        echo "Running tests with Python ${{ matrix.python-version }}"
        python -m pytest -n auto --timeout=60 -v --junitxml=test-results/junit-${{ matrix.python-version }}.xml --junit-prefix=${{ matrix.python-version }} --dist loadscope
 
    - name: Upload Test Results
      if: always()
      uses: actions/upload-artifact@v7
      with:
        name: Test Results (Python ${{ matrix.python-version }})
        path: test-results/*.xml
 
 
    # Upload coverage data to coveralls.io
    - name: Upload coverage data to coveralls.io
      continue-on-error: true
      if: ${{ always() }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
        COVERALLS_PARALLEL: true
      run: |
        pip install coveralls
        coveralls --service=github
 
  coveralls:
    timeout-minutes: 30
    name: Indicate completion to coveralls.io (Finish)
    continue-on-error: true
    if: ${{ always() }}
    needs: Tests
    runs-on: latchkey-small
    container: python:3-slim
    steps:
      - name: Finished
        run: |
          pip3 install --upgrade coveralls
          coveralls --finish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
 
  publish-test-results:
    timeout-minutes: 30
    name: "Publish Tests Results"
    needs: Tests
    runs-on: latchkey-small
    permissions:
      checks: write
 
      # only needed unless run with comment_mode: off
      pull-requests: write
 
    if: always()
 
    steps:
      - name: Download Artifacts
        uses: actions/download-artifact@v8
        with:
          path: artifacts
 
      - name: Publish Test Results
        uses: EnricoMi/publish-unit-test-result-action@v2
        with:
          files: "artifacts/**/*.xml"
 

What changed

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:

This workflow runs 3 jobs (7 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