Skip to content

Commit cdf3fc7

Browse files
committed
ci: Initial changes for Yocto Build
Add workflow for compiling post-merge Yocto Build. - Use kas-build.yml file from meta-qcom build - Update kernel SHA with kernel-override.yml file This will compile meta-qcom build with kernel SHA, on top of meta-qcom nightly build using kas-build.yml file. Signed-off-by: Salendarsingh Gaud <sgaud@qti.qualcomm.com>
1 parent 0e73fdf commit cdf3fc7

3 files changed

Lines changed: 343 additions & 0 deletions

File tree

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
name: Compile Yocto Build
3+
description: Compile Yocto Build using kas files
4+
5+
inputs:
6+
target:
7+
description: target
8+
type: string
9+
required: true
10+
workspace_path:
11+
description: Workspace path
12+
required: true
13+
s3_bucket:
14+
description: S3 bucket name
15+
required: true
16+
docker_image:
17+
description: Docker image name
18+
required: true
19+
machine:
20+
description: Machine name
21+
required: true
22+
rootfs:
23+
description: rootfs name
24+
required: true
25+
kernel_ver:
26+
description: Kernel version on which CI is running
27+
required: true
28+
sha:
29+
description: SHA of kernel, on which CI will run
30+
required: true
31+
cache_dir:
32+
description: Cache directory
33+
required: true
34+
35+
36+
outputs:
37+
artifacts_location:
38+
value: ${{ steps.upload_artifacts.outputs.s3_location }}
39+
description: Aws location
40+
41+
runs:
42+
using: 'composite'
43+
steps:
44+
- name: Setup Environment
45+
shell: bash
46+
run: |
47+
set -ex
48+
workspace=${{ inputs.workspace_path }}
49+
s3_bucket=${{ inputs.s3_bucket }}
50+
docker_image=${{ inputs.docker_image }}
51+
machine=${{ inputs.machine }}
52+
rootfs=${{ inputs.rootfs }}
53+
build_dir="$workspace/../$rootfs"
54+
sha=${{ inputs.sha }}
55+
kernel_ver=${{ inputs.kernel_ver }}
56+
57+
echo "target=${{ inputs.target }}" >> $GITHUB_ENV
58+
echo "workspace=${{ inputs.workspace_path }}" >> $GITHUB_ENV
59+
echo "s3_bucket=${{ inputs.s3_bucket }}" >> $GITHUB_ENV
60+
echo "docker_image=${{ inputs.docker_image }}" >> $GITHUB_ENV
61+
echo "machine=${{ inputs.machine }}" >> $GITHUB_ENV
62+
echo "build_dir=$build_dir" >> $GITHUB_ENV
63+
echo "sha=${{ inputs.sha }}" >> $GITHUB_ENV
64+
echo "rootfs=${{ inputs.rootfs }}" >> $GITHUB_ENV
65+
echo "kernel_ver=${{ inputs.kernel_ver }}" >> $GITHUB_ENV
66+
67+
echo "LOGFILE=${{ github.workspace }}/build-logs.log" >> "$GITHUB_ENV"
68+
69+
mkdir -p "$build_dir"
70+
71+
- name: Configure AWS
72+
uses: aws-actions/configure-aws-credentials@v2
73+
with:
74+
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
75+
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
76+
aws-region: us-west-2
77+
78+
- name: Setup Kas Environment
79+
shell: bash
80+
id: download_kas
81+
run: |
82+
set -ex
83+
cd ${{ env.build_dir }}
84+
aws s3 cp s3://${{ env.s3_bucket }}/kernel/meta-qcom/kas_files/${{ inputs.kernel_ver }}/kas-build-${{ env.rootfs }}.yml .
85+
aws s3 cp s3://${{ env.s3_bucket }}/kernel/meta-qcom/kas_files/${{ inputs.kernel_ver }}/kernel-override.yml .
86+
aws s3 cp s3://${{ env.s3_bucket }}/kernel/meta-qcom/kas_files/${{ inputs.kernel_ver }}/build_id.txt .
87+
88+
kernel_sha="${{ env.sha }}"
89+
echo "SHA : $kernel_sha"
90+
kernel_ver="${{ env.kernel_ver }}"
91+
if [[ $kernel_ver == "6.18" ]]; then
92+
sed -i "s/SRCREV:pn-linux-qcom = \"[^\"]*\"/SRCREV:pn-linux-qcom = \"$kernel_sha\"/" kernel-override.yml
93+
else
94+
sed -i "s/SRCREV:pn-linux-qcom-next = \"[^\"]*\"/SRCREV:pn-linux-qcom-next = \"$kernel_sha\"/" kernel-override.yml
95+
fi
96+
97+
- name: Run Kas Build
98+
id: build
99+
shell: bash
100+
run: |
101+
set -ex
102+
cd ${{ env.build_dir }}
103+
mkdir kas
104+
ls -la
105+
export KAS_WORK_DIR=$PWD/kas
106+
echo $KAS_WORK_DIR
107+
docker run -i --rm \
108+
--user "$(id -u):$(id -g)" \
109+
--workdir="$PWD" \
110+
-v "$(dirname "$PWD")":"$(dirname "$PWD")" \
111+
"${{ env.docker_image }}" bash -c "
112+
kas build kas-build-${{ env.rootfs }}.yml:kernel-override.yml
113+
"
114+
115+
- name: Prepare file list for log upload
116+
if: always()
117+
shell: bash
118+
run: |
119+
set -ex
120+
# check if file_list.txt exists, if not create it
121+
if [ ! -f ${{ github.workspace }}/file_list.txt ]; then
122+
touch ${{ github.workspace }}/file_list.txt
123+
fi
124+
# # echo "${{ github.workspace}}/build-logs.log" >> file_list.txt
125+
cd ${{ env.build_dir }}/build/tmp/deploy/images/${{ env.rootfs }}/
126+
ls -la
127+
LINK="qcom-multimedia-image-${{ env.rootfs }}.rootfs.qcomflash.tar.gz"
128+
TARGET=$(readlink "$LINK")
129+
cp "$TARGET" ${{ env.build_dir }}/${{ env.rootfs }}.tar.gz
130+
131+
LINK_PROP="qcom-multimedia-proprietary-image-${{ env.rootfs }}.rootfs.qcomflash.tar.gz"
132+
TARGET_PROP=$(readlink "$LINK")
133+
cp "$TARGET_PROP" ${{ env.build_dir }}/${{ env.rootfs }}-prop.tar.gz
134+
135+
echo "${{ env.build_dir }}/${{ env.rootfs }}.tar.gz" >> ${{ github.workspace }}/file_list.txt
136+
echo "${{ env.build_dir }}/${{ env.rootfs }}-prop.tar.gz" >> ${{ github.workspace }}/file_list.txt
137+
echo "${{ env.build_dir }}/build_id.txt" >> ${{ github.workspace }}/file_list.txt
138+
139+
- name: Upload artifacts to S3
140+
if: always()
141+
id: upload_artifacts
142+
uses: qualcomm-linux/kernel-config/.github/actions/aws_s3_helper@main
143+
with:
144+
s3_bucket: qli-prd-kernel-gh-artifacts
145+
local_file: ${{ github.workspace }}/file_list.txt
146+
mode: multi-upload
147+
env:
148+
machine: ${{ inputs.rootfs }}_
149+
150+
- name: Update Summary
151+
if: always()
152+
shell: bash
153+
run: |
154+
if [ "${{ steps.upload_artifacts.outcome }}" == "success" ]; then
155+
status="Success"
156+
emoji=":heavy_check_mark:"
157+
else
158+
status="Failure"
159+
emoji=":x:"
160+
fi
161+
echo "### Build completed successfully." >> $GITHUB_STEP_SUMMARY
162+
echo "- Artifacts upload to AWS s3 location: **$status** $emoji" >> $GITHUB_STEP_SUMMARY
163+
echo "- Build logs upload to AWS s3 location: **$status** $emoji" >> $GITHUB_STEP_SUMMARY
164+
if [ $status == "Success" ]; then
165+
echo "- Check github artifacts for presigned URLs JSON file containing link to the logs and artifacts." >> $GITHUB_STEP_SUMMARY
166+
fi

.github/workflows/build-yocto.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
name: _build_yocto
3+
description: Reusable workflow for Yocto Build
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
docker_image:
9+
description: Docker image
10+
type: string
11+
required: true
12+
repo:
13+
description: 'Repo Name'
14+
required: false
15+
type: string
16+
ref:
17+
description: 'Branch or tag name'
18+
required: false
19+
type: string
20+
pr:
21+
description: 'Pull Request Number'
22+
required: false
23+
type: string
24+
default: ''
25+
sha:
26+
description: Head sha of the PR
27+
type: string
28+
required: true
29+
rootfs_matrix:
30+
description: 'Rootfs matrix for Yocto Parallel builds'
31+
required: true
32+
type: string
33+
kernel_ver:
34+
description: Kernel version
35+
type: string
36+
required: true
37+
outputs:
38+
artifacts_location:
39+
description: 'Artifacts Upload location'
40+
value: ${{ jobs.compile_yocto.outputs.artifacts_location }}
41+
42+
jobs:
43+
compile_yocto:
44+
name: Build Yocto
45+
runs-on:
46+
group: GHA-Kernel-SelfHosted-RG
47+
labels: [self-hosted, kernel-prd-u2404-x64-large-od-ephem]
48+
outputs:
49+
artifacts_location: ${{ steps.build_yocto.outputs.artifacts_location }}
50+
workspace_path: ${{ steps.sync.outputs.workspace_path }}
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
rootfs_matrix: ${{ fromJson(inputs.rootfs_matrix) }}
55+
56+
steps:
57+
- name: Pull docker image
58+
uses: qualcomm-linux/kernel-config/.github/actions/pull_docker_image@main
59+
with:
60+
image: ${{ inputs.docker_image }}
61+
62+
- name: Build Yocto
63+
id: build_yocto
64+
uses: qualcomm-linux/kernel-config/.github/actions/build_yocto@main
65+
with:
66+
docker_image: ${{ inputs.docker_image }}
67+
target: ${{ matrix.target }}
68+
workspace_path: ${{ github.workspace }}
69+
s3_bucket: qli-prd-kernel-gh-artifacts
70+
machine: ${{ matrix.rootfs_matrix.machine }}
71+
rootfs: ${{ matrix.rootfs_matrix.rootfs }}
72+
firmwareid: ${{ matrix.rootfs_matrix.firmwareid }}
73+
kernel_ver: ${{ inputs.kernel_ver }}
74+
sha: ${{ inputs.sha }}
75+
env:
76+
token: ${{ secrets.PAT }}
77+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
78+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
name: post_merge_yocto
3+
run-name: Compile Yocto Build
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
sha:
9+
description: Head sha on which Build needs to be triggered
10+
type: string
11+
required: true
12+
ref:
13+
description: Target branch
14+
type: string
15+
required: true
16+
repo:
17+
description: Target repository
18+
type: string
19+
required: true
20+
kernel_ver:
21+
description: Kernel version
22+
type: string
23+
required: true
24+
25+
jobs:
26+
init-status:
27+
name: Initialize Status
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Set Status
31+
uses: qualcomm-linux/kernel-config/.github/actions/workflow_status@main
32+
with:
33+
sha: ${{ github.event.inputs.sha || github.sha }}
34+
action_mode: start
35+
check_name: "Yocto Build Generation"
36+
repo: ${{ github.event.inputs.repo || github.repository }}
37+
GH_TOKEN: ${{ secrets.PAT }}
38+
39+
init:
40+
name: Initialize Workflow
41+
needs: init-status
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Update Summary
45+
run: |
46+
echo "## Yocto Build Generation" >> $GITHUB_STEP_SUMMARY
47+
echo "- Pull Request Number: \`${{ github.event.inputs.pr || 'N/A' }}\`" >> $GITHUB_STEP_SUMMARY
48+
echo "- Head Commit SHA: \`${{ github.event.inputs.sha || 'N/A' }}\`" >> $GITHUB_STEP_SUMMARY
49+
echo "- Target Branch: \`${{ github.event.inputs.ref || 'N/A' }}\`" >> $GITHUB_STEP_SUMMARY
50+
echo "- Target Repository: \`${{ github.event.inputs.repo || 'N/A' }}\`" >> $GITHUB_STEP_SUMMARY
51+
52+
loading:
53+
name: Load Parameters
54+
needs: init-status
55+
uses: qualcomm-linux/kernel-config/.github/workflows/loading.yml@main
56+
secrets: inherit
57+
58+
build_yocto:
59+
name: Build Yocto
60+
needs: [init-status, init, loading]
61+
uses: qualcomm-linux/kernel-config/.github/workflows/build-yocto.yml@main
62+
secrets: inherit
63+
with:
64+
docker_image: kmake-image:ver.1.0
65+
repo: ${{ github.event.inputs.repo || 'qualcomm-linux/kernel' }}
66+
ref: ${{ github.event.inputs.ref || 'qcom-next' }}
67+
pr: ${{ github.event.inputs.pr || '' }}
68+
SHA: ${{ github.event.inputs.sha }}
69+
rootfs_matrix: ${{ needs.loading.outputs.rootfs_matrix }}
70+
kernel_ver: ${{ github.event.inputs.kernel_ver }}
71+
72+
check_run:
73+
runs-on: ubuntu-latest
74+
needs: [init-status, init, loading, build_yocto]
75+
steps:
76+
- name: Post check run
77+
uses: qualcomm-linux/kernel-config/.github/actions/check_run@main
78+
with:
79+
sha: ${{ inputs.sha }}
80+
repo: ${{ inputs.repo }}
81+
s3_location: ${{ needs.build_yocto.outputs.artifacts_location }}
82+
workflow_name: " for ${{ github.workflow }}"
83+
APPID: ${{ secrets.APPID }}
84+
PVK: ${{ secrets.PVK }}
85+
86+
final-status:
87+
name: Finalize Status
88+
if: always()
89+
runs-on: ubuntu-latest
90+
needs: [build_yocto, check_run]
91+
steps:
92+
- name: Set final status
93+
uses: qualcomm-linux/kernel-config/.github/actions/workflow_status@main
94+
with:
95+
sha: ${{ github.event.inputs.sha || github.sha }}
96+
action_mode: ${{ needs.build_yocto.result }}
97+
check_name: "Yocto Build Generation"
98+
repo: ${{ github.event.inputs.repo || github.repository }}
99+
GH_TOKEN: ${{ secrets.PAT }}

0 commit comments

Comments
 (0)