From be3e3ce15ffe873002360a6b2eff863f02c5f09c Mon Sep 17 00:00:00 2001 From: copilotcoder Date: Tue, 16 Jun 2026 11:08:38 -0400 Subject: [PATCH] CICD stability would be nice. Signed-off-by: copilotcoder --- .gitea/workflows/cicd-checks.yaml | 34 +++++++++++++++- .gitea/workflows/cicd-tests.yaml | 65 ++++++++++++++++++++++++++++--- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/cicd-checks.yaml b/.gitea/workflows/cicd-checks.yaml index 8bc3a78..8f9d076 100644 --- a/.gitea/workflows/cicd-checks.yaml +++ b/.gitea/workflows/cicd-checks.yaml @@ -194,6 +194,11 @@ jobs: HEAD_SHA: ${{ needs.setup.outputs.head_sha }} HOOK: ${{ matrix.hook }} run: | + set -o pipefail + echo "=== Pre-commit Hook Start ===" + echo "hook=${HOOK}" + echo "head_sha=${HEAD_SHA}" + if [ "${HOOK}" = "prettier" ]; then echo "=== Host Workspace Debug (prettier) ===" echo "host_head_sha=${HEAD_SHA}" @@ -203,6 +208,8 @@ jobs: cd .. fi + LOG_FILE="$(mktemp)" + docker run --rm -e CI=true --entrypoint /bin/sh "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" -c " export HOME=/tmp/cicd-home && mkdir -p \"$HOME\" && echo 'running_hook=${HOOK}' && @@ -254,7 +261,32 @@ jobs: ;; esac && /workspace/backend/.venv/bin/pre-commit run ${HOOK} --all-files --show-diff-on-failure - " + " 2>&1 | tee "${LOG_FILE}" + + HOOK_STATUS=${PIPESTATUS[0]} + if [ "${HOOK_STATUS}" -ne 0 ]; then + echo "❌ Pre-commit hook failed: ${HOOK} (exit=${HOOK_STATUS})" + echo "--- Last 200 lines of hook output ---" + tail -n 200 "${LOG_FILE}" || true + + if [ "${HOOK}" = "pydoclint" ]; then + echo "=== Additional pydoclint diagnostics ===" + docker run --rm -e CI=true --entrypoint /bin/sh "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" -c " + set -e + cd /workspace/backend + echo 'python_version=' && python3 --version + echo 'uv_version=' && uv --version + echo 'pydoclint_version=' && uv run pydoclint --version + echo 'backend_py_count=' && find src -name '*.py' | wc -l + echo 'running_direct_pydoclint=' + uv run pydoclint --config=pyproject.toml src/ + " || true + fi + + exit "${HOOK_STATUS}" + fi + + echo "=== Pre-commit Hook End (success) ===" dispatch-tests: name: Dispatch CICD Tests diff --git a/.gitea/workflows/cicd-tests.yaml b/.gitea/workflows/cicd-tests.yaml index 42441c4..deebf6f 100644 --- a/.gitea/workflows/cicd-tests.yaml +++ b/.gitea/workflows/cicd-tests.yaml @@ -135,11 +135,22 @@ jobs: env: HEAD_SHA: ${{ needs.setup.outputs.head_sha }} run: | + set -o pipefail + LOG_FILE="$(mktemp)" + 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 - " + " 2>&1 | tee "${LOG_FILE}" + + TEST_STATUS=${PIPESTATUS[0]} + if [ "${TEST_STATUS}" -ne 0 ]; then + echo "❌ Backend tests failed (exit=${TEST_STATUS})" + echo "--- Last 200 lines of backend test output ---" + tail -n 200 "${LOG_FILE}" || true + exit "${TEST_STATUS}" + fi frontend-tests: name: Frontend Tests @@ -166,10 +177,21 @@ jobs: env: HEAD_SHA: ${{ needs.setup.outputs.head_sha }} run: | + set -o pipefail + LOG_FILE="$(mktemp)" + 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 - " + " 2>&1 | tee "${LOG_FILE}" + + TEST_STATUS=${PIPESTATUS[0]} + if [ "${TEST_STATUS}" -ne 0 ]; then + echo "❌ Frontend tests failed (exit=${TEST_STATUS})" + echo "--- Last 200 lines of frontend test output ---" + tail -n 200 "${LOG_FILE}" || true + exit "${TEST_STATUS}" + fi xdoctest: name: Backend Doctests @@ -196,11 +218,22 @@ jobs: env: HEAD_SHA: ${{ needs.setup.outputs.head_sha }} run: | + set -o pipefail + LOG_FILE="$(mktemp)" + 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 - " + " 2>&1 | tee "${LOG_FILE}" + + TEST_STATUS=${PIPESTATUS[0]} + if [ "${TEST_STATUS}" -ne 0 ]; then + echo "❌ Backend doctests failed (exit=${TEST_STATUS})" + echo "--- Last 200 lines of doctest output ---" + tail -n 200 "${LOG_FILE}" || true + exit "${TEST_STATUS}" + fi integration-tests: name: Integration Tests @@ -227,6 +260,9 @@ jobs: env: HEAD_SHA: ${{ needs.setup.outputs.head_sha }} run: | + set -o pipefail + LOG_FILE="$(mktemp)" + docker run --rm "${GITEA_REGISTRY}/darkhelm.org/plex-playlist-cicd:${HEAD_SHA}" bash -c " cd /workspace/backend && source .venv/bin/activate && @@ -235,7 +271,15 @@ jobs: else echo 'No integration tests found' fi - " + " 2>&1 | tee "${LOG_FILE}" + + TEST_STATUS=${PIPESTATUS[0]} + if [ "${TEST_STATUS}" -ne 0 ]; then + echo "❌ Integration tests failed (exit=${TEST_STATUS})" + echo "--- Last 200 lines of integration test output ---" + tail -n 200 "${LOG_FILE}" || true + exit "${TEST_STATUS}" + fi e2e-tests: name: End-to-End Tests @@ -262,6 +306,9 @@ jobs: env: HEAD_SHA: ${{ needs.setup.outputs.head_sha }} run: | + set -o pipefail + LOG_FILE="$(mktemp)" + 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 @@ -286,4 +333,12 @@ jobs: else echo 'No E2E tests found' fi - " + " 2>&1 | tee "${LOG_FILE}" + + TEST_STATUS=${PIPESTATUS[0]} + if [ "${TEST_STATUS}" -ne 0 ]; then + echo "❌ E2E tests failed (exit=${TEST_STATUS})" + echo "--- Last 200 lines of E2E output ---" + tail -n 200 "${LOG_FILE}" || true + exit "${TEST_STATUS}" + fi