Skip to content
Latchkey

build workflow (tp7309/TTDeDroid)

The build workflow from tp7309/TTDeDroid, explained and optimized by Latchkey.

F

CI health: F - at risk

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: tp7309/TTDeDroid.github/workflows/build.yamlLicense Apache-2.0View source

What it does

This is the build workflow from the tp7309/TTDeDroid 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: build

on: [push]

jobs:
  build:
    strategy:
      matrix:
        os: [windows-latest, ubuntu-20.04]
        python-version: ["3.6", "3.7", "3.8", "3.9"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python-version }}
      - name: Set up JDK 11 for x64
        if: ${{matrix.os == 'windows-latest'}}
        uses: actions/setup-java@v3
        with:
          java-version: '11'
          distribution: 'adopt'
          architecture: x64
      - name: Install dependencies
        run: |
          pip install pytest pytest-cov
          # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
      - name: Test
        run: |
          pytest --cov showjar --cov-report xml
      - name: Coverage
        uses: codecov/codecov-action@v2
        with:
          fail_ci_if_error: false # optional (default = false)
      - name: Lints
        if: ${{matrix.os == 'ubuntu-20.04'}}
        uses: deepsourcelabs/test-coverage-action@master
        with:
          key: python
          coverage-file: coverage.xml
          dsn: ${{ secrets.DEEPSOURCE_DSN }}
          fail-ci-on-error: false

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: build
 
on: [push]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    strategy:
      matrix:
        os: [windows-latest, ubuntu-20.04]
        python-version: ["3.6", "3.7", "3.8", "3.9"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v3
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
      - name: Set up JDK 11 for x64
        if: ${{matrix.os == 'windows-latest'}}
        uses: actions/setup-java@v3
        with:
          java-version: '11'
          distribution: 'adopt'
          architecture: x64
      - name: Install dependencies
        run: |
          pip install pytest pytest-cov
          # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
      - name: Test
        run: |
          pytest --cov showjar --cov-report xml
      - name: Coverage
        uses: codecov/codecov-action@v2
        with:
          fail_ci_if_error: false # optional (default = false)
      - name: Lints
        if: ${{matrix.os == 'ubuntu-20.04'}}
        uses: deepsourcelabs/test-coverage-action@master
        with:
          key: python
          coverage-file: coverage.xml
          dsn: ${{ secrets.DEEPSOURCE_DSN }}
          fail-ci-on-error: false
 

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 1 job (8 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