Dokumentation

Mit KI übersetzt — wir entschuldigen uns für etwaige Fehler. Helfen Sie uns, diese Übersetzung zu verbessern.

GitHub Actions Integration#

Run bdp pull in CI to ensure every pipeline run, test, and deployment uses the exact same data declared in bdp.lock. Cache the downloaded files between runs to avoid redundant downloads.

Basic Workflow#

.github/workflows/analysis.yml
name: Analysis

on: [push, pull_request]

jobs:
run:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4

    - name: Install BDP
      run: curl -sSfL https://get.bdp.sh | sh

    - name: Pull data
      run: bdp pull
      env:
        BDP_SERVER_URL: ${{ secrets.BDP_SERVER_URL }}

    - name: Run analysis
      run: python scripts/analysis.py

Caching Between Runs#

BDP downloads can be large. Use actions/cache keyed on bdp.lock — the cache is invalidated automatically whenever your locked versions change:

.github/workflows/analysis.yml
name: Analysis

on: [push, pull_request]

jobs:
run:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4

    - name: Install BDP
      run: curl -sSfL https://get.bdp.sh | sh

    - name: Cache BDP data
      uses: actions/cache@v4
      with:
        path: .bdp/data
        key: bdp-${{ hashFiles('bdp.lock') }}
        restore-keys: |
          bdp-

    - name: Pull data
      run: bdp pull
      env:
        BDP_SERVER_URL: ${{ secrets.BDP_SERVER_URL }}

    - name: Run analysis
      run: python scripts/analysis.py

When bdp.lock hasn't changed, bdp pull finds all files already cached and skips downloading — the job runs immediately.

Snakemake Pipeline#

.github/workflows/pipeline.yml
name: Pipeline

on: [push]

jobs:
snakemake:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4

    - uses: actions/setup-python@v5
      with:
        python-version: "3.12"

    - name: Install dependencies
      run: pip install snakemake

    - name: Install BDP
      run: curl -sSfL https://get.bdp.sh | sh

    - name: Cache BDP data
      uses: actions/cache@v4
      with:
        path: .bdp/data
        key: bdp-${{ hashFiles('bdp.lock') }}

    - name: Pull data
      run: bdp pull
      env:
        BDP_SERVER_URL: ${{ secrets.BDP_SERVER_URL }}

    - name: Generate Snakemake config
      run: bdp generate snakemake > bdp_config.yaml

    - name: Run pipeline
      run: snakemake --cores all

Environment Variables in CI#

All BDP_* source path variables are available to subsequent steps after bdp pull runs. Set them explicitly if your analysis script needs them outside of hooks:

.github/workflows/analysis.yml
- name: Pull data
run: |
  bdp pull
  # Export BDP paths for subsequent steps
  echo "BDP_UNIPROT_P01308_FASTA=$BDP_UNIPROT_P01308_FASTA" >> $GITHUB_ENV
env:
  BDP_SERVER_URL: ${{ secrets.BDP_SERVER_URL }}

Secrets#

Set your BDP server URL as a repository secret:

  1. Go to Settings → Secrets and variables → Actions
  2. Add BDP_SERVER_URL with your server address

If you are using the public BDP registry, no secret is needed.

GitLab CI#

The same pattern works for GitLab CI:

.gitlab-ci.yml
analysis:
image: ubuntu:22.04
cache:
  key:
    files:
      - bdp.lock
  paths:
    - .bdp/data/
script:
  - curl -sSfL https://get.bdp.sh | sh
  - bdp pull
  - python scripts/analysis.py
variables:
  BDP_SERVER_URL: $BDP_SERVER_URL

Full Example#

See the complete GitHub Actions examples on Codeberg — includes analysis.yml (Python variant analysis) and snakemake-pipeline.yml (Snakemake with bcftools + bedtools).