Some checks failed
Tests / Frontend Linting (push) Has been cancelled
Tests / Build Base Setup Image (push) Successful in 1m22s
Tests / Build Frontend Environment (push) Failing after 12m33s
Tests / Build Backend Environment (push) Failing after 12m37s
Tests / Backend Tests (push) Has been cancelled
Tests / Backend Linting (push) Has been cancelled
Tests / Frontend Tests (push) Has been cancelled
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
178 lines
5.2 KiB
YAML
178 lines
5.2 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop, feature/* ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
|
|
jobs:
|
|
setup:
|
|
name: Build Base Setup Image
|
|
runs-on: ubuntu-act
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
GITHUB_WORKSPACE: ${{ github.workspace }}
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
run: |
|
|
echo "=== Repository Checkout ==="
|
|
cd "${GITHUB_WORKSPACE}"
|
|
rm -rf ./* .git 2>/dev/null || true
|
|
|
|
# Set up SSH key
|
|
if [ -n "${SSH_PRIVATE_KEY}" ]; then
|
|
mkdir -p ~/.ssh
|
|
echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -p 2222 dogar.darkhelm.org >> ~/.ssh/known_hosts 2>/dev/null
|
|
fi
|
|
|
|
# Clone repository
|
|
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no" \
|
|
git clone --depth 1 --branch main \
|
|
ssh://git@dogar.darkhelm.org:2222/DarkHelm.org/plex-playlist.git .
|
|
|
|
if [ -n "${GITHUB_SHA}" ]; then
|
|
git checkout "${GITHUB_SHA}" 2>/dev/null || echo "Using main branch HEAD"
|
|
fi
|
|
echo "✓ Repository checkout completed"
|
|
|
|
- name: Build cicd-setup image
|
|
run: |
|
|
echo "=== Building CICD Setup Image ==="
|
|
|
|
# Build the base setup image with source code
|
|
docker build -f Dockerfile.cicd-setup -t cicd-setup:latest .
|
|
|
|
# Verify the image was built
|
|
docker images | grep cicd-setup
|
|
|
|
echo "✓ CICD setup image ready"
|
|
|
|
backend-setup:
|
|
name: Build Backend Environment
|
|
runs-on: ubuntu-act
|
|
needs: setup
|
|
|
|
steps:
|
|
- name: Build cicd-backend image
|
|
run: |
|
|
echo "=== Building CICD Backend Image ==="
|
|
|
|
# Build the backend image extending the setup image
|
|
docker build -f Dockerfile.cicd-backend -t cicd-backend:latest .
|
|
|
|
# Verify the image was built and tools are available
|
|
docker images | grep cicd-backend
|
|
docker run --rm cicd-backend:latest bash -c "cd /workspace/backend && ruff --version && pyright --version"
|
|
|
|
echo "✓ CICD backend image ready"
|
|
|
|
frontend-setup:
|
|
name: Build Frontend Environment
|
|
runs-on: ubuntu-act
|
|
needs: setup
|
|
|
|
steps:
|
|
- name: Build cicd-frontend image
|
|
run: |
|
|
echo "=== Building CICD Frontend Image ==="
|
|
|
|
# Build the frontend image extending the setup image
|
|
docker build -f Dockerfile.cicd-frontend -t cicd-frontend:latest .
|
|
|
|
# Verify the image was built and tools are available
|
|
docker images | grep cicd-frontend
|
|
docker run --rm cicd-frontend:latest bash -c "cd /workspace/frontend && yarn eslint --version && ls -la dist/"
|
|
|
|
echo "✓ CICD frontend image ready"
|
|
|
|
backend-tests:
|
|
name: Backend Tests
|
|
runs-on: ubuntu-act
|
|
needs: backend-setup
|
|
|
|
steps:
|
|
- name: Run backend tests
|
|
run: |
|
|
echo "=== Running Backend Tests ==="
|
|
|
|
# Run tests using the pre-built backend image
|
|
docker run --rm cicd-backend:latest bash -c "
|
|
cd /workspace/backend &&
|
|
uv run pytest -v --tb=short --cov=src --cov-report=term-missing
|
|
"
|
|
|
|
echo "✓ Backend tests completed"
|
|
|
|
backend-lint:
|
|
name: Backend Linting
|
|
runs-on: ubuntu-act
|
|
needs: backend-setup
|
|
|
|
steps:
|
|
- name: Run backend linting
|
|
run: |
|
|
echo "=== Running Backend Linting ==="
|
|
|
|
# Run all backend linting tools using the pre-built image
|
|
docker run --rm cicd-backend:latest bash -c "
|
|
cd /workspace/backend &&
|
|
echo '--- Running ruff linting ---' &&
|
|
uv run ruff check . &&
|
|
echo '--- Running ruff formatting check ---' &&
|
|
uv run ruff format --check . &&
|
|
echo '--- Running pyright type checking ---' &&
|
|
uv run pyright &&
|
|
echo '--- Running darglint docstring linting ---' &&
|
|
uv run darglint src/
|
|
"
|
|
|
|
echo "✓ Backend linting completed"
|
|
|
|
frontend-tests:
|
|
name: Frontend Tests
|
|
runs-on: ubuntu-act
|
|
needs: frontend-setup
|
|
|
|
steps:
|
|
- name: Run frontend tests
|
|
run: |
|
|
echo "=== Running Frontend Tests ==="
|
|
|
|
# Run tests using the pre-built frontend image
|
|
docker run --rm cicd-frontend:latest bash -c "
|
|
cd /workspace/frontend &&
|
|
yarn test --run --reporter=verbose
|
|
"
|
|
|
|
echo "✓ Frontend tests completed"
|
|
|
|
frontend-lint:
|
|
name: Frontend Linting
|
|
runs-on: ubuntu-act
|
|
needs: frontend-setup
|
|
|
|
steps:
|
|
- name: Run frontend linting
|
|
run: |
|
|
echo "=== Running Frontend Linting ==="
|
|
|
|
# Run all frontend linting tools using the pre-built image
|
|
docker run --rm cicd-frontend:latest bash -c "
|
|
cd /workspace/frontend &&
|
|
echo '--- Running ESLint ---' &&
|
|
yarn lint &&
|
|
echo '--- Running Prettier check ---' &&
|
|
yarn format:check &&
|
|
echo '--- Running TypeScript type checking ---' &&
|
|
yarn type-check &&
|
|
echo '--- Running TSDoc linting ---' &&
|
|
yarn lint:tsdoc
|
|
"
|
|
|
|
echo "✓ Frontend linting completed"
|