Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
tags:
- 'v*'

env:
REGISTRY: ghcr.io

jobs:
push:
runs-on: ubuntu-latest
Expand All @@ -20,14 +23,40 @@ jobs:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 'Docker Build & Push'
run: |
make docker-buildx

- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v3

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/testbench/testworkflows
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest

- name: 'Build & Push TestWorkflows Image'
uses: docker/build-push-action@v5
with:
context: ./testworkflows
file: ./testworkflows/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: 'Setup Flux CLI'
uses: fluxcd/flux2/action@main

Expand Down
44 changes: 44 additions & 0 deletions testworkflows/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Python cache and compiled files
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/

# Virtual environments
venv/
env/
ENV/

# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~

# Git
.git/
.gitignore

# Environment variables
.env
.env.*

# Documentation
*.md

# Data directories (created at runtime)
data/
results/

# Temporary files
*.log
*.tmp
.DS_Store
33 changes: 33 additions & 0 deletions testworkflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.13-slim

WORKDIR /app

# Install runtime and build dependencies (git is needed for Gitpython, which is a dependency of Ragas)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*

# Install UV package manager
COPY --from=ghcr.io/astral-sh/uv:0.9 /uv /bin/uv

# Copy dependency files
COPY pyproject.toml uv.lock ./

# Install dependencies using UV
RUN uv sync

# Copy scripts to root dir
COPY scripts/* ./

# Create directories for data and results
RUN mkdir -p data/datasets data/experiments results

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1

# Make scripts executable
RUN chmod +x *.py

# Set 'uv run python3' entrypoint so we can run scripts directly
ENTRYPOINT ["uv", "run", "python3"]
26 changes: 26 additions & 0 deletions testworkflows/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Testworkflows Docker Image Makefile

# Image configuration
IMAGE_NAME ?= testworkflows
IMAGE_TAG ?= latest

# Full image reference
IMAGE := $(IMAGE_NAME):$(IMAGE_TAG)

.PHONY: help
help: ## Display this help message
@echo "Testworkflows Docker Image Management"
@echo ""
@echo "Usage: make [target]"
@echo ""
@awk 'BEGIN {FS = ":.*##"; printf "Targets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " %-15s %s\n", $$1, $$2 } /^##@/ { printf "\n%s\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

## Build the Docker image
.PHONY: build
build:
docker build -t $(IMAGE) .

## Run container
.PHONY: run
run:
docker run --rm -it $(IMAGE)