Skip to content

fix(tests): Fix import order in test_domain.py for ruff compliance #17

fix(tests): Fix import order in test_domain.py for ruff compliance

fix(tests): Fix import order in test_domain.py for ruff compliance #17

Workflow file for this run

name: Build and Deploy SIL Website
on:
push:
branches: [main, master]
tags: ['v*']
pull_request:
branches: [main, master]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Create virtual environment
run: uv venv
- name: Install dependencies
run: |
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run ruff
run: |
source .venv/bin/activate
ruff check .
- name: Run mypy
run: |
source .venv/bin/activate
mypy src/
- name: Run pytest
run: |
source .venv/bin/activate
pytest --cov=src tests/
build:
name: Build Container
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Set up Podman
run: |
sudo apt-get update
sudo apt-get install -y podman
- name: Build container image
run: |
podman build -t sil-website:${{ github.sha }} .
podman tag sil-website:${{ github.sha }} sil-website:latest
- name: Test container health
run: |
# Run container
podman run -d --name sil-website-test -p 8000:8000 sil-website:latest
# Wait for health check
sleep 10
# Check health endpoint
curl -f http://localhost:8000/health || exit 1
# Stop container
podman stop sil-website-test
- name: Log in to GitHub Container Registry
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
podman login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push to GitHub Container Registry
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
run: |
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/sil-website
# Tag and push latest
podman tag sil-website:latest $IMAGE_NAME:latest
podman push $IMAGE_NAME:latest
# If tagged release, also push version tag
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
podman tag sil-website:latest $IMAGE_NAME:$VERSION
podman push $IMAGE_NAME:$VERSION
fi
deploy:
name: Deploy to Production
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
# Uncomment when ready for automated deployment
# environment: production
steps:
- name: Deploy notice
run: |
echo "🚀 Ready to deploy to production"
echo "Uncomment SSH deployment steps when server is configured"
# Uncomment when production server is ready
# - name: Deploy to production
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.DEPLOY_HOST }}
# username: ${{ secrets.DEPLOY_USER }}
# key: ${{ secrets.DEPLOY_KEY }}
# script: |
# cd /home/scottsen/src/projects/sil-website
# git pull
# podman pull ghcr.io/${{ github.repository_owner }}/sil-website:latest
# sudo systemctl restart sil-website
# sleep 5
# curl -f https://semanticinfrastructurelab.org/health || exit 1