|
| 1 | +name: Base Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + required: false |
| 8 | + type: string |
| 9 | + default: "main" |
| 10 | + description: "Branch to checkout" |
| 11 | + tag: |
| 12 | + required: false |
| 13 | + type: string |
| 14 | + description: "Tag to checkout" |
| 15 | + runner: |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + default: "runner-4" |
| 19 | + description: "Runner to use for the build job" |
| 20 | + |
| 21 | +env: |
| 22 | + BUILD_TYPE: Release |
| 23 | + BUILD_DIR: "${{ github.workspace }}/_build" |
| 24 | + DEBIAN_FRONTEND: noninteractive |
| 25 | + MTL_BUILD_DISABLE_PCAPNG: true |
| 26 | + PREFIX_DIR: "${{ github.workspace }}/_install" |
| 27 | + |
| 28 | +defaults: |
| 29 | + run: |
| 30 | + shell: bash |
| 31 | + |
| 32 | +permissions: |
| 33 | + contents: read |
| 34 | + |
| 35 | +concurrency: |
| 36 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 37 | + cancel-in-progress: true |
| 38 | + |
| 39 | +jobs: |
| 40 | + build-baremetal-ubuntu: |
| 41 | + runs-on: ${{ inputs.runner }} |
| 42 | + timeout-minutes: 120 |
| 43 | + steps: |
| 44 | + - name: "Harden Runner" |
| 45 | + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 |
| 46 | + with: |
| 47 | + egress-policy: audit |
| 48 | + - name: "Fix permissions before checkout" |
| 49 | + run: | |
| 50 | + if [ -d "${{ github.workspace }}" ]; then |
| 51 | + sudo chown -R "${USER}" "${{ github.workspace }}" || true |
| 52 | + sudo chmod -R u+w "${{ github.workspace }}" || true |
| 53 | + fi |
| 54 | +
|
| 55 | + - name: "Checkout repository" |
| 56 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 57 | + with: |
| 58 | + ref: ${{ inputs.tag || inputs.branch }} |
| 59 | + |
| 60 | + - name: "Install OS level dependencies" |
| 61 | + run: eval 'source scripts/setup_build_env.sh && install_package_dependencies' |
| 62 | + |
| 63 | + - name: "Check local dependencies build cache" |
| 64 | + id: load-local-dependencies-cache |
| 65 | + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
| 66 | + with: |
| 67 | + path: ${{ env.BUILD_DIR }} |
| 68 | + key: ${{ runner.os }}-${{ hashFiles('versions.env') }}-${{ hashFiles('scripts/setup*.sh') }} |
| 69 | + |
| 70 | + - name: "Download, unpack and patch build dependencies" |
| 71 | + if: steps.load-local-dependencies-cache.outputs.cache-hit != 'true' |
| 72 | + run: eval 'source scripts/setup_build_env.sh && get_download_unpack_dependencies' |
| 73 | + |
| 74 | + - name: "Clone and patch ffmpeg 7.0" |
| 75 | + if: steps.load-local-dependencies-cache.outputs.cache-hit != 'true' |
| 76 | + run: | |
| 77 | + ffmpeg-plugin/clone-and-patch-ffmpeg.sh "7.0" |
| 78 | +
|
| 79 | + - name: "Build and Install xdp and libbpf" |
| 80 | + run: eval 'source scripts/setup_build_env.sh && lib_install_xdp_bpf_tools' |
| 81 | + |
| 82 | + - name: "Build and Install libfabric" |
| 83 | + run: eval 'source scripts/setup_build_env.sh && lib_install_fabrics' |
| 84 | + |
| 85 | + - name: "Build and Install the DPDK (skipped: already installed on runner)" |
| 86 | + if: always() && false # Always skip this step for now |
| 87 | + run: | |
| 88 | + echo "Skipping DPDK build and install as it is already installed on the machine." |
| 89 | + # eval 'source scripts/setup_build_env.sh && lib_install_dpdk' |
| 90 | +
|
| 91 | + - name: "Check if DPDK version needs to be updated" |
| 92 | + id: check_dpdk_version |
| 93 | + run: | |
| 94 | + if grep -q "DPDK_VER=25.03" "${{ github.workspace }}/versions.env" && \ |
| 95 | + grep -q "DPDK_VER=25.03" "${{ github.workspace }}/ffmpeg-plugin/versions.env" && \ |
| 96 | + grep -q "DPDK_VER=25.03" "${{ github.workspace }}/media-proxy/versions.env" && \ |
| 97 | + grep -q "DPDK_VER=25.03" "${{ github.workspace }}/sdk/versions.env"; then |
| 98 | + echo "DPDK version is already set correctly." |
| 99 | + echo "need_update=false" >> "$GITHUB_OUTPUT" |
| 100 | + else |
| 101 | + echo "DPDK version needs to be updated." |
| 102 | + echo "need_update=true" >> "$GITHUB_OUTPUT" |
| 103 | + fi |
| 104 | +
|
| 105 | + - name: "Switch DPDK version to currently used on the machine" |
| 106 | + if: steps.check_dpdk_version.outputs.need_update == 'true' |
| 107 | + run: | |
| 108 | + sed -i 's|DPDK_VER=23.11|DPDK_VER=25.03|g' \ |
| 109 | + "${{ github.workspace }}/versions.env" \ |
| 110 | + "${{ github.workspace }}/ffmpeg-plugin/versions.env" \ |
| 111 | + "${{ github.workspace }}/media-proxy/versions.env" \ |
| 112 | + "${{ github.workspace }}/sdk/versions.env" |
| 113 | +
|
| 114 | + - name: "Check if MTL version needs to be updated" |
| 115 | + id: check_mtl_version |
| 116 | + run: | |
| 117 | + if grep -q "MTL_VER=main" "${{ github.workspace }}/versions.env" && \ |
| 118 | + grep -q "MTL_VER=main" "${{ github.workspace }}/ffmpeg-plugin/versions.env" && \ |
| 119 | + grep -q "MTL_VER=main" "${{ github.workspace }}/media-proxy/versions.env" && \ |
| 120 | + grep -q "MTL_VER=main" "${{ github.workspace }}/sdk/versions.env"; then |
| 121 | + echo "MTL version is already set correctly." |
| 122 | + echo "need_update=false" >> "$GITHUB_OUTPUT" |
| 123 | + else |
| 124 | + echo "MTL version needs to be updated." |
| 125 | + echo "need_update=true" >> "$GITHUB_OUTPUT" |
| 126 | + fi |
| 127 | +
|
| 128 | + - name: "Switch MTL version to currently used on the machine" |
| 129 | + if: steps.check_mtl_version.outputs.need_update == 'true' |
| 130 | + run: | |
| 131 | + sed -i 's|MTL_VER=v25.02|MTL_VER=main|g' \ |
| 132 | + "${{ github.workspace }}/versions.env" \ |
| 133 | + "${{ github.workspace }}/ffmpeg-plugin/versions.env" \ |
| 134 | + "${{ github.workspace }}/media-proxy/versions.env" \ |
| 135 | + "${{ github.workspace }}/sdk/versions.env" |
| 136 | +
|
| 137 | + - name: "Build and Install the MTL(skipped: already installed on runner)" |
| 138 | + if: always() && false # Always skip this step for now |
| 139 | + run: | |
| 140 | + echo "Skipping MTL build and install as it is already installed on the machine." |
| 141 | + # eval 'source scripts/setup_build_env.sh && lib_install_mtl' |
| 142 | +
|
| 143 | + - name: "Build and Install JPEG XS" |
| 144 | + run: eval 'source scripts/setup_build_env.sh && lib_install_jpeg_xs' |
| 145 | + |
| 146 | + - name: "Build and Install JPEG XS ffmpeg plugin" |
| 147 | + run: eval 'source scripts/setup_build_env.sh && lib_install_mtl_jpeg_xs_plugin' |
| 148 | + |
| 149 | + - name: "Build gRPC and dependencies" |
| 150 | + run: eval 'source scripts/setup_build_env.sh && lib_install_grpc' |
| 151 | + |
| 152 | + - name: "Build MCM SDK and Media Proxy" |
| 153 | + run: eval 'source scripts/common.sh && ./build.sh "${PREFIX_DIR}"' |
| 154 | + |
| 155 | + - name: "Build FFmpeg 7.0 with MCM plugin" |
| 156 | + working-directory: ${{ github.workspace }}/ffmpeg-plugin |
| 157 | + run: | |
| 158 | + ./configure-ffmpeg.sh "7.0" --prefix=${{ env.BUILD_DIR }}/ffmpeg-7-0 --disable-doc --disable-debug && \ |
| 159 | + ./build-ffmpeg.sh "7.0" |
| 160 | +
|
| 161 | + - name: Install RxTxApp dependencies |
| 162 | + run: sudo apt-get update && sudo apt-get install -y libjansson-dev |
| 163 | + - name: "build RxTxApp" |
| 164 | + working-directory: ${{ github.workspace }}/tests/tools/TestApp |
| 165 | + run: | |
| 166 | + rm -rf build && \ |
| 167 | + mkdir build && cd build && \ |
| 168 | + cmake .. && \ |
| 169 | + make |
| 170 | + - name: "clone FFMPEG repository" |
| 171 | + run: | |
| 172 | + echo "Cloning FFMPEG repository" |
| 173 | + - name: "clone MTL repository" |
| 174 | + run: | |
| 175 | + echo "Cloning MTL repository" |
| 176 | + - name: "build MTL FFMPEG" |
| 177 | + run: | |
| 178 | + echo "Building MTL FFMPEG" |
| 179 | +
|
| 180 | + - name: "upload media-proxy and mcm binaries" |
| 181 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 |
| 182 | + with: |
| 183 | + name: mcm-build |
| 184 | + path: | |
| 185 | + ${{ env.BUILD_DIR }}/mcm/bin/media_proxy |
| 186 | + ${{ env.BUILD_DIR }}/mcm/bin/mesh-agent |
| 187 | + ${{ env.BUILD_DIR }}/mcm/lib/libmcm_dp.so.* |
| 188 | + ${{ env.BUILD_DIR }}/ffmpeg-7-0/ffmpeg |
| 189 | + ${{ env.BUILD_DIR }}/ffmpeg-7-0/lib/** |
0 commit comments