1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
name: Sync and build
description: |
This reusable workflow syncs and builds FastRPC code for a specified machine and firmware
using a Docker image. It performs code checkout, Docker image build, workspace sync,
kernel compilation, and artifact packaging. Key build outputs (Image, ramdisk, modules, DTB)
are uploaded to S3, and the runner workspace is cleaned to manage disk usage. A summary of
the build status is added to the GitHub Actions summary.
on:
workflow_call:
inputs:
docker_image:
description: Docker image
type: string
required: true
deviceTree:
description: device Tree name
type: string
required: true
linuxFirmware:
description: Linux Firmware identifier
type: string
required: true
hexDSPBinary:
description: Hexagon DSP binaries identifier
type: string
required: true
jobs:
build:
runs-on:
group: GHA-fastrpc-Prd-SelfHosted-RG
labels: [ self-hosted, fastrpc-prd-u2404-x64-large-od-ephem ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# fetch-depth: 1 is generally sufficient for builds and is faster than 0 (full history).
# Change to 0 if your build process strictly requires the full Git history.
fetch-depth: 1
- name: Build fastrpc docker image
uses: qualcomm/fastrpc/.github/actions/build_docker_image@development
with:
image: ${{ inputs.docker_image }}
- name: Sync codebase
id: sync
uses: qualcomm/fastrpc/.github/actions/sync@development
with:
linuxFirmware: ${{ inputs.linuxFirmware }}
hexDSPBinary: ${{ inputs.hexDSPBinary }}
- name: Build workspace
id: build_workspace
uses: qualcomm/fastrpc/.github/actions/build@development
with:
docker_image: ${{ inputs.docker_image }}
workspace_path: ${{ steps.sync.outputs.workspace_path }}
- name: Create file list for artifacts upload
run: |
workspace=${{ steps.sync.outputs.workspace_path }}
# Create the tarball in the root of the GitHub workspace
cd "$workspace/kobj/tar-install"
tar -cJf "${{ github.workspace }}/modules.tar.xz" lib/modules/
# Populate the file_list.txt with paths to artifacts
cat <<EOF > "$workspace/artifacts/file_list.txt"
${{ github.workspace }}/modules.tar.xz
$workspace/kobj/arch/arm64/boot/Image
$workspace/kobj/vmlinux
$workspace/artifacts/ramdisk_fastrpc.gz
$workspace/kobj/arch/arm64/boot/dts/qcom/${{ inputs.deviceTree }}.dtb
EOF
echo "Generated artifact list:"
cat "$workspace/artifacts/file_list.txt"
- name: Upload artifacts
uses: qualcomm/fastrpc/.github/actions/aws_s3_helper@development
with:
s3_bucket: qli-prd-fastrpc-gh-artifacts
# local_file points to the list of files to upload
local_file: ${{ steps.sync.outputs.workspace_path }}/artifacts/file_list.txt
mode: multi-upload
deviceTree: ${{ inputs.deviceTree }}
- name: Clean up
# This step is crucial for self-hosted runners to manage disk space.
run: |
rm -rf "${{ steps.sync.outputs.workspace_path }}/artifacts" || true
rm -rf "${{ steps.sync.outputs.workspace_path }}/fastrpc_libs" || true
rm -rf "${{ steps.sync.outputs.workspace_path }}/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu" || true
rm -rf "${{ steps.sync.outputs.workspace_path }}/kobj" || true
rm -f "${{ github.workspace }}/modules.tar.xz" || true # Clean up the tarball from the root workspace
- name: Update summary
# This step always runs to provide feedback on the build status.
if: success() || failure()
shell: bash
run: |
if [ "${{ steps.build_workspace.outcome }}" == 'success' ]; then
echo "Build was successful"
summary=":heavy_check_mark: Build Success"
else
echo "Build failed"
summary=":x: Build Failed"
fi
SUMMARY='
<details><summary><i>Build Summary</i></summary>
'${summary}'
</details>
'
echo -e "$SUMMARY" >> "$GITHUB_STEP_SUMMARY"
|