Skip to content

Commit

Permalink
chore: supersede makefile with taskfile, use uv to run gha test suite…
Browse files Browse the repository at this point in the history
… matrix locally
  • Loading branch information
z3z1ma committed Jan 26, 2025
1 parent 93ed691 commit 97ef049
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ dmypy.json

# Makefile touch target
.uv-installed-*

# Taskfile hashes
.task
71 changes: 71 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# See https://taskfile.dev/installation/ for installation
version: "3"

env:
UV_PYTHON:
sh: cat .python-version

tasks:
default:
desc: By default, run format, lint, test
cmds:
- task: format
- task: lint
- defer: { task: dev }
- task: test

lint:
desc: Run ruff to check code for linting issues
cmds:
- uvx ruff check

format:
desc: Auto-fix imports, then format code with ruff
cmds:
- uvx ruff check --fix --select I
- uvx ruff format --preview

dev:
desc: Sets up dev environment (.venv + pre-commit), syncs dev extra
deps: [venv, pre-commit]
cmds:
- uv -q sync --extra=dev

venv:
desc: Creates the virtual environment via uv
internal: true
sources:
- .python-version
generates:
- .venv/bin/python
cmds:
- uv venv .venv

pre-commit:
desc: Installs pre-commit hooks in .git/hooks/pre-commit
internal: true
cmds:
- uv tool install pre-commit
- uv tool run pre-commit install
status:
- test -f .git/hooks/pre-commit

test:
desc: Run tests against supported python and dbt versions
env:
UV_FROZEN: 1
UV_NO_SYNC: 1
UV_NO_PROGRESS: 1
cmds:
- for:
matrix:
python_version: ["3.10", "3.11", "3.12"]
dbt_version: ["1.8.0", "1.9.0"]
cmd: |
echo -e "\033[32mtask: [test] uv run pytest (python=={{.ITEM.python_version}} and dbt~={{.ITEM.dbt_version}})\033[0m"
export UV_PYTHON={{.ITEM.python_version}}
uv -q sync --extra dev
uv -q pip install --reinstall dbt-core~={{.ITEM.dbt_version}} dbt-duckdb~={{.ITEM.dbt_version}}
uv run dbt parse --project-dir demo_duckdb --profiles-dir demo_duckdb -t test
uv run pytest
silent: true

0 comments on commit 97ef049

Please sign in to comment.