Skip to content

ci: re-enable GitHub Actions #21

ci: re-enable GitHub Actions

ci: re-enable GitHub Actions #21

Workflow file for this run

name: CI
on:
push:
branches: [main, dev]
tags: ['v*.*.*']
pull_request:
branches: [main]
jobs:
lint-and-test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f pyproject.toml ]; then
pip install -e ".[dev]" 2>/dev/null || pip install -e .
elif [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
pip install ruff pytest
- name: Lint with ruff
run: ruff check .
- name: Run tests
run: |
if [ -d tests ]; then
pytest --tb=short -q
else
echo "No tests directory found, skipping pytest"
fi
docker:
name: Build & Push Docker image
runs-on: ubuntu-latest
needs: lint-and-test
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max