feat: add comprehensive framework features and deployment improvements
Major additions: - Storage abstraction layer with filesystem and in-memory implementations - Gitea API integration with MCP tools for repository management - Console dialog mode with interactive command execution - WireGuard VPN DNS fix implementation and documentation - HTTP client streaming response support - Router generic result type - Parameter type validator for framework core Framework enhancements: - Console command registry improvements - Console dialog components - Method signature analyzer updates - Route mapper refinements - MCP server and tool mapper updates - Queue job chain and dependency commands - Discovery tokenizer improvements Infrastructure: - Deployment architecture documentation - Ansible playbook updates for WireGuard client regeneration - Production environment configuration updates - Docker Compose local configuration updates - Remove obsolete docker-compose.yml (replaced by environment-specific configs) Documentation: - PERMISSIONS.md for access control guidelines - WireGuard DNS fix implementation details - Console dialog mode usage guide - Deployment architecture overview Testing: - Multi-purpose attribute tests - Gitea Actions integration tests (typed and untyped)
This commit is contained in:
116
tests/debug/test-gitea-actions.php
Normal file
116
tests/debug/test-gitea-actions.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
use App\Infrastructure\Api\Gitea\GiteaClient;
|
||||
use App\Infrastructure\Api\Gitea\GiteaConfig;
|
||||
use App\Framework\HttpClient\CurlHttpClient;
|
||||
|
||||
// Load environment variables manually
|
||||
$envFile = __DIR__ . '/../../.env';
|
||||
if (file_exists($envFile)) {
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos(trim($line), '#') === 0) {
|
||||
continue;
|
||||
}
|
||||
putenv($line);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize GiteaClient
|
||||
$config = new GiteaConfig(
|
||||
baseUrl: getenv('GITEA_URL') ?: '',
|
||||
token: getenv('GITEA_TOKEN') ?: null,
|
||||
username: getenv('GITEA_USERNAME') ?: null,
|
||||
password: getenv('GITEA_PASSWORD') ?: null,
|
||||
timeout: (float) (getenv('GITEA_TIMEOUT') ?: 30.0)
|
||||
);
|
||||
|
||||
$httpClient = new CurlHttpClient();
|
||||
$giteaClient = new GiteaClient($config, $httpClient);
|
||||
|
||||
echo "\n=== Testing Gitea Actions/Workflows API ===\n\n";
|
||||
|
||||
$owner = 'michael';
|
||||
$repo = 'michaelschiemer';
|
||||
|
||||
try {
|
||||
// Test 1: List Workflows
|
||||
echo "1. Listing Workflows for {$owner}/{$repo}:\n";
|
||||
echo str_repeat('-', 60) . "\n";
|
||||
|
||||
$workflows = $giteaClient->actions->listWorkflows($owner, $repo);
|
||||
|
||||
if (isset($workflows['workflows']) && !empty($workflows['workflows'])) {
|
||||
foreach ($workflows['workflows'] as $workflow) {
|
||||
echo " - Workflow: {$workflow['name']}\n";
|
||||
echo " ID: {$workflow['id']}\n";
|
||||
echo " Path: {$workflow['path']}\n";
|
||||
echo " State: {$workflow['state']}\n";
|
||||
echo "\n";
|
||||
}
|
||||
} else {
|
||||
echo " No workflows found.\n\n";
|
||||
}
|
||||
|
||||
// Test 2: List Workflow Runs (last 10)
|
||||
echo "2. Listing Recent Workflow Runs (last 10):\n";
|
||||
echo str_repeat('-', 60) . "\n";
|
||||
|
||||
$runs = $giteaClient->actions->listRuns($owner, $repo, [
|
||||
'limit' => 10
|
||||
]);
|
||||
|
||||
if (isset($runs['workflow_runs']) && !empty($runs['workflow_runs'])) {
|
||||
foreach ($runs['workflow_runs'] as $run) {
|
||||
echo " - Run #{$run['id']}\n";
|
||||
echo " Title: {$run['display_title']}\n";
|
||||
echo " Status: {$run['status']}\n";
|
||||
echo " Conclusion: " . ($run['conclusion'] ?? 'N/A') . "\n";
|
||||
echo " Started: {$run['started_at']}\n";
|
||||
echo " Branch: {$run['head_branch']}\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Test 3: Get detailed info about latest run
|
||||
$latestRun = $runs['workflow_runs'][0];
|
||||
echo "3. Detailed Info for Latest Run (#{$latestRun['id']}):\n";
|
||||
echo str_repeat('-', 60) . "\n";
|
||||
|
||||
$runDetails = $giteaClient->actions->getRun($owner, $repo, $latestRun['id']);
|
||||
|
||||
echo " Workflow: {$runDetails['name']}\n";
|
||||
echo " Status: {$runDetails['status']}\n";
|
||||
echo " Conclusion: " . ($runDetails['conclusion'] ?? 'N/A') . "\n";
|
||||
echo " Triggered by: {$runDetails['event']}\n";
|
||||
echo " Branch: {$runDetails['head_branch']}\n";
|
||||
echo " Commit: {$runDetails['head_sha']}\n";
|
||||
echo " Run Number: {$runDetails['run_number']}\n";
|
||||
echo " Started: {$runDetails['run_started_at']}\n";
|
||||
|
||||
if (isset($runDetails['jobs'])) {
|
||||
echo "\n Jobs:\n";
|
||||
foreach ($runDetails['jobs'] as $job) {
|
||||
echo " - {$job['name']}: {$job['status']}";
|
||||
if (isset($job['conclusion'])) {
|
||||
echo " ({$job['conclusion']})";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo " No workflow runs found.\n";
|
||||
}
|
||||
|
||||
echo "\n✅ Actions/Workflows API Test SUCCESSFUL!\n";
|
||||
|
||||
} catch (\Exception $e) {
|
||||
echo "\n❌ Error: " . $e->getMessage() . "\n";
|
||||
echo "File: " . $e->getFile() . "\n";
|
||||
echo "Line: " . $e->getLine() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user