Skip to content
Latchkey

Run dbt tests workflow (InfuseAI/piperider)

The Run dbt tests workflow from InfuseAI/piperider, explained and optimized by Latchkey.

D

CI health: D - needs work

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

Grade your own workflow free or run it on Latchkey →
Source: InfuseAI/piperider.github/workflows/dbt-compatible-tests.yamlLicense Apache-2.0View source

What it does

This is the Run dbt tests workflow from the InfuseAI/piperider 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: Run dbt tests

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main


jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        version: [ '3.8', '3.9', '3.10', '3.11' ]
        dbt: [ ">=1.3,<1.4", ">=1.4,<1.5", ">=1.5,<1.6", ">=1.6,<1.7", ">=1.7,<1.8" ]

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pytest "dbt-core${{ matrix.dbt }}"
          pip install '.[duckdb]'
      - name: Run tests
        run: |
          set +e
          output=$(python -c "from dbt import version as v" 2>&1)
          exit_code=$?
          set -e

          if [ $exit_code -eq 0 ]; then
              python -mpytest tests/test_dbt_manifest_compatible.py tests/test_dbt_integeration.py tests/test_dbt_util.py
          else
              # https://github.com/dbt-labs/dbt-core/issues/6203#issuecomment-1319112890
              echo "Skip! dbt-core v1.3 only works with python less than 3.11"
          fi
      - name: Run jaffle shop
        if: matrix.dbt != '>=1.3,<1.4'
        run: |
          pip install "dbt-duckdb${{ matrix.dbt }}"

          ./e2e-jaffle-shop/run.sh
          
          path="/home/runner/work/piperider/piperider/e2e-jaffle-shop/jaffle_shop/.piperider/comparisons/latest/summary.md"
          if [ ! -e "$path" ]; then
            echo "The path '$path' does not exist."
            exit 1
          fi
          


          

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: Run dbt tests
 
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
 
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        version: [ '3.8', '3.9', '3.10', '3.11' ]
        dbt: [ ">=1.3,<1.4", ">=1.4,<1.5", ">=1.5,<1.6", ">=1.6,<1.7", ">=1.7,<1.8" ]
 
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          cache: 'pip'
          python-version: ${{ matrix.version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pytest "dbt-core${{ matrix.dbt }}"
          pip install '.[duckdb]'
      - name: Run tests
        run: |
          set +e
          output=$(python -c "from dbt import version as v" 2>&1)
          exit_code=$?
          set -e
 
          if [ $exit_code -eq 0 ]; then
              python -mpytest tests/test_dbt_manifest_compatible.py tests/test_dbt_integeration.py tests/test_dbt_util.py
          else
              # https://github.com/dbt-labs/dbt-core/issues/6203#issuecomment-1319112890
              echo "Skip! dbt-core v1.3 only works with python less than 3.11"
          fi
      - name: Run jaffle shop
        if: matrix.dbt != '>=1.3,<1.4'
        run: |
          pip install "dbt-duckdb${{ matrix.dbt }}"
 
          ./e2e-jaffle-shop/run.sh
          
          path="/home/runner/work/piperider/piperider/e2e-jaffle-shop/jaffle_shop/.piperider/comparisons/latest/summary.md"
          if [ ! -e "$path" ]; then
            echo "The path '$path' does not exist."
            exit 1
          fi
          
 
 
          
 

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 (20 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