name: CI on: push: branches: [main] pull_request: branches: [main] jobs: # Lint lint-python: name: Ruff (lint + format) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: Install dependencies run: uv sync - name: Ruff lint run: uv run ruff check . - name: Ruff format check run: uv run ruff format --check . lint-sql: name: SQLFluff runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: Install dependencies run: uv sync - name: SQLFluff lint run: uv run sqlfluff lint dbt/models data_platform/ --dialect postgres lint-yaml-json-md: name: Prettier (YAML / JSON / Markdown) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: "20" - name: Install prettier run: npm install --global prettier - name: Prettier check run: | prettier --check \ "**/*.yml" "**/*.yaml" "**/*.md" \ --ignore-path .prettierignore # Tests test: name: Pytest runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: Install dependencies run: uv sync - name: Run tests with coverage run: uv run pytest tests/ --cov=data_platform --cov-report=json:coverage.json - name: Round coverage percentage if: github.ref == 'refs/heads/main' run: | python -c " import json with open('coverage.json') as f: data = json.load(f) data['totals']['percent_covered'] = round(data['totals']['percent_covered']) with open('coverage.json', 'w') as f: json.dump(data, f) " - name: Generate coverage badge if: github.ref == 'refs/heads/main' uses: jaywcjlove/coverage-badges-cli@v2.1.0 with: source: coverage.json output: badge/coverage-badge.svg jsonPath: totals.percent_covered - name: Deploy coverage badge if: github.ref == 'refs/heads/main' uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./badge publish_branch: coverage-badge keep_files: false