diff --git a/.github/actions/loading/action.yml b/.github/actions/loading/action.yml index 2b90396dd..cd5c7e083 100644 --- a/.github/actions/loading/action.yml +++ b/.github/actions/loading/action.yml @@ -6,9 +6,8 @@ outputs: build_matrix: description: Build matrix value: ${{ steps.set-matrix.outputs.build_matrix }} - full_matrix: - description: full matrix containing lava devails + description: Full matrix containing lava details value: ${{ steps.set-matrix.outputs.full_matrix }} runs: @@ -21,24 +20,49 @@ runs: script: | const fs = require('fs'); const path = require('path'); - const targetsPath = path.join(process.env.GITHUB_WORKSPACE, 'video-driver', 'ci', 'MACHINES.json'); + + // 1. Define possible paths for MACHINES.json + // Path A: Workspace/video-driver/ci/MACHINES.json (Nested) + const pathNested = path.join(process.env.GITHUB_WORKSPACE, 'video-driver', 'ci', 'MACHINES.json'); + // Path B: Workspace/ci/MACHINES.json (Root) + const pathRoot = path.join(process.env.GITHUB_WORKSPACE, 'ci', 'MACHINES.json'); + + let targetsPath = ''; + + // 2. Check which path exists + if (fs.existsSync(pathNested)) { + console.log(`Found config at nested path: ${pathNested}`); + targetsPath = pathNested; + } else if (fs.existsSync(pathRoot)) { + console.log(`Found config at root path: ${pathRoot}`); + targetsPath = pathRoot; + } else { + // 3. Debugging: If neither exists, list files to help us see what is happening + console.log('!!! Error: MACHINES.json not found in expected locations.'); + console.log(`Checked: ${pathNested}`); + console.log(`Checked: ${pathRoot}`); + + console.log('--- Workspace Root Contents ---'); + try { + console.log(fs.readdirSync(process.env.GITHUB_WORKSPACE)); + } catch (e) { console.log(e.message); } + + core.setFailed(`MACHINES.json not found.`); + return; + } + + // 4. Parse the file let targets; try { - if (!fs.existsSync(targetsPath)) { - core.setFailed(`MACHINES.json not found at ${targetsPath}`); - return; - } targets = JSON.parse(fs.readFileSync(targetsPath, 'utf-8')); } catch (err) { - core.setFailed(`Failed to load or parse MACHINES.json: ${err.message}`); + core.setFailed(`Failed to parse MACHINES.json: ${err.message}`); return; } - // Build matrix: machine, firmware + + // 5. Generate Outputs const build_matrix = Object.values(targets).map(({ machine, firmware }) => ({ machine, firmware })); core.setOutput('build_matrix', JSON.stringify(build_matrix)); - console.log("Build Matrix:", build_matrix); - // Full matrix: machine, firmware, lavaname const full_matrix = Object.values(targets).map(({ machine, firmware, lavaname }) => ({ machine, firmware, lavaname })); - core.setOutput('full_matrix', JSON.stringify(full_matrix)); - console.log("Full Matrix:", full_matrix); + core.setOutput('full_matrix', JSON.stringify(full_matrix)); \ No newline at end of file diff --git a/.github/workflows/loading.yml b/.github/workflows/loading.yml index 9859304ab..e67c92b13 100644 --- a/.github/workflows/loading.yml +++ b/.github/workflows/loading.yml @@ -4,11 +4,16 @@ description: Load required parameters for the subsequent jobs on: workflow_call: + inputs: + target_branch: + description: "Branch to checkout (optional)" + required: false + type: string + default: "" outputs: build_matrix: description: Build matrix value: ${{ jobs.loading.outputs.build_matrix }} - full_matrix: description: Full Matrix containing lava description value: ${{ jobs.loading.outputs.full_matrix }} @@ -20,7 +25,10 @@ jobs: build_matrix: ${{ steps.loading.outputs.build_matrix }} full_matrix: ${{ steps.loading.outputs.full_matrix }} steps: - - name: Sync codebase + # SCENARIO 1: Pull Request (Pre-Merge) + # Uses your custom sync action to merge PR code with base + - name: Sync codebase (PR) + if: github.event_name == 'pull_request' uses: qualcomm-linux/video-driver/.github/actions/sync@video.qclinux.0.0 with: event_name: ${{ github.event_name }} @@ -28,6 +36,17 @@ jobs: pr_repo: ${{ github.event.pull_request.head.repo.full_name }} base_ref: ${{ github.ref_name }} + # SCENARIO 2: Schedule or Manual (Post-Merge) + # Uses standard checkout because there is no PR to sync + - name: Checkout Code (Schedule) + if: github.event_name != 'pull_request' + uses: actions/checkout@v4 + with: + # Use the input branch if provided, otherwise default to current ref + ref: ${{ inputs.target_branch || github.ref_name }} + # Check out into 'video-driver' folder so the script finds the nested path + path: video-driver + - name: Load Parameters id: loading - uses: qualcomm-linux/video-driver/.github/actions/loading@video.qclinux.0.0 + uses: qualcomm-linux/video-driver/.github/actions/loading@video.qclinux.0.0 \ No newline at end of file diff --git a/.github/workflows/post_merge.yml b/.github/workflows/post_merge.yml index 38a17cfe6..4e15f99b0 100644 --- a/.github/workflows/post_merge.yml +++ b/.github/workflows/post_merge.yml @@ -1,12 +1,11 @@ -name: post_merge_weekly +name: Post Merge Weekly description: | Runs post-merge CI for the video-driver repository on a weekly schedule. Reuses loading, build and test workflows. on: schedule: - # Every Monday and Thursday at 02:30 UTC (8:00 AM IST) - - cron: "30 2 * * 1,4" + - cron: '0 0 * * *' workflow_dispatch: jobs: diff --git a/.github/workflows/qcom-preflight-checks.yml b/.github/workflows/qcom-preflight-checks.yml index 0dd44ecd7..05e0106ee 100644 --- a/.github/workflows/qcom-preflight-checks.yml +++ b/.github/workflows/qcom-preflight-checks.yml @@ -1,9 +1,9 @@ name: Qualcomm Preflight Checks on: pull_request_target: - branches: [ development ] + branches: [ video.qclinux.0.0 ] push: - branches: [ development ] + branches: [ video.qclinux.0.0 ] workflow_dispatch: permissions: diff --git a/.github/workflows/sync-and-build.yml b/.github/workflows/sync-and-build.yml index a50c954d3..584616f47 100644 --- a/.github/workflows/sync-and-build.yml +++ b/.github/workflows/sync-and-build.yml @@ -28,7 +28,17 @@ jobs: uses: qualcomm-linux/kernel-config/.github/actions/pull_docker_image@main with: image: ${{ inputs.docker_image }} - + + # ------------------------------------------------------------------------ + # ✅ CRITICAL FIX: Explicitly checkout the driver code. + # This ensures the source code exists for Post-Merge/Scheduled runs. + # ------------------------------------------------------------------------ + - name: Checkout Video Driver + uses: actions/checkout@v4 + with: + path: video-driver + fetch-depth: 0 + - name: Sync codebase uses: qualcomm-linux/video-driver/.github/actions/sync@video.qclinux.0.0 with: @@ -38,11 +48,19 @@ jobs: base_ref: ${{ github.ref_name }} caller_workflow: build + - name: Build workspace uses: qualcomm-linux/video-driver/.github/actions/build@video.qclinux.0.0 with: docker_image: kmake-image:ver.1.0 workspace_path: ${{ github.workspace }} + + - name: Fix Workspace Ownership + if: always() + shell: bash + run: | + echo "🔧 Fixing file ownership (root -> runner user)..." + sudo chown -R $(id -u):$(id -g) ${{ github.workspace }} - name: Download iris_test_app from the s3 shell: bash @@ -287,4 +305,4 @@ jobs: done < "$file_list" fi echo "" - } >> "$GITHUB_STEP_SUMMARY" \ No newline at end of file + } >> "$GITHUB_STEP_SUMMARY" \ No newline at end of file diff --git a/ci/MACHINES.json b/ci/MACHINES.json index 68d03979b..d60f42ae0 100644 --- a/ci/MACHINES.json +++ b/ci/MACHINES.json @@ -2,7 +2,7 @@ "qcs6490-rb3gen2": { "machine": "qcs6490-rb3gen2", "firmware": "rb3gen2", - "lavaname": "qcs6490", + "lavaname": "qcs6490-rb3gen2", "target": "qcs6490-rb3gen2", "buildid": "QCM6490.LE.1.0-00376-STD.PROD-1", "firmwareid": "rb3gen2"