Some checks failed
CICD Start / Sanity and Base Decision (pull_request) Failing after 1m4s
Signed-off-by: copilotcoder <copilotcoder@darkhelm.org>
163 lines
5.2 KiB
YAML
163 lines
5.2 KiB
YAML
name: CICD Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
head_sha:
|
|
description: Commit SHA to process
|
|
required: false
|
|
source_workflow:
|
|
description: Upstream workflow name
|
|
required: false
|
|
|
|
env:
|
|
GITEA_REGISTRY: kankali.darkhelm.lan:3001
|
|
GITEA_REGISTRY_IP: 10.18.75.2
|
|
GITEA_REGISTRY_HOST: kankali.darkhelm.lan
|
|
|
|
concurrency:
|
|
group: tests-${{ github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup Tests Context
|
|
runs-on: ubuntu-act
|
|
outputs:
|
|
head_sha: ${{ steps.meta.outputs.head_sha }}
|
|
steps:
|
|
- name: Audit trigger context
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
SOURCE_WORKFLOW: ${{ github.event.inputs.source_workflow }}
|
|
HEAD_SHA: ${{ github.sha }}
|
|
REF: ${{ github.ref }}
|
|
REF_NAME: ${{ github.ref_name }}
|
|
HEAD_REF: ${{ github.head_ref }}
|
|
run: |
|
|
echo "=== Dispatch Audit: CICD Tests ==="
|
|
echo "event_name=${EVENT_NAME}"
|
|
echo "source_workflow=${SOURCE_WORKFLOW}"
|
|
echo "head_sha=${HEAD_SHA}"
|
|
echo "ref=${REF}"
|
|
echo "ref_name=${REF_NAME}"
|
|
echo "head_ref=${HEAD_REF}"
|
|
|
|
- name: Resolve head SHA
|
|
id: meta
|
|
env:
|
|
HEAD_SHA: ${{ github.sha }}
|
|
run: |
|
|
echo "head_sha=${HEAD_SHA}" >> "$GITHUB_OUTPUT"
|
|
|
|
backend-tests:
|
|
name: Backend Tests
|
|
runs-on: ubuntu-act
|
|
needs: setup
|
|
steps:
|
|
- &configure_registry_host_step
|
|
name: Configure registry host resolution
|
|
run: |
|
|
if ! grep -q "${GITEA_REGISTRY_HOST}" /etc/hosts; then
|
|
echo "${GITEA_REGISTRY_IP} ${GITEA_REGISTRY_HOST}" >> /etc/hosts
|
|
fi
|
|
|
|
- &ensure_cicd_image_step
|
|
name: Ensure CICD image is available
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
IMAGE="${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}"
|
|
if docker image inspect "${IMAGE}" >/dev/null 2>&1; then
|
|
echo "Using cached CICD image: ${IMAGE}"
|
|
else
|
|
echo "${{ secrets.PACKAGE_ACCESS_TOKEN }}" | docker login "http://${GITEA_REGISTRY}" -u "${{ github.actor }}" --password-stdin
|
|
docker pull "${IMAGE}"
|
|
fi
|
|
|
|
- name: Run backend tests with coverage
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
docker run --rm "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c "
|
|
cd /workspace/backend &&
|
|
source .venv/bin/activate &&
|
|
uv run pytest -v --tb=short --cov=src --cov-report=term-missing --cov-fail-under=95
|
|
"
|
|
|
|
frontend-tests:
|
|
name: Frontend Tests
|
|
runs-on: ubuntu-act
|
|
needs: setup
|
|
steps:
|
|
- *configure_registry_host_step
|
|
- *ensure_cicd_image_step
|
|
- name: Run frontend tests with coverage
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
docker run --rm "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c "
|
|
cd /workspace/frontend &&
|
|
yarn test:coverage --run --reporter=verbose --coverage.reporter=text --coverage.reporter=text-summary --coverage.thresholds.lines=85 --coverage.thresholds.functions=85 --coverage.thresholds.branches=85 --coverage.thresholds.statements=85
|
|
"
|
|
|
|
xdoctest:
|
|
name: Backend Doctests
|
|
runs-on: ubuntu-act
|
|
needs: setup
|
|
steps:
|
|
- *configure_registry_host_step
|
|
- *ensure_cicd_image_step
|
|
- name: Run backend doctests
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
docker run --rm "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c "
|
|
cd /workspace/backend &&
|
|
source .venv/bin/activate &&
|
|
uv run xdoctest src/ --quiet
|
|
"
|
|
|
|
integration-tests:
|
|
name: Integration Tests
|
|
runs-on: ubuntu-act
|
|
needs: [setup, backend-tests]
|
|
steps:
|
|
- *configure_registry_host_step
|
|
- *ensure_cicd_image_step
|
|
- name: Run integration tests
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
docker run --rm "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c "
|
|
cd /workspace/backend &&
|
|
source .venv/bin/activate &&
|
|
if [ -d 'tests/integration' ]; then
|
|
uv run pytest tests/integration/ -v --tb=short
|
|
else
|
|
echo 'No integration tests found'
|
|
fi
|
|
"
|
|
|
|
e2e-tests:
|
|
name: End-to-End Tests
|
|
runs-on: ubuntu-act
|
|
needs: [setup, frontend-tests]
|
|
steps:
|
|
- *configure_registry_host_step
|
|
- *ensure_cicd_image_step
|
|
- name: Run E2E tests
|
|
env:
|
|
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
|
run: |
|
|
docker run --rm -e CI=true "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c "
|
|
cd /workspace/frontend &&
|
|
if [ -d 'tests/e2e' ] || grep -q 'playwright' package.json; then
|
|
yarn playwright --version &&
|
|
timeout 300 yarn playwright install chromium &&
|
|
yarn test:e2e --reporter=list --timeout=90000
|
|
else
|
|
echo 'No E2E tests found'
|
|
fi
|
|
"
|