|
| 1 | +name: yml-build-mesa-host |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + runner: |
| 6 | + description: "set runs-on for host arch" |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + debug: |
| 10 | + description: "Provide debug output from GHA run" |
| 11 | + #default: no_debug |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + ephemeral: |
| 15 | + description: "Target and build-root are ephemeral" |
| 16 | + #default: ephemeral |
| 17 | + required: true |
| 18 | + type: string |
| 19 | + upload_url: |
| 20 | + description: "Release upload url" |
| 21 | + required: true |
| 22 | + type: string |
| 23 | + buildcmd: |
| 24 | + description: "build command to run" |
| 25 | + #default: "make image" |
| 26 | + required: true |
| 27 | + type: string |
| 28 | + gitref: |
| 29 | + description: "git branch or hash to build" |
| 30 | + #default: libreelec-13.0 |
| 31 | + required: true |
| 32 | + type: string |
| 33 | + group: |
| 34 | + description: "concurrency group" |
| 35 | + #default: Generic_x86_64-10_0 |
| 36 | + required: true |
| 37 | + type: string |
| 38 | + project: |
| 39 | + description: "target project" |
| 40 | + #default: Generic |
| 41 | + required: true |
| 42 | + type: string |
| 43 | + arch: |
| 44 | + description: "target arch" |
| 45 | + #default: x86_64 |
| 46 | + required: true |
| 47 | + type: string |
| 48 | + device: |
| 49 | + description: "target device" |
| 50 | + default: "" |
| 51 | + required: false |
| 52 | + type: string |
| 53 | + targetbuilddir: |
| 54 | + description: "TARGETBUILDDIR" |
| 55 | + #default: "" |
| 56 | + required: true |
| 57 | + type: string |
| 58 | + version: |
| 59 | + description: "version code used in TARGETBUILDDIR" |
| 60 | + required: true |
| 61 | + type: string |
| 62 | + mesa: |
| 63 | + description: "mesa version we are building" |
| 64 | + required: true |
| 65 | + type: string |
| 66 | + |
| 67 | +env: |
| 68 | + BASEDIR: /var/media/DATA/github-actions |
| 69 | + # Distro Target Variables |
| 70 | + PROJECT: ${{ inputs.project }} |
| 71 | + ARCH: ${{ inputs.arch }} |
| 72 | + DEVICE: ${{ inputs.device }} |
| 73 | + TARGETBUILDDIR: ${{ inputs.targetbuilddir }} |
| 74 | + LE_DISTRO_VERSION: ${{ inputs.version }} |
| 75 | + MESA_VERSION: ${{ inputs.mesa }} |
| 76 | + |
| 77 | +concurrency: |
| 78 | + group: ${{ inputs.group }} |
| 79 | + cancel-in-progress: false |
| 80 | + |
| 81 | +jobs: |
| 82 | + build_image: |
| 83 | + runs-on: ${{ inputs.runner }} |
| 84 | + permissions: |
| 85 | + contents: write |
| 86 | + |
| 87 | + timeout-minutes: 360 |
| 88 | + |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + with: |
| 92 | + ref: ${{ inputs.gitref }} |
| 93 | + fetch-depth: 2 |
| 94 | + repository: "${{ github.repository_owner }}/LibreELEC.tv" |
| 95 | + path: "LibreELEC.tv" |
| 96 | + |
| 97 | + - name: Customise the checked out git repository |
| 98 | + run: | |
| 99 | + cd LibreELEC.tv |
| 100 | + sed -i -e "s/RUN useradd docker/RUN useradd docker -o -u $(id -u)/" tools/docker/noble/Dockerfile |
| 101 | + sed -i -e 's/BUILD_REUSABLE=""/BUILD_REUSABLE="mesa:host"/' distributions/LibreELEC/options |
| 102 | +
|
| 103 | + - name: Create docker image for build - tools/docker/noble |
| 104 | + run: | |
| 105 | + cd LibreELEC.tv |
| 106 | + docker build --pull -t gh-${{ github.run_id }} tools/docker/noble |
| 107 | +
|
| 108 | + - name: Prepare the LibreELEC.tv directory - do not leave files behind |
| 109 | + if: inputs.ephemeral == 'ephemeral' |
| 110 | + run: | |
| 111 | + cd LibreELEC.tv |
| 112 | + # set the build_dir=/build |
| 113 | + echo "build_dir=/build" >> $GITHUB_ENV |
| 114 | + echo "CCACHE_DISABLE=1" >> $GITHUB_ENV |
| 115 | +
|
| 116 | + - name: Display environment |
| 117 | + if: inputs.debug == 'debug' |
| 118 | + run: | |
| 119 | + cd LibreELEC.tv |
| 120 | + echo "pwd: $(pwd)" |
| 121 | + echo "id: $(id)" |
| 122 | + echo "whoami: $(whoami)" |
| 123 | + echo "docker images: $(docker images)" |
| 124 | + echo "" |
| 125 | + echo "inputs.debug: ${{ inputs.debug }}" |
| 126 | + echo "inputs.ephemeral: ${{ inputs.ephemeral }}" |
| 127 | +
|
| 128 | + - name: Build LE in docker container |
| 129 | + run: | |
| 130 | + cd LibreELEC.tv |
| 131 | + docker run --rm -v `pwd`:/build \ |
| 132 | + -w /build -i \ |
| 133 | + -e PROJECT=${{ env.PROJECT }} \ |
| 134 | + -e ARCH=${{ env.ARCH }} \ |
| 135 | + -e DEVICE=${{ env.DEVICE }} \ |
| 136 | + -e ONELOG=no -e LOGCOMBINE=fail \ |
| 137 | + -e BUILD_DIR=${{ env.build_dir }} \ |
| 138 | + -e BUILD_PERIODIC=nightly \ |
| 139 | + -e CCACHE_DISABLE=${{ env.CCACHE_DISABLE }} \ |
| 140 | + gh-${{ github.run_id }} ${{ inputs.buildcmd }} ${{ env.NOOBS }} |
| 141 | + continue-on-error: true |
| 142 | + |
| 143 | + - name: Prepare artifacts - ephemeral |
| 144 | + if: inputs.ephemeral == 'ephemeral' |
| 145 | + run: | |
| 146 | + cd LibreELEC.tv |
| 147 | + mkdir -p ${{ env.TARGETBUILDDIR }}/artifact |
| 148 | + grep ^FAIL ${{ env.TARGETBUILDDIR }}/.threads/joblog | \ |
| 149 | + awk '{ print $5, $12 }' | tr ':' '_' | \ |
| 150 | + while read failedpkg failedlog; do |
| 151 | + mv $(echo ${failedlog} | sed 's#/build/##') \ |
| 152 | + ${{ env.TARGETBUILDDIR }}/artifact/${{ env.TARGETBUILDDIR }}-${failedpkg}-$(echo ${failedlog} | sed 's#.*/##') |
| 153 | + done |
| 154 | +
|
| 155 | + - name: Upload failed artifacts - ephemeral |
| 156 | + if: inputs.ephemeral == 'ephemeral' |
| 157 | + uses: actions/upload-artifact@v4 |
| 158 | + with: |
| 159 | + name: ${{ inputs.group }}-failed |
| 160 | + path: LibreELEC.tv/${{ env.TARGETBUILDDIR }}/artifact/ |
| 161 | + if-no-files-found: ignore |
| 162 | + |
| 163 | + - name: Clean up - remove docker image tag |
| 164 | + run: | |
| 165 | + cd LibreELEC.tv |
| 166 | + docker image rm -f gh-${{ github.run_id }} |
| 167 | +
|
| 168 | + - name: List files in target |
| 169 | + run: | |
| 170 | + cd LibreELEC.tv |
| 171 | + ls -lah target/ |
| 172 | +
|
| 173 | + - name: upload reusable mesa:host tools |
| 174 | + uses: shogo82148/actions-upload-release-asset@v1 |
| 175 | + with: |
| 176 | + upload_url: ${{ inputs.upload_url }} |
| 177 | + asset_path: LibreELEC.tv/target/mesa-reusable-${{ inputs.version }}-${{ inputs.mesa }}-${{ inputs.arch }}.tar |
| 178 | + asset_content_type: application/tar |
| 179 | + github_token: ${{ github.token }} |
| 180 | + |
| 181 | + - name: upload reusable mesa:host tools sha256 |
| 182 | + uses: shogo82148/actions-upload-release-asset@v1 |
| 183 | + with: |
| 184 | + upload_url: ${{ inputs.upload_url }} |
| 185 | + asset_path: LibreELEC.tv/target/mesa-reusable-${{ inputs.version }}-${{ inputs.mesa }}-${{ inputs.arch }}.tar.sha256 |
| 186 | + asset_content_type: text/plain |
| 187 | + github_token: ${{ github.token }} |
0 commit comments