Skip to content

Commit f66d7b0

Browse files
authored
test_run in the new branch
1 parent e5f4f7a commit f66d7b0

15 files changed

Lines changed: 1583 additions & 42 deletions

File tree

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# name: AWS S3 Helper
2+
description: Upload and download files from AWS S3
3+
4+
inputs:
5+
s3_bucket:
6+
description: S3 Bucket Name
7+
required: true
8+
local_file:
9+
description: Local file paths
10+
required: false
11+
default: ../artifacts/file_list.txt
12+
download_file:
13+
description: Download file paths
14+
required: false
15+
default: ''
16+
download_location:
17+
description: File download location
18+
required: false
19+
default: .
20+
mode:
21+
description: Mode of operation (upload/download)
22+
required: true
23+
default: single-upload
24+
upload_location:
25+
description: Upload location
26+
required: true
27+
28+
outputs:
29+
presigned_url:
30+
description: Pre-signed URL for the uploaded file
31+
value: ${{ steps.sync-data.outputs.presigned_url }}
32+
s3_location:
33+
description: Upload location
34+
value: ${{ inputs.upload_location }}
35+
36+
runs:
37+
using: "composite"
38+
steps:
39+
- name: Sync Data
40+
id: sync-data
41+
shell: bash
42+
env:
43+
UPLOAD_LOCATION: ${{ inputs.upload_location }}
44+
run: |
45+
echo "::group::Uploading files to S3"
46+
case "${{ inputs.mode }}" in
47+
multi-upload)
48+
if [ ! -s "${{ inputs.local_file }}" ]; then
49+
echo "❌ File list is empty. No files to upload."
50+
exit 1
51+
fi
52+
53+
echo "📄 Contents of file list:"
54+
cat "${{ inputs.local_file }}"
55+
56+
first_line=true
57+
manifest="${{ github.workspace }}/presigned_urls.json"
58+
echo "{" > "${manifest}"
59+
60+
while IFS= read -r file; do
61+
resolved_file=$(readlink -f "$file")
62+
if [ -f "$resolved_file" ]; then
63+
filename=$(basename "$resolved_file")
64+
echo "📤 Uploading $filename..."
65+
aws s3 cp "$resolved_file" "s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/$filename"
66+
presigned_url=$(aws s3 presign "s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/$filename" --expires-in 259200)
67+
68+
if [ "$first_line" = true ]; then
69+
first_line=false
70+
else
71+
echo "," >> "${manifest}"
72+
fi
73+
74+
# Key = filename, Value = presigned_url
75+
echo " \"${filename}\": \"${presigned_url}\"" >> "${manifest}"
76+
echo "✅ Pre-signed URL for $filename: $presigned_url"
77+
else
78+
echo "⚠️ Skipping: $file is not a regular file or not accessible."
79+
fi
80+
done < "${{ inputs.local_file }}"
81+
82+
echo "}" >> "${manifest}"
83+
;;
84+
single-upload)
85+
resolved_file=$(readlink -f "${{ inputs.local_file }}")
86+
filename=$(basename "$resolved_file")
87+
aws s3 cp "$resolved_file" "s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/$filename"
88+
presigned_url=$(aws s3 presign "s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/$filename" --expires-in 259200)
89+
echo "presigned_url=${presigned_url}" >> "$GITHUB_OUTPUT"
90+
;;
91+
download)
92+
download_dir=$(realpath "${{ inputs.download_location }}")
93+
aws s3 cp "s3://${{ inputs.s3_bucket }}/${{ inputs.download_file }}" "$download_dir"
94+
;;
95+
*)
96+
echo "Invalid mode. Use 'upload', 'multi-upload', or 'download'."
97+
exit 1
98+
;;
99+
esac
100+
echo "::endgroup::"
101+
102+
- name: Upload presigned URL manifest
103+
if: ${{ inputs.mode == 'multi-upload' }}
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: presigned_urls.json
107+
path: ${{ github.workspace }}/presigned_urls.json
108+
retention-days: 3

.github/actions/build/action.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build
2+
description: Build the project using a Docker container
3+
4+
inputs:
5+
docker_image:
6+
description: Docker image to use for the build job
7+
required: true
8+
kas_file:
9+
description: KAS file to use for the build job
10+
required: true
11+
build_command:
12+
description: Command to run for the build
13+
required: false
14+
default: "bitbake core-image-base"
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Build ${{ env.machine }}
20+
shell: bash
21+
run: |
22+
set -euo pipefail
23+
24+
USER_ID=$(id -u)
25+
GROUP_ID=$(id -g)
26+
MACHINE="${{ env.machine }}"
27+
KAS_FILE="${{ inputs.kas_file }}"
28+
BUILD_COMMAND="${{ inputs.build_command }}"
29+
WORKSPACE_ROOT="$(dirname "${PWD}")"
30+
REPO_NAME="$(basename "${PWD}")"
31+
32+
echo "Machine: ${MACHINE}"
33+
echo "Docker image: ${{ inputs.docker_image }}"
34+
echo "KAS file: ${KAS_FILE}"
35+
echo "Build command: ${BUILD_COMMAND}"
36+
echo "WORKSPACE_ROOT: ${WORKSPACE_ROOT}"
37+
echo "REPO_NAME: ${REPO_NAME}"
38+
39+
docker run --rm \
40+
--user "${USER_ID}:${GROUP_ID}" \
41+
-v "${WORKSPACE_ROOT}:/workspace" \
42+
-w "/workspace/${REPO_NAME}" \
43+
-e "MACHINE=${MACHINE}" \
44+
-e "KAS_FILE=${KAS_FILE}" \
45+
-e "BUILD_COMMAND=${BUILD_COMMAND}" \
46+
"${{ inputs.docker_image }}" \
47+
bash -lc '
48+
set -euo pipefail
49+
echo "=== inside container ==="
50+
echo "pwd: $(pwd)"
51+
echo "=== /workspace ==="
52+
ls -la /workspace
53+
echo "=== /workspace/video-driver ==="
54+
ls -la .
55+
echo "=== /workspace/meta-qcom/ci ==="
56+
ls -la ../meta-qcom/ci || true
57+
echo "Starting build for ${MACHINE}"
58+
echo "Using kas file: ${KAS_FILE}"
59+
echo "Running build command: ${BUILD_COMMAND}"
60+
which kas
61+
kas --version
62+
kas shell -c "${BUILD_COMMAND}" "${KAS_FILE}"
63+
'
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build Docker Image
2+
description: Build docker image from qualcomm-linux/kmake-image repository
3+
4+
inputs:
5+
image_name:
6+
description: Docker image name to create
7+
required: true
8+
repo:
9+
description: Repository containing the Dockerfile
10+
required: false
11+
default: "https://github.com/qualcomm-linux/kmake-image.git"
12+
branch:
13+
description: Branch or tag to checkout
14+
required: false
15+
default: "main"
16+
dockerfile:
17+
description: Dockerfile path relative to cloned repo
18+
required: false
19+
default: "Dockerfile"
20+
context:
21+
description: Build context relative to cloned repo
22+
required: false
23+
default: "."
24+
http_proxy:
25+
description: HTTP proxy
26+
required: false
27+
default: ""
28+
https_proxy:
29+
description: HTTPS proxy
30+
required: false
31+
default: ""
32+
no_proxy:
33+
description: no_proxy
34+
required: false
35+
default: ""
36+
37+
outputs:
38+
image_name:
39+
description: Built image name
40+
value: ${{ steps.build.outputs.image_name }}
41+
42+
runs:
43+
using: "composite"
44+
steps:
45+
- name: Clone kmake-image repo
46+
shell: bash
47+
run: |
48+
set -euo pipefail
49+
REPO_DIR="${{ runner.temp }}/kmake-image-src"
50+
rm -rf "${REPO_DIR}"
51+
git clone --depth 1 --branch "${{ inputs.branch }}" "${{ inputs.repo }}" "${REPO_DIR}"
52+
ls -la "${REPO_DIR}"
53+
54+
- name: Build docker image
55+
id: build
56+
shell: bash
57+
run: |
58+
set -euo pipefail
59+
60+
IMAGE_NAME="${{ inputs.image_name }}"
61+
REPO_DIR="${{ runner.temp }}/kmake-image-src"
62+
DOCKERFILE_PATH="${REPO_DIR}/${{ inputs.dockerfile }}"
63+
CONTEXT_PATH="${REPO_DIR}/${{ inputs.context }}"
64+
65+
docker build \
66+
--build-arg http_proxy="${{ inputs.http_proxy }}" \
67+
--build-arg https_proxy="${{ inputs.https_proxy }}" \
68+
--build-arg no_proxy="${{ inputs.no_proxy }}" \
69+
--build-arg HTTP_PROXY="${{ inputs.http_proxy }}" \
70+
--build-arg HTTPS_PROXY="${{ inputs.https_proxy }}" \
71+
--build-arg NO_PROXY="${{ inputs.no_proxy }}" \
72+
-t "${IMAGE_NAME}" \
73+
-f "${DOCKERFILE_PATH}" \
74+
"${CONTEXT_PATH}"
75+
76+
echo "image_name=${IMAGE_NAME}" >> "${GITHUB_OUTPUT}"

.github/actions/inject/action.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: IRIS Injection
2+
description: Inject IRIS app and video content tarball into rootfs image
3+
4+
inputs:
5+
machine:
6+
description: Target machine name
7+
required: true
8+
docker_image:
9+
description: Docker image name
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Create top-level images directory
16+
shell: bash
17+
run: |
18+
set -euo pipefail
19+
mkdir -p "${{ github.workspace }}/images"
20+
21+
- name: Run IRIS injection in Docker
22+
shell: bash
23+
run: |
24+
set -euo pipefail
25+
26+
MACHINE="${{ inputs.machine }}"
27+
WORKSPACE_ROOT="$(dirname "${PWD}")"
28+
REPO_NAME="$(basename "${PWD}")"
29+
30+
echo "PWD: ${PWD}"
31+
echo "WORKSPACE_ROOT: ${WORKSPACE_ROOT}"
32+
echo "REPO_NAME: ${REPO_NAME}"
33+
echo "MACHINE: ${MACHINE}"
34+
35+
docker run --rm \
36+
-v "${WORKSPACE_ROOT}:/workspace" \
37+
-w "/workspace/${REPO_NAME}" \
38+
-e "MACHINE=${MACHINE}" \
39+
-e "WORKSPACE=/workspace/${REPO_NAME}" \
40+
--privileged \
41+
"${{ inputs.docker_image }}" \
42+
bash -lc '
43+
set -euxo pipefail
44+
45+
IMAGE_BASE_DIR="build/tmp/deploy/images/${MACHINE}"
46+
47+
echo "=== Looking for build output under: ${IMAGE_BASE_DIR} ==="
48+
if [ ! -d "${IMAGE_BASE_DIR}" ]; then
49+
echo "❌ Machine output directory not found: ${IMAGE_BASE_DIR}"
50+
echo "=== build/tmp/deploy/images tree ==="
51+
find build/tmp/deploy/images -maxdepth 3 -mindepth 1 -print | sort || true
52+
exit 1
53+
fi
54+
55+
echo "=== Contents of machine directory ==="
56+
ls -la "${IMAGE_BASE_DIR}" || true
57+
58+
IMAGE_DIR="$(find "${IMAGE_BASE_DIR}" -maxdepth 1 -type d -name "*.qcomflash" | sort | head -n 1 || true)"
59+
60+
if [ -z "${IMAGE_DIR}" ]; then
61+
echo "❌ No .qcomflash directory found under ${IMAGE_BASE_DIR}"
62+
echo "=== Full contents under machine directory ==="
63+
find "${IMAGE_BASE_DIR}" -maxdepth 2 -print | sort || true
64+
exit 1
65+
fi
66+
67+
echo "✅ Using image directory: ${IMAGE_DIR}"
68+
cd "${IMAGE_DIR}"
69+
ls -larth
70+
71+
ROOTFS_IMG="$(realpath rootfs.img)"
72+
echo "ROOTFS_IMG=${ROOTFS_IMG}"
73+
test -f "${ROOTFS_IMG}"
74+
75+
echo "📦 Checking IRIS app payload..."
76+
test -d "${WORKSPACE}/v4l-video-test-app/build"
77+
ls -la "${WORKSPACE}/v4l-video-test-app/build"
78+
79+
echo "🔎 Loop devices before:"
80+
ls -l /dev/loop* || true
81+
losetup -a || true
82+
83+
modprobe loop max_loop=64 || true
84+
for i in $(seq 0 63); do
85+
[ -b /dev/loop$i ] || mknod -m 660 /dev/loop$i b 7 "$i" || true
86+
done
87+
88+
echo "🔎 Loop devices after:"
89+
ls -l /dev/loop* || true
90+
91+
mkdir -p /tmp/rootfs
92+
LOOPDEV=""
93+
94+
cleanup() {
95+
set +e
96+
sync || true
97+
mountpoint -q /tmp/rootfs && umount /tmp/rootfs || true
98+
[ -n "${LOOPDEV}" ] && losetup -d "${LOOPDEV}" || true
99+
}
100+
trap cleanup EXIT
101+
102+
echo "🔗 Attaching loop device..."
103+
for attempt in 1 2 3; do
104+
LOOPDEV="$(losetup --find --show "${ROOTFS_IMG}" 2>/dev/null || true)"
105+
if [ -n "${LOOPDEV}" ]; then
106+
break
107+
fi
108+
echo "Attempt ${attempt} failed to allocate loop device, retrying..."
109+
sleep 2
110+
done
111+
112+
if [ -z "${LOOPDEV}" ]; then
113+
echo "❌ Failed to allocate loop device for ${ROOTFS_IMG}"
114+
exit 1
115+
fi
116+
117+
echo "Using loop device: ${LOOPDEV}"
118+
119+
echo "🔗 Mounting rootfs..."
120+
mount "${LOOPDEV}" /tmp/rootfs
121+
122+
echo "📁 Creating IRIS app directories..."
123+
mkdir -p /tmp/rootfs/data/vendor/iris_test_app/input
124+
mkdir -p /tmp/rootfs/data/vendor/iris_test_app/output
125+
126+
echo "📥 Copying IRIS app payload from workspace..."
127+
cp -a "${WORKSPACE}/v4l-video-test-app/build/." /tmp/rootfs/data/vendor/iris_test_app/
128+
129+
echo "📥 Copying video tarball into rootfs (no extraction)..."
130+
cp -a "${WORKSPACE}/downloads/video_clips_iris.tar.gz" /tmp/rootfs/data/vendor/iris_test_app/
131+
132+
echo "🔍 Verifying injected files..."
133+
ls -larth /tmp/rootfs/data/vendor/iris_test_app
134+
ls -larth /tmp/rootfs/data/vendor/iris_test_app/input
135+
136+
echo "📤 Syncing changes..."
137+
sync
138+
139+
echo "📤 Unmounting rootfs..."
140+
umount /tmp/rootfs
141+
trap - EXIT
142+
143+
echo "✅ IRIS injection completed for ${MACHINE}."
144+
'

0 commit comments

Comments
 (0)