CI/CD Integration
Integrate Tauq validation, formatting, and conversion into your continuous integration pipelines.
GitHub Actions
Basic Validation Workflow
# .github/workflows/tauq-validate.yml
name: Validate Tauq Files
on:
push:
paths:
- '**/*.tqn'
pull_request:
paths:
- '**/*.tqn'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Tauq
run: |
curl -sSL https://tauq.dev/install.sh | sh
echo "$HOME/.tauq/bin" >> $GITHUB_PATH
- name: Validate all .tqn files
run: |
find . -name "*.tqn" -exec tauq validate {} \\;
- name: Check formatting
run: |
find . -name "*.tqn" -exec tauq fmt --check {} \\; Convert and Commit
Automatically convert JSON to Tauq and commit the results:
# .github/workflows/tauq-convert.yml
name: Convert JSON to Tauq
on:
push:
paths:
- 'data/**/*.json'
jobs:
convert:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Tauq
run: curl -sSL https://tauq.dev/install.sh | sh
- name: Convert JSON files to Tauq
run: |
for f in data/**/*.json; do
tauq format "$f" -o "${f%.json}.tqn"
done
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: convert JSON to Tauq"
file_pattern: "**/*.tqn" GitLab CI
.gitlab-ci.yml
stages:
- validate
- build
variables:
TAUQ_VERSION: "latest"
validate-tauq:
stage: validate
image: rust:latest
before_script:
- cargo install tauq
script:
- find . -name "*.tqn" -exec tauq validate {} \\;
- find . -name "*.tqn" -exec tauq fmt --check {} \\;
rules:
- changes:
- "**/*.tqn"
build-json:
stage: build
image: rust:latest
before_script:
- cargo install tauq
script:
- mkdir -p dist
- for f in config/*.tqn; do
tauq build "$f" -o "dist/$(basename ${f%.tqn}.json)";
done
artifacts:
paths:
- dist/*.json Docker Integration
Multi-stage Build
# Dockerfile
FROM rust:1.75 AS tauq-builder
# Install tauq
RUN cargo install tauq
# Convert config files
WORKDIR /config
COPY config/*.tqn ./
RUN for f in *.tqn; do tauq build "$f" -o "${f%.tqn}.json"; done
# Final image
FROM node:20-alpine
WORKDIR /app
COPY --from=tauq-builder /config/*.json ./config/
COPY . .
RUN npm ci --production
CMD ["node", "server.js"] Docker Compose with Tauq Config
# docker-compose.yml
services:
app:
build: .
volumes:
- ./config:/app/config:ro
environment:
- CONFIG_PATH=/app/config/app.json
tauq-watcher:
image: rust:1.75
command: >
sh -c "cargo install tauq &&
watch -n 5 'for f in /config/*.tqn; do
tauq build $$f -o $${f%.tqn}.json;
done'"
volumes:
- ./config:/config Pre-commit Hooks
Using pre-commit
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: tauq-validate
name: Validate Tauq files
entry: tauq validate
language: system
files: \.tqn$
- id: tauq-format
name: Format Tauq files
entry: tauq fmt
language: system
files: \.tqn$
Install with: pip install pre-commit && pre-commit install
Git Hook (manual)
#!/bin/sh
# .git/hooks/pre-commit
# Validate all staged .tqn files
staged_tqn=$(git diff --cached --name-only --diff-filter=ACM | grep '\.tqn$')
if [ -n "$staged_tqn" ]; then
echo "Validating Tauq files..."
for file in $staged_tqn; do
if ! tauq validate "$file"; then
echo "Validation failed for $file"
exit 1
fi
done
echo "All Tauq files valid!"
fi Make / Task Runners
Makefile
# Makefile
.PHONY: validate format build clean
TQN_FILES := $(shell find . -name "*.tqn")
JSON_FILES := $(TQN_FILES:.tqn=.json)
validate:
@for f in $(TQN_FILES); do tauq validate $$f; done
format:
@for f in $(TQN_FILES); do tauq fmt $$f; done
build: $(JSON_FILES)
%.json: %.tqn
tauq build $< -o $@
clean:
rm -f $(JSON_FILES)
ci: validate format build
@echo "CI checks passed!" Just (justfile)
# justfile
# Validate all Tauq files
validate:
find . -name "*.tqn" -exec tauq validate {} \\;
# Format all Tauq files
format:
find . -name "*.tqn" -exec tauq fmt {} \\;
# Build JSON from Tauq
build:
#!/usr/bin/env bash
for f in config/*.tqn; do
tauq build "$f" -o "${f%.tqn}.json"
done
# Run all CI checks
ci: validate format build
@echo "All checks passed!"