TenantAtlas/scripts/platform-test-artifacts
ahmido f03555eae1 Spec 295: full suite CI lane baseline (#350)
## Summary
- add the Spec 295 artifacts for full-suite failure classification and CI lane baseline work
- fix `scripts/platform-test-artifacts` so Sail passes artifact staging inputs into the embedded PHP script via argv
- add a guard test covering the artifact staging input contract

## Scope guards
- no browser screenshot baselines included
- no generated test artifacts included
- no runtime application code changes included

## Notes
- classification evidence and follow-up ownership are documented in `specs/295-full-suite-ci-baseline/failure-classification.md`
- this PR is intentionally limited to the CI/lane/artifact contract slice for Spec 295

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #350
2026-05-11 11:14:56 +00:00

71 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
APP_DIR="${ROOT_DIR}/apps/platform"
LANE="${1:-}"
STAGING_DIRECTORY="${2:-}"
ARTIFACT_DIRECTORY=""
WORKFLOW_ID="${TENANTATLAS_CI_WORKFLOW_ID:-}"
TRIGGER_CLASS="${TENANTATLAS_CI_TRIGGER_CLASS:-}"
if [[ -z "${LANE}" || -z "${STAGING_DIRECTORY}" ]]; then
echo "Usage: ./scripts/platform-test-artifacts <lane-id> <staging-directory> [--artifact-directory=storage/logs/test-lanes] [--workflow-id=<id>] [--trigger-class=<trigger>]" >&2
exit 1
fi
shift 2 || true
for arg in "$@"; do
if [[ "${arg}" == --artifact-directory=* ]]; then
ARTIFACT_DIRECTORY="${arg#--artifact-directory=}"
continue
fi
if [[ "${arg}" == --workflow-id=* ]]; then
WORKFLOW_ID="${arg#--workflow-id=}"
continue
fi
if [[ "${arg}" == --trigger-class=* ]]; then
TRIGGER_CLASS="${arg#--trigger-class=}"
continue
fi
echo "Unknown option: ${arg}" >&2
exit 1
done
if [[ -n "${WORKFLOW_ID}" ]]; then
export TENANTATLAS_CI_WORKFLOW_ID="${WORKFLOW_ID}"
fi
if [[ -n "${TRIGGER_CLASS}" ]]; then
export TENANTATLAS_CI_TRIGGER_CLASS="${TRIGGER_CLASS}"
fi
cd "${APP_DIR}"
./vendor/bin/sail php -- "${LANE}" "${STAGING_DIRECTORY}" "${ARTIFACT_DIRECTORY}" <<'PHP'
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
$laneId = (string) ($argv[1] ?? '');
$stagingDirectory = (string) ($argv[2] ?? '');
$artifactDirectory = (string) ($argv[3] ?? '');
$artifactDirectory = trim($artifactDirectory) !== ''
? $artifactDirectory
: null;
$result = \Tests\Support\TestLaneReport::stageArtifacts($laneId, $stagingDirectory, $artifactDirectory);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR).PHP_EOL;
exit(($result['complete'] ?? false) === true ? 0 : 1);
PHP