Deploying to Tinybird through CI

Once you create your data project in Git, you can implement continuous integration (CI) workflows to automate interaction with Tinybird.

When you create a project using tb create, Tinybird generates CI templates you can use in GitHub and GitLab to automate testing and deployment.

CI workflow

As you expand and iterate on your data projects, you can continuously validate your changes. In the same way that you write integration and acceptance tests for source code in a software project, you can write automated tests for your API Endpoints to run on each pull or merge request.

A potential CI workflow could run the following steps when you open a pull request:

  1. Install Tinybird CLI: Sets up dependencies and installs the Tinybird CLI to run the required commands.
  2. Build project: Checks the datafile syntax and correctness.
  3. Test project: Runs fixture tests, data quality tests, or both to validate changes.
  4. Create preview deployment: Deploys the changes to Tinybird Cloud and performs data migrations.
  5. Regression: Runs automatic regression tests to validate endpoint performance and data quality.

CI templates

The following templates are available for GitHub and GitLab:


name: Tinybird - CI Workflow

on:
  workflow_dispatch:
  pull_request:
    branches:
      - main
      - master
    types: [opened, reopened, labeled, unlabeled, synchronize, closed]

concurrency: ${{ github.workflow }}-${{ github.event.pull_request.number }}

jobs:
  ci:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: '.'
    services:
      tinybird:
        image: tinybirdco/tinybird-local:latest
        ports:
          - 80:80
    steps:
      - uses: actions/checkout@v3
      - name: Install Tinybird CLI
        run: curl -LsSf https://api.tinybird.co/static/install.sh | sh
      - name: Build project
        run: tb build
      - name: Test project
        run: tb test run

Next steps

Updated