|
| 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 |
0 commit comments