From dd40e071e86b92f7ce4e61f9e7c384312aad3578 Mon Sep 17 00:00:00 2001 From: "akshay14.garg" Date: Tue, 15 Jul 2025 18:01:09 +0530 Subject: [PATCH 1/3] feat(auth):CD PipeLine WorkFlow for Pullpiri[#116] --- .github/workflows/ci-dispatcher.yml | 36 ++++-- .github/workflows/release.yml | 189 ++++++++++++++++++++++++++++ .github/workflows/run-ci.yml | 84 +++++++++++-- .github/workflows/run-validate.yml | 15 ++- scripts/buildNparse.sh | 18 ++- scripts/clippy_check.sh | 99 +++++++-------- scripts/deny_check.sh | 48 ++++--- scripts/fmt_check.sh | 41 +++--- scripts/installdeps.sh | 62 +++++++-- scripts/license_check.sh | 60 +++++++++ scripts/testNparse.sh | 186 ++++++++++++++------------- src/agent/about.hbs | 70 +++++++++++ src/agent/about.toml | 10 ++ src/common/about.hbs | 70 +++++++++++ src/common/about.toml | 10 ++ src/player/about.hbs | 70 +++++++++++ src/player/about.toml | 11 ++ src/server/about.hbs | 70 +++++++++++ src/server/about.toml | 10 ++ src/tools/about.hbs | 70 +++++++++++ src/tools/about.toml | 10 ++ 21 files changed, 1016 insertions(+), 223 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100755 scripts/license_check.sh create mode 100644 src/agent/about.hbs create mode 100644 src/agent/about.toml create mode 100644 src/common/about.hbs create mode 100644 src/common/about.toml create mode 100644 src/player/about.hbs create mode 100644 src/player/about.toml create mode 100644 src/server/about.hbs create mode 100644 src/server/about.toml create mode 100644 src/tools/about.hbs create mode 100644 src/tools/about.toml diff --git a/.github/workflows/ci-dispatcher.yml b/.github/workflows/ci-dispatcher.yml index e0b2d5e86..37ccacc34 100644 --- a/.github/workflows/ci-dispatcher.yml +++ b/.github/workflows/ci-dispatcher.yml @@ -8,51 +8,61 @@ on: workflow_dispatch: jobs: + # 🧠 Job 1: Detect file changes and conditionally trigger jobs based on them detect-changes: runs-on: ubuntu-latest outputs: - rust_changed: ${{ steps.filter.outputs.rust }} - doc_changed: ${{ steps.filter.outputs.docs }} - yaml_changed: ${{ steps.filter.outputs.yaml }} + rust_changed: ${{ steps.filter.outputs.rust }} # Set to true if any Rust-relevant files changed + doc_changed: ${{ steps.filter.outputs.docs }} # True if docs (Markdown) changed + yaml_changed: ${{ steps.filter.outputs.yaml }} # True if GitHub workflow YAMLs changed steps: + # Step 1: Checkout repo contents - uses: actions/checkout@v4 + + # Step 2: Use `dorny/paths-filter` to detect what kinds of files changed - id: filter uses: dorny/paths-filter@v3 with: filters: | rust: - - '**/*.rs' - - '**/*.toml' - - 'Cargo.lock' - - 'scripts/**' + - '**/*.rs' # All Rust source files + - '**/*.toml' # Cargo.toml or other TOML configs + - 'Cargo.lock' # Cargo.lock for dependency changes + - 'scripts/**' # Shell scripts that might affect build/test + - 'Makefile' # Dev tooling changes + - '**/*.yaml' # Scenario or config YAMLs + - '**/*.sh' # Bash scripts docs: - - '**/*.md' + - '**/*.md' # Markdown docs (README, etc.) yaml: - - '.github/workflows/*.yml' + - '.github/workflows/*.yml' # GitHub workflow YAMLs + # πŸš€ Job 2: Trigger full Rust CI workflow if Rust files or configs changed run-rust-ci: needs: detect-changes if: needs.detect-changes.outputs.rust_changed == 'true' - uses: ./.github/workflows/run-ci.yml + uses: ./.github/workflows/run-ci.yml # Reuse centralized Rust CI logic + # πŸ“š Job 3: Run markdown/documentation linter if only docs changed run-doc-lint: needs: detect-changes if: needs.detect-changes.outputs.doc_changed == 'true' uses: ./.github/workflows/run-doc.yml + # βš™οΈ Job 4: Validate GitHub YAML workflows (lint schema or check logic) run-yaml-validation: needs: detect-changes if: needs.detect-changes.outputs.yaml_changed == 'true' uses: ./.github/workflows/run-validate.yml - # Final job for branch protection + # πŸ“¦ Job 5: Always run this last to print a clean summary in Actions UI ci-summary: name: CI Complete Summary runs-on: ubuntu-latest - if: always() + if: always() # Run even if earlier jobs were skipped or failed needs: - run-rust-ci - run-doc-lint - run-yaml-validation steps: - - run: echo "All CI jobs (if triggered) have completed." \ No newline at end of file + - run: echo "βœ… All CI jobs (if triggered) have completed." \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..608cabdf7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,189 @@ +name: Release + +# Trigger the workflow only when a new tag starting with "v" is pushed (e.g., v1.0.0) +on: + push: + tags: + - v* + +# Prevent duplicate jobs running for same tag; cancel in-progress if newer tag is pushed +concurrency: + group: "release-${{ github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + # Run the main Rust CI checks (tests, formatting, lint, etc.) + run-rust-ci: + uses: ./.github/workflows/run-ci.yml + + # Run Rust documentation lint checks + run-doc-lint: + uses: ./.github/workflows/run-doc.yml + + # Run YAML syntax and structure validation + run-yaml-validation: + uses: ./.github/workflows/run-validate.yml + + # Generate license reports using cargo-about + run-license-report: + uses: ./.github/workflows/run-license-check.yml + + # Main job to gather reports and publish artifacts to the GitHub release + tag_release_artifacts: + # Run this job only for version tag pushes + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + name: Collect and upload release artifacts + runs-on: ubuntu-latest + + # Ensure all upstream jobs complete successfully before running this one + needs: + - run-rust-ci + - run-doc-lint + - run-yaml-validation + - run-license-report + + # Grant full write access for upload operations + permissions: write-all + + steps: + # Checkout code and all submodules + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + # Download deny-check report generated in prior jobs + - name: Download deny report + uses: actions/download-artifact@v4 + with: + name: deny-report + path: dist/reports/deny/ + + # Download formatting (cargo fmt) report + - name: Download fmt report + uses: actions/download-artifact@v4 + with: + name: fmt-report + path: dist/reports/fmt/ + + # Download test reports (Junit XML) + - name: Download test report + uses: actions/download-artifact@v4 + with: + name: test-report + path: dist/tests/ + + # Download license HTML report + - name: Download license report + uses: actions/download-artifact@v4 + with: + name: license-report + path: dist/licenses/ + + # Upload deny report to the GitHub release assets + - name: Upload deny report to release + uses: svenstaro/upload-release-action@v2 + id: upload_deny_report + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/reports/deny/deny_summary.md + tag: ${{ github.ref }} + + # Upload formatting (cargo fmt) report + - name: Upload fmt report to release + uses: svenstaro/upload-release-action@v2 + id: upload_fmt_report + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/reports/fmt/fmt_summary.md + tag: ${{ github.ref }} + + # Upload the combined JUnit test report XML + - name: Upload test report to release + uses: svenstaro/upload-release-action@v2 + id: upload_test_report + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/tests/test_summary.xml + file_glob: true + tag: ${{ github.ref }} + + # Upload license HTML report (e.g., for apiserver) + - name: Upload license report to release + uses: svenstaro/upload-release-action@v2 + id: upload_license_report + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/licenses/apiserver_licenses.html + file_glob: true + tag: ${{ github.ref }} + + # Fetch details of the latest release (needed for quevee) + - name: Gets latest created release info + id: latest_release_info + uses: joutvhu/get-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Upload README file to release assets + - name: Upload README to release + uses: svenstaro/upload-release-action@v2 + id: upload_readme + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: README.md + tag: ${{ github.ref }} + + # Upload coding rules or guidelines to release assets + - name: Upload Coding Guidelines to release + uses: svenstaro/upload-release-action@v2 + id: upload_coding_guidelines + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: src/coding-rule.md + tag: ${{ github.ref }} + + # Upload release process to release assets + - name: Upload Release Process to release + uses: svenstaro/upload-release-action@v2 + id: upload_release_process + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: .github/workflows/release.yml + tag: ${{ github.ref }} + + # Step to create a compressed archive of the entire 'doc/' folder + - name: Archive doc folder + shell: bash + run: | + # Create a tar.gz archive named 'doc-archive.tar.gz' containing everything in 'doc/' + tar czf doc-archive.tar.gz doc/ + + # Step to upload the archived docs as a release asset to the current Git tag release + - name: Upload doc archive to release + uses: svenstaro/upload-release-action@v2 + id: upload_doc + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: doc-archive.tar.gz + tag: ${{ github.ref }} + + # Generate a quality manifest (quality metadata file) using Eclipse Dash QueVee + - name: Collect quality artifacts with quevee + id: quevee_manifest + uses: eclipse-dash/quevee@v1 + with: + release_url: ${{ steps.latest_release_info.outputs.html_url }} + artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }} + artifacts_coding_guidelines: ${{ steps.upload_coding_guidelines.outputs.browser_download_url }} + artifacts_release_process: ${{ steps.upload_release_process.outputs.browser_download_url }} + artifacts_documentation: ${{ steps.upload_doc.outputs.browser_download_url }} + artifacts_requirements: ${{ steps.upload_doc.outputs.browser_download_url }} + artifacts_testing: ${{ steps.upload_test_report.outputs.browser_download_url }}, ${{ steps.upload_license_report.outputs.browser_download_url }}, ${{ steps.upload_fmt_report.outputs.browser_download_url }}, ${{ steps.upload_deny_report.outputs.browser_download_url }} + + # Upload the final manifest file (produced by quevee) to the GitHub release + - name: Upload quality manifest to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.quevee_manifest.outputs.manifest_file }} + tag: ${{ github.ref }} diff --git a/.github/workflows/run-ci.yml b/.github/workflows/run-ci.yml index d2e8711f6..eea05288a 100644 --- a/.github/workflows/run-ci.yml +++ b/.github/workflows/run-ci.yml @@ -6,20 +6,84 @@ on: jobs: rust_ci: - runs-on: ubuntu-latest - container: - image: rust:latest + runs-on: ubuntu-latest # Use GitHub-hosted runner with Docker installed + steps: - - uses: actions/checkout@v4 - - name: Install deps + # Step 1: Checkout the code + - name: Checkout repository + uses: actions/checkout@v4 + + # Step 2: Install Rust toolchain + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + # Step 3: Install Docker Compose dependencies (if needed) + - name: Install Docker Compose and utilities + run: | + sudo apt-get update -y + sudo apt-get install -y docker-compose jq curl lsb-release + + # Step 4: Make all scripts executable + - name: Make scripts executable + run: chmod +x scripts/*.sh + + # Step 5: Install Rust project dependencies + - name: Install project dependencies run: ./scripts/installdeps.sh - - name: Build + + # Step 6: Create output folders for reports + - name: Create reports directory + run: | + mkdir -p dist/reports/fmt + mkdir -p dist/reports/deny + mkdir -p dist/tests + mkdir -p dist/licenses + + # Step 7: Run project build and parse logs + - name: Build and parse project run: ./scripts/buildNparse.sh - - name: Test + + # Step 8: Run all Rust unit/integration tests and generate reports + - name: Run tests and generate report run: ./scripts/testNparse.sh - - name: Lint + + # Step 9: Linting (clippy) + - name: Run Clippy (lint) run: ./scripts/clippy_check.sh - - name: Format + + # Step 10: Formatting check + - name: Run format check run: ./scripts/fmt_check.sh - - name: Cargo Deny (License, Advisories, Bans) + + # Step 11: License, ban, and security checks with cargo-deny + - name: Run cargo-deny checks run: ./scripts/deny_check.sh + + # === Upload All Reports === + + # Step 12: Upload deny report + - name: Upload deny report + if: always() + uses: actions/upload-artifact@v4 + with: + name: deny-report + path: dist/reports/deny/deny_summary.md + + # Step 13: Upload format report + - name: Upload fmt report + if: always() + uses: actions/upload-artifact@v4 + with: + name: fmt-report + path: dist/reports/fmt/fmt_summary.md + + # Step 14: Upload all test reports (JUnit-style) + - name: Upload test reports + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-report + path: dist/tests/* diff --git a/.github/workflows/run-validate.yml b/.github/workflows/run-validate.yml index a01d56ba2..671766f59 100644 --- a/.github/workflows/run-validate.yml +++ b/.github/workflows/run-validate.yml @@ -1,16 +1,23 @@ name: Validate Workflow YAML +# This workflow is reusable and can also be triggered manually on: - workflow_call: - workflow_dispatch: + workflow_call: # Allows this workflow to be called from other workflows + workflow_dispatch: # Enables manual trigger via GitHub UI jobs: validate_yaml: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # Use the latest Ubuntu runner + steps: + # Step 1: Checkout the repository so we can access workflow files - uses: actions/checkout@v4 + + # Step 2: Validate all .yml workflow files using `yq` - name: Validate workflows run: | + # Loop through each workflow file in .github/workflows for file in .github/workflows/*.yml; do + # Use `yq` to parse the YAML; exit non-zero if invalid yq eval '.' "$file" > /dev/null - done \ No newline at end of file + done diff --git a/scripts/buildNparse.sh b/scripts/buildNparse.sh index 7b321a571..f949b6363 100755 --- a/scripts/buildNparse.sh +++ b/scripts/buildNparse.sh @@ -1,17 +1,25 @@ #!/bin/bash +# Exit immediately on error, undefined variable, or pipeline failure set -euo pipefail +# Set up log files LOG_FILE="build_results.log" TMP_FILE="build_output.txt" rm -f "$LOG_FILE" "$TMP_FILE" echo "Running Cargo Build..." | tee -a "$LOG_FILE" +# Determine the root of the Git project or use current directory PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD") + +# Mark the project directory as safe for Git (important in CI to avoid "unsafe repository" warnings) git config --global --add safe.directory "$PROJECT_ROOT" + +# Navigate to the project root cd "$PROJECT_ROOT" +# List of Cargo manifest paths for different components MANIFESTS=( src/common/Cargo.toml src/agent/Cargo.toml @@ -20,19 +28,23 @@ MANIFESTS=( src/tools/Cargo.toml ) -FAILED_TOTAL=0 +FAILED_TOTAL=0 # Track how many builds failed +# Loop through each manifest and try to build for manifest in "${MANIFESTS[@]}"; do echo "πŸ“¦ Building $manifest..." | tee -a "$LOG_FILE" + + # Build with verbose output; capture to temp file and tee to log if cargo build -vv --manifest-path="$manifest" | tee "$TMP_FILE"; then echo "βœ… Build succeeded for $manifest" | tee -a "$LOG_FILE" else - echo "::error ::Build failed for $manifest!" | tee -a "$LOG_FILE" + echo "::error ::❌ Build failed for $manifest!" | tee -a "$LOG_FILE" FAILED_TOTAL=$((FAILED_TOTAL + 1)) fi done +# Final result: fail the script if any build failed if [[ "$FAILED_TOTAL" -gt 0 ]]; then - echo "::error ::Build failed! $FAILED_TOTAL component(s) failed." | tee -a "$LOG_FILE" + echo "::error ::🚨 Build failed! $FAILED_TOTAL component(s) failed." | tee -a "$LOG_FILE" exit 1 fi diff --git a/scripts/clippy_check.sh b/scripts/clippy_check.sh index fe517a501..72a962168 100755 --- a/scripts/clippy_check.sh +++ b/scripts/clippy_check.sh @@ -1,22 +1,24 @@ #!/bin/bash -set -euo pipefail +set -euo pipefail # Exit on error, undefined variable, or pipe failure +# Initialize paths and log files LOG_FILE="clippy_results.log" TMP_FILE="clippy_output.txt" -REPORT_FILE="clippy_summary.md" +mkdir -p dist/reports +REPORT_FILE="dist/reports/clippy_summary.md" +# Clean up old results rm -f "$LOG_FILE" "$TMP_FILE" "$REPORT_FILE" -echo "Running Cargo clippy..." | tee -a "$LOG_FILE" +echo "πŸ” Running Cargo clippy..." | tee -a "$LOG_FILE" +# Set project root (use GitHub workspace if defined, else fallback to current directory) PROJECT_ROOT=${GITHUB_WORKSPACE:-$(pwd)} cd "$PROJECT_ROOT" -FAILED_TOTAL=0 -PASSED_TOTAL=0 -PIDS=() +FAILED_TOTAL=0 # Count how many manifests failed Clippy -# Declare manifest paths +# Declare paths to Cargo.toml manifests of components COMMON_MANIFEST="src/common/Cargo.toml" AGENT_MANIFEST="src/agent/Cargo.toml" TOOLS_MANIFEST="src/tools/Cargo.toml" @@ -24,73 +26,56 @@ APISERVER_MANIFEST="src/server/apiserver/Cargo.toml" FILTERGATEWAY_MANIFEST="src/player/filtergateway/Cargo.toml" ACTIONCONTROLLER_MANIFEST="src/player/actioncontroller/Cargo.toml" -# Run and parse test output +# Function to run clippy on a component and track results run_clippy() { - local manifest="$1" - local label="$2" - local clippy_passed=false + local manifest="$1" # Path to Cargo.toml + local label="$2" # Human-readable name (e.g., "agent") + + echo "πŸ§ͺ Running Clippy for $label ($manifest)" | tee -a "$LOG_FILE" - echo "Running Clippy for $label ($manifest)" | tee -a "$LOG_FILE" + local clippy_passed=false + # Run Clippy and capture output to temp file if cargo clippy --manifest-path="$manifest" --all-targets --all-features | tee "$TMP_FILE"; then - echo "Clippy for $label passed clean." | tee -a "$LOG_FILE" + echo "βœ… Clippy for $label passed clean." | tee -a "$LOG_FILE" clippy_passed=true else - echo "::error ::Clippy for $label failed! Found warnings/errors. Check logs." | tee -a "$LOG_FILE" - # Capture relevant lines from TMP_FILE if needed for summary, or direct stdout/stderr - # Example: Print only the warnings/errors to log, not the whole verbose output + echo "::error ::❌ Clippy for $label failed! Found warnings/errors." | tee -a "$LOG_FILE" + # Optional: uncomment below to include filtered warnings/errors in the log # grep -E "warning:|error:" "$TMP_FILE" | tee -a "$LOG_FILE" fi - # Instead of PASSED_TOTAL/FAILED_TOTAL for *lints*, we track job success/failure + # Append status to markdown summary report if $clippy_passed; then - echo "βœ… Clippy for $label: PASSED" >> "$REPORT_FILE" + echo "βœ… Clippy for \`$label\`: **PASSED**" >> "$REPORT_FILE" else - echo "❌ Clippy for $label: FAILED" >> "$REPORT_FILE" - # Increment a counter for overall script failure - (( FAILED_TOTAL++ )) # FAILED_TOTAL now represents number of manifests that failed clippy + echo "❌ Clippy for \`$label\`: **FAILED**" >> "$REPORT_FILE" + (( FAILED_TOTAL++ )) # Increment failure count fi } -# Run common clippy checks -if [[ -f "$COMMON_MANIFEST" ]]; then - run_clippy "$COMMON_MANIFEST" "common" -else - echo "::warning ::$COMMON_MANIFEST not found, skipping..." -fi +# === Clippy runs per module === -# # Run apiserver clippy checks -if [[ -f "$APISERVER_MANIFEST" ]]; then - run_clippy "$APISERVER_MANIFEST" "apiserver" -else - echo "::warning ::$APISERVER_MANIFEST not found, skipping..." -fi +[[ -f "$COMMON_MANIFEST" ]] && run_clippy "$COMMON_MANIFEST" "common" \ + || echo "::warning ::$COMMON_MANIFEST not found, skipping..." -# Run tools clippy checks -if [[ -f "$TOOLS_MANIFEST" ]]; then - run_clippy "$TOOLS_MANIFEST" "tools" -else - echo "::warning ::$TOOLS_MANIFEST not found, skipping..." -fi +[[ -f "$APISERVER_MANIFEST" ]] && run_clippy "$APISERVER_MANIFEST" "apiserver" \ + || echo "::warning ::$APISERVER_MANIFEST not found, skipping..." -# Run agent clippy checks -if [[ -f "$AGENT_MANIFEST" ]]; then - run_clippy "$AGENT_MANIFEST" "agent" -else - echo "::warning ::$AGENT_MANIFEST not found, skipping..." -fi +[[ -f "$TOOLS_MANIFEST" ]] && run_clippy "$TOOLS_MANIFEST" "tools" \ + || echo "::warning ::$TOOLS_MANIFEST not found, skipping..." -# Run filtergateway clippy checks -if [[ -f "$FILTERGATEWAY_MANIFEST" ]]; then - run_clippy "$FILTERGATEWAY_MANIFEST" "filtergateway" -else - echo "::warning ::$FILTERGATEWAY_MANIFEST not found, skipping..." -fi +[[ -f "$AGENT_MANIFEST" ]] && run_clippy "$AGENT_MANIFEST" "agent" \ + || echo "::warning ::$AGENT_MANIFEST not found, skipping..." -# Run actioncontroller clippy checks -if [[ -f "$ACTIONCONTROLLER_MANIFEST" ]]; then - run_clippy "$ACTIONCONTROLLER_MANIFEST" "actioncontroller" -else - echo "::warning ::$ACTIONCONTROLLER_MANIFEST not found, skipping..." -fi +[[ -f "$FILTERGATEWAY_MANIFEST" ]] && run_clippy "$FILTERGATEWAY_MANIFEST" "filtergateway" \ + || echo "::warning ::$FILTERGATEWAY_MANIFEST not found, skipping..." +[[ -f "$ACTIONCONTROLLER_MANIFEST" ]] && run_clippy "$ACTIONCONTROLLER_MANIFEST" "actioncontroller" \ + || echo "::warning ::$ACTIONCONTROLLER_MANIFEST not found, skipping..." + +# Optional: exit with failure if any component had Clippy errors +if [[ "$FAILED_TOTAL" -gt 0 ]]; then + echo "::error ::🚨 Clippy failed for $FAILED_TOTAL component(s)." | tee -a "$LOG_FILE" + exit 1 +fi diff --git a/scripts/deny_check.sh b/scripts/deny_check.sh index b8fa645a2..952054648 100755 --- a/scripts/deny_check.sh +++ b/scripts/deny_check.sh @@ -1,45 +1,51 @@ #!/bin/bash -set -euo pipefail +set -euo pipefail # Exit on error, undefined variables, or pipe failure +# Initialize log and report files LOG_FILE="deny_results.log" TMP_FILE="deny_output.txt" -REPORT_FILE="deny_summary.md" +mkdir -p dist/reports/deny +REPORT_FILE="dist/reports/deny/deny_summary.md" +# Remove old logs and report files rm -f "$LOG_FILE" "$TMP_FILE" "$REPORT_FILE" echo "πŸ” Running Cargo Deny checks..." | tee -a "$LOG_FILE" +# Determine project root directory PROJECT_ROOT=${GITHUB_WORKSPACE:-$(pwd)} cd "$PROJECT_ROOT" -FAILED_TOTAL=0 -PASSED_TOTAL=0 -PIDS=() +FAILED_TOTAL=0 # Count of manifests that failed deny check +PASSED_TOTAL=0 # Count of manifests that passed deny check -# Declare manifest paths +# Define paths to Cargo.toml manifests to check COMMON_MANIFEST="src/common/Cargo.toml" AGENT_MANIFEST="src/agent/Cargo.toml" TOOLS_MANIFEST="src/tools/Cargo.toml" APISERVER_MANIFEST="src/server/apiserver/Cargo.toml" FILTERGATEWAY_MANIFEST="src/player/filtergateway/Cargo.toml" -# Function to run cargo-deny check +# Function to run cargo-deny on a given manifest and log results run_deny() { - local manifest="$1" - local label="$2" - local deny_passed=false + local manifest="$1" # Path to Cargo.toml + local label="$2" # Human-readable label for logging echo "🚨 Running deny check for $label ($manifest)" | tee -a "$LOG_FILE" + local deny_passed=false + + # Run cargo deny check; capture all output to temp file if cargo deny --manifest-path="$manifest" check 2>&1 | tee "$TMP_FILE"; then echo "βœ… deny check for $label passed clean." | tee -a "$LOG_FILE" deny_passed=true else + # If cargo deny failed, output error message and extract relevant lines echo "::error ::Deny check for $label failed! Issues found." | tee -a "$LOG_FILE" - # Optional: extract relevant issues grep -E "error:|warning:" "$TMP_FILE" | tee -a "$LOG_FILE" fi + # Append pass/fail status to markdown summary report if $deny_passed; then echo "βœ… deny check for $label: PASSED" >> "$REPORT_FILE" (( PASSED_TOTAL++ )) @@ -49,24 +55,26 @@ run_deny() { fi } -# Run deny check for each manifest -#[[ -f "$COMMON_MANIFEST" ]] && run_deny "$COMMON_MANIFEST" "common" || echo "::warning ::$COMMON_MANIFEST not found, skipping..." -#[[ -f "$AGENT_MANIFEST" ]] && run_deny "$AGENT_MANIFEST" "agent" || echo "::warning ::$AGENT_MANIFEST not found, skipping..." -#[[ -f "$TOOLS_MANIFEST" ]] && run_deny "$TOOLS_MANIFEST" "tools" || echo "::warning ::$TOOLS_MANIFEST not found, skipping..." -[[ -f "$APISERVER_MANIFEST" ]] && run_deny "$APISERVER_MANIFEST" "apiserver" || echo "::warning ::$APISERVER_MANIFEST not found, skipping..." -#[[ -f "$FILTERGATEWAY_MANIFEST" ]]&& run_deny "$FILTERGATEWAY_MANIFEST" "filtergateway" || echo "::warning ::$FILTERGATEWAY_MANIFEST not found, skipping..." +# Run cargo-deny on desired manifests +# Uncomment manifests as needed + +#[[ -f "$COMMON_MANIFEST" ]] && run_deny "$COMMON_MANIFEST" "common" || echo "::warning ::$COMMON_MANIFEST not found, skipping..." +#[[ -f "$AGENT_MANIFEST" ]] && run_deny "$AGENT_MANIFEST" "agent" || echo "::warning ::$AGENT_MANIFEST not found, skipping..." +#[[ -f "$TOOLS_MANIFEST" ]] && run_deny "$TOOLS_MANIFEST" "tools" || echo "::warning ::$TOOLS_MANIFEST not found, skipping..." +[[ -f "$APISERVER_MANIFEST" ]] && run_deny "$APISERVER_MANIFEST" "apiserver" || echo "::warning ::$APISERVER_MANIFEST not found, skipping..." +#[[ -f "$FILTERGATEWAY_MANIFEST" ]] && run_deny "$FILTERGATEWAY_MANIFEST" "filtergateway" || echo "::warning ::$FILTERGATEWAY_MANIFEST not found, skipping..." -# Final summary +# Print final summary report to console and log echo -e "\nπŸ“„ Summary:" | tee -a "$LOG_FILE" cat "$REPORT_FILE" | tee -a "$LOG_FILE" echo -e "\nπŸ”’ Total Passed: $PASSED_TOTAL" | tee -a "$LOG_FILE" echo "πŸ”’ Total Failed: $FAILED_TOTAL" | tee -a "$LOG_FILE" -# Fail script if any deny check failed +# Fail the script if any cargo-deny check failed if [[ "$FAILED_TOTAL" -gt 0 ]]; then echo "::error ::One or more cargo-deny checks failed." exit 1 fi -echo "βœ… All cargo-deny checks passed!" \ No newline at end of file +echo "βœ… All cargo-deny checks passed!" diff --git a/scripts/fmt_check.sh b/scripts/fmt_check.sh index 46847d198..8066ed52d 100755 --- a/scripts/fmt_check.sh +++ b/scripts/fmt_check.sh @@ -1,22 +1,27 @@ #!/bin/bash -set -euo pipefail +set -euo pipefail # Exit immediately on error, unset variable, or pipe failure LOG_FILE="fmt_results.log" TMP_FILE="fmt_output.txt" -REPORT_FILE="fmt_summary.md" +# Create directory to store formatting reports +mkdir -p dist/reports/fmt +REPORT_FILE="dist/reports/fmt/fmt_summary.md" + +# Clean up old logs and reports before starting rm -f "$LOG_FILE" "$TMP_FILE" "$REPORT_FILE" echo "Running Cargo fmt..." | tee -a "$LOG_FILE" +# Determine project root: use GitHub workspace if set, else current dir PROJECT_ROOT=${GITHUB_WORKSPACE:-$(pwd)} cd "$PROJECT_ROOT" -FAILED_TOTAL=0 -PASSED_TOTAL=0 -PIDS=() +FAILED_TOTAL=0 # Counter for failed formatting checks +PASSED_TOTAL=0 # Counter for passed formatting checks +PIDS=() # (Unused here but declared in case of future parallel runs) -# Declare manifest paths +# Declare paths to Cargo.toml manifests for different crates/components COMMON_MANIFEST="src/common/Cargo.toml" AGENT_MANIFEST="src/agent/Cargo.toml" TOOLS_MANIFEST="src/tools/Cargo.toml" @@ -24,7 +29,7 @@ APISERVER_MANIFEST="src/server/apiserver/Cargo.toml" FILTERGATEWAY_MANIFEST="src/player/filtergateway/Cargo.toml" ACTIONCONTROLLER_MANIFEST="src/player/actioncontroller/Cargo.toml" -# Run and parse test output +# Function to run 'cargo fmt --check' on a given manifest and record results run_fmt() { local manifest="$1" local label="$2" @@ -32,64 +37,58 @@ run_fmt() { echo "Running fmt for $label ($manifest)" | tee -a "$LOG_FILE" + # Run cargo fmt in check mode; output to TMP_FILE if cargo fmt --manifest-path="$manifest" --all --check | tee "$TMP_FILE"; then echo "fmt for $label passed clean." | tee -a "$LOG_FILE" fmt_passed=true else - echo "::error ::fmt for $label failed! Found warnings/errors. Check logs." | tee -a "$LOG_FILE" - # Capture relevant lines from TMP_FILE if needed for summary, or direct stdout/stderr - # Example: Print only the warnings/errors to log, not the whole verbose output - # grep -E "warning:|error:" "$TMP_FILE" | tee -a "$LOG_FILE" + echo "::error ::fmt for $label failed! Found formatting issues. Check logs." | tee -a "$LOG_FILE" + # Optionally, you could extract and log only relevant warnings/errors from TMP_FILE + # e.g., grep -E "warning:|error:" "$TMP_FILE" | tee -a "$LOG_FILE" fi - # Instead of PASSED_TOTAL/FAILED_TOTAL for *lints*, we track job success/failure + # Append pass/fail status to markdown summary report if $fmt_passed; then echo "βœ… fmt for $label: PASSED" >> "$REPORT_FILE" else echo "❌ fmt for $label: FAILED" >> "$REPORT_FILE" - # Increment a counter for overall script failure - (( FAILED_TOTAL++ )) # FAILED_TOTAL now represents number of manifests that failed fmt + (( FAILED_TOTAL++ )) # Increment failure count fi } -# Run common fmt checks +# Run formatting checks for each crate manifest if the file exists if [[ -f "$COMMON_MANIFEST" ]]; then run_fmt "$COMMON_MANIFEST" "common" else echo "::warning ::$COMMON_MANIFEST not found, skipping..." fi -# Run apiserver fmt checks if [[ -f "$APISERVER_MANIFEST" ]]; then run_fmt "$APISERVER_MANIFEST" "apiserver" else echo "::warning ::$APISERVER_MANIFEST not found, skipping..." fi -# Run tools fmt checks if [[ -f "$TOOLS_MANIFEST" ]]; then run_fmt "$TOOLS_MANIFEST" "tools" else echo "::warning ::$TOOLS_MANIFEST not found, skipping..." fi -# Run agent fmt checks if [[ -f "$AGENT_MANIFEST" ]]; then run_fmt "$AGENT_MANIFEST" "agent" else echo "::warning ::$AGENT_MANIFEST not found, skipping..." fi -# Run filtergateway fmt checks if [[ -f "$FILTERGATEWAY_MANIFEST" ]]; then run_fmt "$FILTERGATEWAY_MANIFEST" "filtergateway" else echo "::warning ::$FILTERGATEWAY_MANIFEST not found, skipping..." fi -# Run actioncontroller fmt checks if [[ -f "$ACTIONCONTROLLER_MANIFEST" ]]; then run_fmt "$ACTIONCONTROLLER_MANIFEST" "actioncontroller" else echo "::warning ::$ACTIONCONTROLLER_MANIFEST not found, skipping..." -fi \ No newline at end of file +fi diff --git a/scripts/installdeps.sh b/scripts/installdeps.sh index c383ead9e..5e1b816b8 100755 --- a/scripts/installdeps.sh +++ b/scripts/installdeps.sh @@ -1,13 +1,16 @@ #!/bin/bash set -euo pipefail +# Enable JSON test output even on stable Rust +export RUSTC_BOOTSTRAP=1 + echo "πŸ› οΈ Updating package lists..." -apt-get update -y +sudo apt-get update -y echo "πŸ“¦ Installing common development packages..." common_packages=( libdbus-1-dev - git-all + git make gcc protobuf-compiler @@ -16,15 +19,14 @@ common_packages=( curl libssl-dev nodejs - npm + jq ) -DEBIAN_FRONTEND=noninteractive apt-get install -y "${common_packages[@]}" -echo "βœ… Base packages installed successfully." +DEBIAN_FRONTEND=noninteractive sudo apt-get install -y "${common_packages[@]}" +echo "βœ… Base packages installed successfully" # ---------------------------------------- # πŸ¦€ Install rustup, Clippy, Rustfmt, and cargo-deny # ---------------------------------------- - echo "πŸ¦€ Installing Rust toolchain..." if ! command -v rustup &>/dev/null; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y @@ -45,6 +47,12 @@ if ! command -v cargo-deny &>/dev/null; then cargo install cargo-deny fi +# Install cargo2junit +if ! command -v cargo2junit &>/dev/null; then + echo "πŸ” Installing cargo2junit..." + cargo install cargo2junit +fi + # Show installed versions echo "πŸ“Œ Installed Rust toolchain versions:" cargo --version @@ -64,9 +72,9 @@ ETCD_URL="https://github.com/etcd-io/etcd/releases/download/${ETCD_VER}/${ETCD_P curl -L "$ETCD_URL" -o etcd.tar.gz tar xzvf etcd.tar.gz -cp "${ETCD_PKG}/etcd" /usr/local/bin/ -cp "${ETCD_PKG}/etcdctl" /usr/local/bin/ -chmod +x /usr/local/bin/etcd /usr/local/bin/etcdctl +sudo cp "${ETCD_PKG}/etcd" /usr/local/bin/ +sudo cp "${ETCD_PKG}/etcdctl" /usr/local/bin/ +sudo chmod +x /usr/local/bin/etcd /usr/local/bin/etcdctl rm -rf etcd.tar.gz "${ETCD_PKG}" echo "βœ… etcd and etcdctl installed." @@ -109,4 +117,38 @@ if ! etcdctl --endpoints=http://localhost:2379 endpoint health &>/dev/null; then exit 1 fi -echo "πŸŽ‰ All dependencies installed and etcd is running!" \ No newline at end of file +# ---------------------------------------- +# 🐳 Install Docker and Docker Compose +# ---------------------------------------- + +echo "🐳 Installing Docker CLI and Docker Compose..." + +# Install Docker dependencies +sudo apt-get update -y +sudo apt-get install -y \ + ca-certificates \ + curl \ + gnupg \ + lsb-release + +# Add Docker’s official GPG key +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + +# Set up Docker stable repository for Ubuntu Jammy +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ + https://download.docker.com/linux/ubuntu jammy stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# Update and install Docker packages +sudo apt-get update -y +sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + +# Verify installation +docker --version +docker compose version + +echo "βœ… Docker and Docker Compose installed." + +echo "πŸŽ‰ All dependencies installed and etcd is running!" diff --git a/scripts/license_check.sh b/scripts/license_check.sh new file mode 100755 index 000000000..522cbd750 --- /dev/null +++ b/scripts/license_check.sh @@ -0,0 +1,60 @@ +#!/bin/bash +set -euo pipefail + +PROJECT_ROOT="$(pwd)" +mkdir -p "$PROJECT_ROOT/dist/licenses" +LOG_FILE="$PROJECT_ROOT/dist/licenses/license_log.txt" +rm -f "$LOG_FILE" +touch "$LOG_FILE" + +echo "πŸ” Starting license checks..." | tee -a "$LOG_FILE" + +MANIFESTS=( + "src/server/Cargo.toml" + "src/common/Cargo.toml" + "src/agent/Cargo.toml" + "src/tools/Cargo.toml" + "src/player/Cargo.toml" +) + +# Ensure cargo-about is installed +if ! command -v cargo-about &>/dev/null; then + echo "❗ cargo-about not found, installing..." | tee -a "$LOG_FILE" + cargo install cargo-about +fi + +for manifest in "${MANIFESTS[@]}"; do + if [[ -f "$manifest" ]]; then + crate_dir="$(dirname "$manifest")" + label="$(basename "$crate_dir")" + + CONFIG="$PROJECT_ROOT/$crate_dir/about.toml" + TEMPLATE="$PROJECT_ROOT/$crate_dir/about.hbs" + + if [[ ! -f "$CONFIG" ]]; then + echo "::error ::Missing $CONFIG for $label. Skipping..." | tee -a "$LOG_FILE" + continue + fi + if [[ ! -f "$TEMPLATE" ]]; then + echo "::error ::Missing $TEMPLATE for $label. Skipping..." | tee -a "$LOG_FILE" + continue + fi + + echo "πŸ“„ Generating license report for $label ($manifest)" | tee -a "$LOG_FILE" + echo "Using template: $TEMPLATE" | tee -a "$LOG_FILE" + echo "Using config: $CONFIG" | tee -a "$LOG_FILE" + + output_path="$PROJECT_ROOT/dist/licenses/${label}_licenses.html" + mkdir -p "$(dirname "$output_path")" + + ( + cd "$crate_dir" + echo "πŸ”§ Working in $(pwd), generating $output_path" | tee -a "$LOG_FILE" + cargo about generate --config "$CONFIG" "$TEMPLATE" > "$output_path" + ) + else + echo "::warning ::Manifest $manifest not found, skipping..." | tee -a "$LOG_FILE" + fi +done + +echo "βœ… License reports generated in dist/licenses" | tee -a "$LOG_FILE" diff --git a/scripts/testNparse.sh b/scripts/testNparse.sh index d9bb599dd..ace8afa14 100755 --- a/scripts/testNparse.sh +++ b/scripts/testNparse.sh @@ -1,22 +1,27 @@ #!/bin/bash set -euo pipefail +# === Initialize paths and variables === LOG_FILE="test_results.log" TMP_FILE="test_output.txt" -REPORT_FILE="test_summary.md" +mkdir -p dist/tests target +REPORT_FILE="dist/tests/test_summary.xml" +# Clean up any previous log or report files rm -f "$LOG_FILE" "$TMP_FILE" "$REPORT_FILE" -echo "Running Cargo Tests..." | tee -a "$LOG_FILE" +echo "πŸš€ Running Cargo Tests..." | tee -a "$LOG_FILE" +# Detect project root (for CI or local) PROJECT_ROOT=${GITHUB_WORKSPACE:-$(pwd)} cd "$PROJECT_ROOT" +# Track total test stats FAILED_TOTAL=0 PASSED_TOTAL=0 -PIDS=() +PIDS=() # List of background service PIDs to kill later -# Declare manifest pathss +# === Path to Cargo.toml for each Rust subproject === COMMON_MANIFEST="src/common/Cargo.toml" AGENT_MANIFEST="src/agent/Cargo.toml" TOOLS_MANIFEST="src/tools/Cargo.toml" @@ -24,113 +29,124 @@ APISERVER_MANIFEST="src/server/apiserver/Cargo.toml" FILTERGATEWAY_MANIFEST="src/player/filtergateway/Cargo.toml" ACTIONCONTROLLER_MANIFEST="src/player/actioncontroller/Cargo.toml" -# Start background service and save its PID +# === Function: Start background service === start_service() { local manifest="$1" local name="$2" - - echo "Starting $name component for testing..." | tee -a "$LOG_FILE" - cargo run --manifest-path="$manifest" &>> "$LOG_FILE" & - PIDS+=($!) + echo "πŸ”„ Starting $name..." | tee -a "$LOG_FILE" + cargo run --manifest-path="$manifest" &>> "$LOG_FILE" & # Run in background + PIDS+=($!) # Track PID } -# Ensure background processes are cleaned up +# === Function: Stop all background services === cleanup() { - echo -e "\n Cleaning up background services..." | tee -a "$LOG_FILE" - kill "${PIDS[@]}" 2>/dev/null || true + echo -e "\n🧹 Stopping services..." | tee -a "$LOG_FILE" + for pid in "${PIDS[@]}"; do + if kill -0 "$pid" &>/dev/null; then + kill "$pid" 2>/dev/null || echo "⚠️ Could not kill $pid" + fi + done + PIDS=() # Reset PID list } -trap cleanup EXIT +trap cleanup EXIT # Ensure cleanup is called on exit -# Run and parse test output +# === Function: Run tests for a given manifest === run_tests() { local manifest="$1" local label="$2" + local output_json="target/${label}_test_output.json" + local report_xml="dist/tests/${label}_results.xml" - echo "Running tests for $label ($manifest)" | tee -a "$LOG_FILE" + echo "πŸ§ͺ Testing $label ($manifest)" | tee -a "$LOG_FILE" - if cargo test -vv --manifest-path="$manifest" -- --test-threads=1 | tee "$TMP_FILE"; then - echo "Tests passed for $label" + # Run tests and capture structured JSON output + if RUSTC_BOOTSTRAP=1 cargo test --manifest-path="$manifest" -- -Z unstable-options --format json > "$output_json" 2>>"$LOG_FILE"; then + echo "βœ… Tests passed for $label" | tee -a "$LOG_FILE" else - echo "::error ::Tests failed for $label! Check logs." | tee -a "$LOG_FILE" + echo "::error ::❌ Tests failed for $label!" | tee -a "$LOG_FILE" fi - local passed - local failed - - passed=$(grep -oP '\d+ passed' "$TMP_FILE" | awk '{sum += $1} END {print sum}') - failed=$(grep -oP '\d+ failed' "$TMP_FILE" | awk '{sum += $1} END {print sum}') - - PASSED_TOTAL=$((PASSED_TOTAL + passed)) - FAILED_TOTAL=$((FAILED_TOTAL + failed)) + # === Parse test output === + if [[ -f "$output_json" ]]; then + if command -v jq &>/dev/null; then + # Count number of passed and failed tests using jq + passed=$(jq -r 'select(.type == "test" and .event == "ok") | .name' "$output_json" | wc -l) + failed=$(jq -r 'select(.type == "test" and .event == "failed") | .name' "$output_json" | wc -l) + else + echo "::warning ::jq not found, cannot parse JSON test output." + passed=0 + failed=0 + fi + + PASSED_TOTAL=$((PASSED_TOTAL + passed)) + FAILED_TOTAL=$((FAILED_TOTAL + failed)) + + echo "ℹ️ Passed: $passed, Failed: $failed" | tee -a "$LOG_FILE" + + # Convert JSON to JUnit-style XML if cargo2junit is installed + if command -v cargo2junit &>/dev/null; then + cargo2junit < "$output_json" > "$report_xml" + else + echo "::warning ::cargo2junit not found, skipping XML for $label" + fi + else + echo "::warning ::No output file $output_json created for $label" | tee -a "$LOG_FILE" + fi } -# Run common tests -if [[ -f "$COMMON_MANIFEST" ]]; then - run_tests "$COMMON_MANIFEST" "common" -else - echo "::warning ::$COMMON_MANIFEST not found, skipping..." -fi +# === Start IDL2DDS Docker Service if not already running === +if ! docker ps | grep -qi "idl2dds"; then + echo "πŸ“¦ Launching IDL2DDS docker services..." | tee -a "$LOG_FILE" + [[ ! -d IDL2DDS ]] && git clone https://github.com/MCO-PICCOLO/IDL2DDS -b master -# Start services required for apiserver -start_service "$FILTERGATEWAY_MANIFEST" "filtergateway" -start_service "$AGENT_MANIFEST" "nodeagent" - -# Wait for services to be ready (simple delay) -sleep 3 - -# Run apiserver tests -if [[ -f "$APISERVER_MANIFEST" ]]; then - run_tests "$APISERVER_MANIFEST" "apiserver" + pushd IDL2DDS + docker compose up --build -d + popd else - echo "::warning ::$APISERVER_MANIFEST not found, skipping..." + echo "🟒 IDL2DDS already running." | tee -a "$LOG_FILE" fi -# Stop only those services needed for apiserver -cleanup +# === Run tests for each Rust component === -# Re-setup trap for any new background processes started later -PIDS=() -trap cleanup EXIT +# Step 1: Run tests for `common` +[[ -f "$COMMON_MANIFEST" ]] && run_tests "$COMMON_MANIFEST" "common" || echo "::warning ::$COMMON_MANIFEST missing." -# Run tools tests -if [[ -f "$TOOLS_MANIFEST" ]]; then - run_tests "$TOOLS_MANIFEST" "tools" -else - echo "::warning ::$TOOLS_MANIFEST not found, skipping..." -fi +# Step 2: Start `filtergateway` and `nodeagent` before testing `apiserver` +start_service "$FILTERGATEWAY_MANIFEST" "filtergateway" +start_service "$AGENT_MANIFEST" "nodeagent" +sleep 3 # Give services time to initialize +[[ -f "$APISERVER_MANIFEST" ]] && run_tests "$APISERVER_MANIFEST" "apiserver" || echo "::warning ::$APISERVER_MANIFEST missing." +cleanup # Stop background services -# Run agent tests -if [[ -f "$AGENT_MANIFEST" ]]; then - run_tests "$AGENT_MANIFEST" "agent" -else - echo "::warning ::$AGENT_MANIFEST not found, skipping..." -fi +# Step 3: Test `tools` (and optionally `agent`) +[[ -f "$TOOLS_MANIFEST" ]] && run_tests "$TOOLS_MANIFEST" "tools" || echo "::warning ::$TOOLS_MANIFEST missing." +# [[ -f "$AGENT_MANIFEST" ]] && run_tests "$AGENT_MANIFEST" "agent" || echo "::warning ::$AGENT_MANIFEST missing." -# Run filtergateway tests(development is under progress) -# if [[ -f "$FILTERGATEWAY_MANIFEST" ]]; then -# run_tests "$FILTERGATEWAY_MANIFEST" "filtergateway" -# else -# echo "::warning ::$FILTERGATEWAY_MANIFEST not found, skipping..." -# fi - -# Run actioncontroller tests(development is under progress) -# if [[ -f "$ACTIONCONTROLLER_MANIFEST" ]]; then -# run_tests "$ACTIONCONTROLLER_MANIFEST" "actioncontroller" -# else -# echo "::warning ::$ACTIONCONTROLLER_MANIFEST not found, skipping..." -# fi - -# Generate test summary report -echo "# Test Results" > "$REPORT_FILE" -echo "**Passed:** $PASSED_TOTAL" >> "$REPORT_FILE" -echo "**Failed:** $FAILED_TOTAL" >> "$REPORT_FILE" - -echo "Tests Passed: $PASSED_TOTAL" | tee -a "$LOG_FILE" -echo "Tests Failed: $FAILED_TOTAL" | tee -a "$LOG_FILE" - -if [[ "$FAILED_TOTAL" -gt 0 ]]; then +# Step 4: Start `actioncontroller` before testing `filtergateway` +start_service "$ACTIONCONTROLLER_MANIFEST" "actioncontroller" +sleep 3 +[[ -f "$FILTERGATEWAY_MANIFEST" ]] && run_tests "$FILTERGATEWAY_MANIFEST" "filtergateway" || echo "::warning ::$FILTERGATEWAY_MANIFEST missing." +cleanup # Stop actioncontroller + +# Optional: Uncomment to test `actioncontroller` directly +# [[ -f "$ACTIONCONTROLLER_MANIFEST" ]] && run_tests "$ACTIONCONTROLLER_MANIFEST" "actioncontroller" + +# === Combine all JUnit test reports into one XML file === +echo "" > "$REPORT_FILE" +echo "" >> "$REPORT_FILE" +for xml in dist/tests/*_results.xml; do + [[ -f "$xml" ]] && cat "$xml" >> "$REPORT_FILE" +done +echo "" >> "$REPORT_FILE" + +# === Final test summary === +echo "βœ… Tests Passed: $PASSED_TOTAL" | tee -a "$LOG_FILE" +echo "❌ Tests Failed: $FAILED_TOTAL" | tee -a "$LOG_FILE" + +# If any test failed, exit with error so CI fails +[[ "$FAILED_TOTAL" -gt 0 ]] && { echo "::error ::Some tests failed!" | tee -a "$LOG_FILE" exit 1 -fi +} -echo "All tests passed successfully!" | tee -a "$LOG_FILE" +echo "πŸŽ‰ All tests passed!" | tee -a "$LOG_FILE" diff --git a/src/agent/about.hbs b/src/agent/about.hbs new file mode 100644 index 000000000..699b3b04e --- /dev/null +++ b/src/agent/about.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in cargo-about.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + diff --git a/src/agent/about.toml b/src/agent/about.toml new file mode 100644 index 000000000..8b11cc3d8 --- /dev/null +++ b/src/agent/about.toml @@ -0,0 +1,10 @@ +accepted = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "0BSD", + "Unicode-3.0", + "BSD-3-Clause", + "ISC", + "Zlib", +] diff --git a/src/common/about.hbs b/src/common/about.hbs new file mode 100644 index 000000000..699b3b04e --- /dev/null +++ b/src/common/about.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in cargo-about.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + diff --git a/src/common/about.toml b/src/common/about.toml new file mode 100644 index 000000000..8b11cc3d8 --- /dev/null +++ b/src/common/about.toml @@ -0,0 +1,10 @@ +accepted = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "0BSD", + "Unicode-3.0", + "BSD-3-Clause", + "ISC", + "Zlib", +] diff --git a/src/player/about.hbs b/src/player/about.hbs new file mode 100644 index 000000000..699b3b04e --- /dev/null +++ b/src/player/about.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in cargo-about.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + diff --git a/src/player/about.toml b/src/player/about.toml new file mode 100644 index 000000000..716dfd73c --- /dev/null +++ b/src/player/about.toml @@ -0,0 +1,11 @@ +accepted = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "0BSD", + "Unicode-3.0", + "BSD-3-Clause", + "ISC", + "Zlib", + "BSD-2-Clause" +] diff --git a/src/server/about.hbs b/src/server/about.hbs new file mode 100644 index 000000000..699b3b04e --- /dev/null +++ b/src/server/about.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in cargo-about.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + diff --git a/src/server/about.toml b/src/server/about.toml new file mode 100644 index 000000000..8b11cc3d8 --- /dev/null +++ b/src/server/about.toml @@ -0,0 +1,10 @@ +accepted = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "0BSD", + "Unicode-3.0", + "BSD-3-Clause", + "ISC", + "Zlib", +] diff --git a/src/tools/about.hbs b/src/tools/about.hbs new file mode 100644 index 000000000..699b3b04e --- /dev/null +++ b/src/tools/about.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in cargo-about.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + + diff --git a/src/tools/about.toml b/src/tools/about.toml new file mode 100644 index 000000000..8b11cc3d8 --- /dev/null +++ b/src/tools/about.toml @@ -0,0 +1,10 @@ +accepted = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "0BSD", + "Unicode-3.0", + "BSD-3-Clause", + "ISC", + "Zlib", +] From 02aa731ea0b6141b2005df8235cd9c4829d2ad16 Mon Sep 17 00:00:00 2001 From: "akshay14.garg" Date: Tue, 15 Jul 2025 18:26:30 +0530 Subject: [PATCH 2/3] feat(auth):FIX agent formatting in CD PipeLine WorkFlow for Pullpiri[#116] --- .github/workflows/release.yml | 2 +- src/agent/nodeagent/src/grpc/sender.rs | 11 ++++++----- src/agent/nodeagent/src/manager.rs | 13 ++++++++----- src/agent/nodeagent/src/resource/container.rs | 4 +++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 608cabdf7..aa9385e6e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,7 +113,7 @@ jobs: id: upload_license_report with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/licenses/apiserver_licenses.html + file: dist/licenses/*.html file_glob: true tag: ${{ github.ref }} diff --git a/src/agent/nodeagent/src/grpc/sender.rs b/src/agent/nodeagent/src/grpc/sender.rs index fff18555c..1c0c49b6c 100644 --- a/src/agent/nodeagent/src/grpc/sender.rs +++ b/src/agent/nodeagent/src/grpc/sender.rs @@ -3,12 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +use common::monitoringserver::{ContainerList, SendContainerListResponse}; use common::statemanager::{ connect_server, state_manager_connection_client::StateManagerConnectionClient, Action, Response, }; -use common::monitoringserver::{ - ContainerList, SendContainerListResponse, -}; use tonic::{Request, Status}; /// Sender for making gRPC requests to Monitoring Server @@ -30,10 +28,13 @@ impl NodeAgentSender { /// Send a ContainerList to the monitoring server via gRPC pub async fn send_container_list( &mut self, - container_list: ContainerList + container_list: ContainerList, ) -> Result, Status> { // TODO : temporary debug print, remove or replace with proper logging - println!("Sending container list to monitoring server: {:?}", container_list); + println!( + "Sending container list to monitoring server: {:?}", + container_list + ); // TODO : uncomment this code when ready // let mut client = MonitoringServerConnectionClient::connect(common::monitoringserver::connect_server()) // .await diff --git a/src/agent/nodeagent/src/manager.rs b/src/agent/nodeagent/src/manager.rs index bfcf3dad5..f323b6f87 100644 --- a/src/agent/nodeagent/src/manager.rs +++ b/src/agent/nodeagent/src/manager.rs @@ -4,11 +4,11 @@ //! a gRPC sender for communicating with the monitoring server or other services. //! It is designed to be thread-safe and run in an async context. use crate::grpc::sender::NodeAgentSender; +use common::monitoringserver::ContainerList; use common::nodeagent::HandleYamlRequest; use common::Result; use std::sync::Arc; use tokio::sync::{mpsc, Mutex}; -use common::monitoringserver::ContainerList; /// Main manager struct for NodeAgent. /// @@ -75,10 +75,13 @@ impl NodeAgentManager { // Send the container info to the monitoring server let mut sender = self.sender.lock().await; - if let Err(e) = sender.send_container_list(ContainerList { - node_name: node.clone(), - containers: container_list, - }).await { + if let Err(e) = sender + .send_container_list(ContainerList { + node_name: node.clone(), + containers: container_list, + }) + .await + { eprintln!("[NodeAgent] Error sending container info: {}", e); } sleep(Duration::from_secs(1)).await; diff --git a/src/agent/nodeagent/src/resource/container.rs b/src/agent/nodeagent/src/resource/container.rs index afb851751..5d590d953 100644 --- a/src/agent/nodeagent/src/resource/container.rs +++ b/src/agent/nodeagent/src/resource/container.rs @@ -102,7 +102,9 @@ pub async fn get_list() -> Result> { Ok(containers) } -pub async fn get_inspect(id: &str) -> std::result::Result> { +pub async fn get_inspect( + id: &str, +) -> std::result::Result> { let path = &format!("/v1.0.0/libpod/containers/{}/json", id); let body = super::get(path).await?; From 889187397ce5fc3687b982ef1c82bb6b16ef9be1 Mon Sep 17 00:00:00 2001 From: "akshay14.garg" Date: Tue, 15 Jul 2025 19:26:11 +0530 Subject: [PATCH 3/3] feat(auth):Release.yml for auto doc gen for CD PipeLine WorkFlow for Pullpiri[#116] --- .github/release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..30e07baa8 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,24 @@ +changelog: + exclude: + labels: + - duplicate + - wontfix + - invalid + authors: + - octocat + categories: + - title: "πŸ› οΈ Breaking Changes" + labels: + - "breaking change" + - title: "✨ Features" + labels: + - enhancement + - title: "πŸ› Bug Fixes" + labels: + - bug + - title: "πŸ“š Documentation" + labels: + - documentation + - title: "Other Changes" + labels: + - "*"