From f88a7b880c9478d68613e2611fac7060ff1fec85 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta <73165318+soumeh01@users.noreply.github.com> Date: Wed, 12 Nov 2025 12:12:04 +0100 Subject: [PATCH 1/2] Test job Monitoring --- .github/workflows/basic.yml | 109 +++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 3d9c5d3..c1c7543 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -15,7 +15,8 @@ permissions: jobs: CI_test_run: runs-on: ubuntu-22.04 - + outputs: + build_status: ${{ steps.build_step.outcome }} steps: - name: Checkout uses: actions/checkout@v4 @@ -23,7 +24,7 @@ jobs: - name: Setup Python 3.10 uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.10' - name: Install system packages run: | @@ -32,6 +33,21 @@ jobs: - name: Activate vcpkg uses: ARM-software/cmsis-actions/vcpkg@v1 + continue-on-error: false + + - name: Capture vcpkg activation output + if: always() + run: | + mkdir -p logs + echo "=== vcpkg Artifacts Activation ===" > logs/vcpkg_artifacts.log + cd $(dirname ".ci/vcpkg-configuration.json") + vcpkg activate 2>&1 | tee -a $GITHUB_WORKSPACE/logs/vcpkg_artifacts.log || echo "vcpkg activate failed" >> $GITHUB_WORKSPACE/logs/vcpkg_artifacts.log + - name: Upload tool logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: tool-logs + path: logs/ - name: Activate Arm tool license uses: ARM-software/cmsis-actions/armlm@v1 @@ -42,9 +58,98 @@ jobs: cbuild get_started.csolution.yml --packs --update-rte --context .debug+avh - name: Execute + id: build_step run: | echo "Running get started example ..." FVP_MPS2_Cortex-M3 --simlimit 10 -f Project/fvp_config.txt -a out/Project/avh/debug/Project.axf | tee Project.avh.log echo "Checking output..." test "$(grep "FAIL: " Project.avh.log | wc -l)" -eq 0 + CollectData: + runs-on: ubuntu-latest + needs: CI_test_run + if: always() + steps: + - name: Download tool logs + uses: actions/download-artifact@v4 + with: + name: tool-logs + path: logs/ + + - name: Parse and collect data + run: | + # Parse vcpkg artifacts log + if [ -f logs/vcpkg_artifacts.log ]; then + echo "Parsing vcpkg artifacts log..." + cat logs/vcpkg_artifacts.log + else + echo "No vcpkg artifacts log found" + fi + - name: Generate JSON report + run: | + cat << 'EOF' > collect_data.py + import json + import re + from datetime import datetime + def parse_vcpkg_artifacts_log(log_path): + cmsis_toolbox_info = None + try: + with open(log_path, 'r') as f: + content = f.read() + # Parse the vcpkg artifacts table for cmsis-toolbox + # Looking for line like: "arm:tools/open-cmsis-pack/cmsis-toolbox 2.12.0 will install" + match = re.search(r'arm:tools/open-cmsis-pack/cmsis-toolbox\s+(\S+)\s+', content) + if match: + version = match.group(1) + cmsis_toolbox_info = { + "version": version, + "tool": "cmsis-toolbox" + } + except FileNotFoundError: + print("vcpkg artifacts log file not found") + except Exception as e: + print(f"Error parsing vcpkg artifacts log: {e}") + return cmsis_toolbox_info + # Collect data + data = { + "workflow": "CubeMX: Test Build", + "repo": "${{ github.repository }}", + "run_id": "${{ github.run_id }}", + "build_job": { + "last_run": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"), + "status": "${{ needs.Build.outputs.build_status }}", + "passed": "${{ needs.Build.outputs.build_status }}" == "success" + }, + "cmsis_toolbox": parse_vcpkg_artifacts_log("logs/vcpkg_artifacts.log") + } + # Print JSON + print(json.dumps(data, indent=2)) + # Save to file + with open('workflow_data.json', 'w') as f: + json.dump(data, f, indent=2) + EOF + python3 collect_data.py + - name: Display collected data + id: collected_data + run: | + echo "json=$(jq -c '.' workflow_data.json)" >> "$GITHUB_OUTPUT" + echo "=== Workflow Data Collection ===" + cat workflow_data.json + - name: Upload workflow data + uses: actions/upload-artifact@v4 + with: + name: workflow-data + path: workflow_data.json + + - name: Emit to central repo + uses: peter-evans/repository-dispatch@v4 + with: + token: ${{ secrets.METRICS_PAT }} # PAT or GitHub App token + repository: soumeh01/test_ts_app # <-- your central repo + event-type: ci_metrics + client-payload: | + { + "source": "${{ github.repository }}", + "workflow": "Compile and Run", + "metrics": ${{ steps.collected_data.outputs.json }} + } From 16ddc3f7d1440586827df08ea6dbbddd38df3ceb Mon Sep 17 00:00:00 2001 From: Sourabh Mehta <73165318+soumeh01@users.noreply.github.com> Date: Wed, 12 Nov 2025 12:21:34 +0100 Subject: [PATCH 2/2] Update basic.yml --- .github/workflows/basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index c1c7543..eed54ec 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -40,7 +40,7 @@ jobs: run: | mkdir -p logs echo "=== vcpkg Artifacts Activation ===" > logs/vcpkg_artifacts.log - cd $(dirname ".ci/vcpkg-configuration.json") + cd $(dirname "vcpkg-configuration.json") vcpkg activate 2>&1 | tee -a $GITHUB_WORKSPACE/logs/vcpkg_artifacts.log || echo "vcpkg activate failed" >> $GITHUB_WORKSPACE/logs/vcpkg_artifacts.log - name: Upload tool logs if: always()