|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["scarthgap"] |
| 6 | + pull_request: |
| 7 | + branches: ["scarthgap"] |
| 8 | + schedule: |
| 9 | + - cron: "0 0 * * 5" |
| 10 | + # Allows you to run this workflow manually from the Actions tab |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + prepare_container: |
| 15 | + name: Prepare Build Container |
| 16 | + runs-on: self-hosted |
| 17 | + timeout-minutes: 30 |
| 18 | + outputs: |
| 19 | + uid: ${{ steps.uid_step.outputs.userid }} |
| 20 | + gid: ${{ steps.uid_step.outputs.groupid }} |
| 21 | + steps: |
| 22 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Get user id/group |
| 26 | + id: uid_step |
| 27 | + run: | |
| 28 | + echo "userid=$(id -u)" >> "$GITHUB_OUTPUT" |
| 29 | + echo "groupid=$(id -g)" >> "$GITHUB_OUTPUT" |
| 30 | +
|
| 31 | + - name: Set up Docker Buildx |
| 32 | + uses: docker/setup-buildx-action@v3 |
| 33 | + with: |
| 34 | + buildkitd-config: /etc/docker/cibuilder.toml |
| 35 | + |
| 36 | + - name: Login to Docker Registry |
| 37 | + uses: docker/login-action@v3 |
| 38 | + with: |
| 39 | + registry: ciserver.ci:5000 |
| 40 | + username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }} |
| 41 | + password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }} |
| 42 | + |
| 43 | + - name: Build and push |
| 44 | + uses: docker/build-push-action@v5 |
| 45 | + with: |
| 46 | + context: . |
| 47 | + push: true |
| 48 | + tags: ciserver.ci:5000/${{ github.repository_id }}/scarthgap:latest |
| 49 | + cache-from: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache-scarthgap |
| 50 | + cache-to: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache-scarthgap,mode=max |
| 51 | + file: conf/docker/Dockerfile |
| 52 | + build-args: | |
| 53 | + USER_ID=${{ steps.uid_step.outputs.userid }} |
| 54 | + GROUP_ID=${{ steps.uid_step.outputs.groupid }} |
| 55 | +
|
| 56 | + info: |
| 57 | + name: Collect Build Info |
| 58 | + runs-on: self-hosted |
| 59 | + timeout-minutes: 10 |
| 60 | + outputs: |
| 61 | + build_date: ${{ steps.tag_step.outputs.build_date }} |
| 62 | + build_rev: ${{ steps.tag_step.outputs.build_rev }} |
| 63 | + build_ref: ${{ steps.tag_step.outputs.build_ref }} |
| 64 | + build_tag: ${{ steps.tag_step.outputs.build_date }}_${{ steps.tag_step.outputs.build_rev }} |
| 65 | + local_artifacts_path: ${{ github.repository_id }}/${{ steps.tag_step.outputs.build_date }}_${{ steps.tag_step.outputs.build_rev }} |
| 66 | + steps: |
| 67 | + - name: Generate build tags |
| 68 | + shell: bash {0} |
| 69 | + id: tag_step |
| 70 | + run: | |
| 71 | + build_date="$(date +%Y-%m-%d)" |
| 72 | + build_rev="$(echo ${GITHUB_SHA} | head -zc 7)" |
| 73 | + build_ref="${GITHUB_REF}" |
| 74 | + echo "build_date=$build_date" >> "$GITHUB_OUTPUT" |
| 75 | + echo "build_rev=$build_rev" >> "$GITHUB_OUTPUT" |
| 76 | + echo "build_ref=$build_ref" >> "$GITHUB_OUTPUT" |
| 77 | +
|
| 78 | + build: |
| 79 | + name: Build |
| 80 | + needs: |
| 81 | + - prepare_container |
| 82 | + - info |
| 83 | + runs-on: self-hosted |
| 84 | + timeout-minutes: 300 |
| 85 | + container: |
| 86 | + image: ciserver.ci:5000/${{ github.repository_id }}/scarthgap:latest |
| 87 | + credentials: |
| 88 | + username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }} |
| 89 | + password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }} |
| 90 | + options: --user developer |
| 91 | + env: |
| 92 | + TARGETS: | |
| 93 | + [ |
| 94 | + { |
| 95 | + "machine": "lx2160a-rev2-cex6-evb", |
| 96 | + "targets": ["lx216xa-xspi-image", "fsl-image-networking"], |
| 97 | + "artifacts": [ |
| 98 | + "fsl-image-networking-lx2160a-rev2-cex6-evb.rootfs.manifest", |
| 99 | + "fsl-image-networking-lx2160a-rev2-cex6-evb.rootfs.wic.bmap", |
| 100 | + "fsl-image-networking-lx2160a-rev2-cex6-evb.rootfs.wic.gz", |
| 101 | + "fsl-lx2160a-cex6-evb.dtb", |
| 102 | + "Image.gz", |
| 103 | + "modules-lx2160a-rev2-cex6-evb.tgz", |
| 104 | + "xspi.bin" |
| 105 | + ] |
| 106 | + },{ |
| 107 | + "machine": "lx2160a-rev2-clearfog-cx", |
| 108 | + "targets": ["lx216xa-xspi-image", "fsl-image-networking", "fsl-image-networking-full"], |
| 109 | + "artifacts": [ |
| 110 | + "fsl-image-networking-lx2160a-rev2-clearfog-cx.rootfs.manifest", |
| 111 | + "fsl-image-networking-lx2160a-rev2-clearfog-cx.rootfs.wic.bmap", |
| 112 | + "fsl-image-networking-lx2160a-rev2-clearfog-cx.rootfs.wic.gz", |
| 113 | + "fsl-image-networking-full-lx2160a-rev2-clearfog-cx.rootfs.manifest", |
| 114 | + "fsl-image-networking-full-lx2160a-rev2-clearfog-cx.rootfs.wic.bmap", |
| 115 | + "fsl-image-networking-full-lx2160a-rev2-clearfog-cx.rootfs.wic.gz", |
| 116 | + "fsl-lx2160a-clearfog-cx.dtb", |
| 117 | + "Image.gz", |
| 118 | + "modules-lx2160a-rev2-clearfog-cx.tgz", |
| 119 | + "xspi.bin" |
| 120 | + ] |
| 121 | + },{ |
| 122 | + "machine": "lx2160a-rev2-half-twins", |
| 123 | + "targets": ["lx216xa-xspi-image", "fsl-image-networking"], |
| 124 | + "artifacts": [ |
| 125 | + "fsl-image-networking-lx2160a-rev2-half-twins.rootfs.manifest", |
| 126 | + "fsl-image-networking-lx2160a-rev2-half-twins.rootfs.wic.bmap", |
| 127 | + "fsl-image-networking-lx2160a-rev2-half-twins.rootfs.wic.gz", |
| 128 | + "fsl-lx2160a-half-twins.dtb", |
| 129 | + "Image.gz", |
| 130 | + "modules-lx2160a-rev2-half-twins.tgz", |
| 131 | + "xspi.bin" |
| 132 | + ] |
| 133 | + },{ |
| 134 | + "machine": "lx2160a-rev2-honeycomb", |
| 135 | + "targets": ["lx216xa-xspi-image", "fsl-image-networking", "fsl-image-networking-full"], |
| 136 | + "artifacts": [ |
| 137 | + "fsl-image-networking-lx2160a-rev2-honeycomb.rootfs.manifest", |
| 138 | + "fsl-image-networking-lx2160a-rev2-honeycomb.rootfs.wic.bmap", |
| 139 | + "fsl-image-networking-lx2160a-rev2-honeycomb.rootfs.wic.gz", |
| 140 | + "fsl-image-networking-full-lx2160a-rev2-honeycomb.rootfs.manifest", |
| 141 | + "fsl-image-networking-full-lx2160a-rev2-honeycomb.rootfs.wic.bmap", |
| 142 | + "fsl-image-networking-full-lx2160a-rev2-honeycomb.rootfs.wic.gz", |
| 143 | + "fsl-lx2160a-honeycomb.dtb", |
| 144 | + "Image.gz", |
| 145 | + "modules-lx2160a-rev2-honeycomb.tgz", |
| 146 | + "xspi.bin" |
| 147 | + ] |
| 148 | + },{ |
| 149 | + "machine": "lx2162a-rev2-clearfog", |
| 150 | + "targets": ["lx216xa-xspi-image", "fsl-image-networking", "fsl-image-networking-full"], |
| 151 | + "artifacts": [ |
| 152 | + "fsl-image-networking-lx2162a-rev2-clearfog.rootfs.manifest", |
| 153 | + "fsl-image-networking-lx2162a-rev2-clearfog.rootfs.wic.bmap", |
| 154 | + "fsl-image-networking-lx2162a-rev2-clearfog.rootfs.wic.gz", |
| 155 | + "fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.manifest", |
| 156 | + "fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.wic.bmap", |
| 157 | + "fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.wic.gz", |
| 158 | + "fsl-lx2162a-clearfog.dtb", |
| 159 | + "Image.gz", |
| 160 | + "modules-lx2162a-rev2-clearfog.tgz", |
| 161 | + "xspi.bin" |
| 162 | + ] |
| 163 | + } |
| 164 | + ] |
| 165 | + steps: |
| 166 | + - name: Checkout pull-request version of meta-solidrun-arm-lx2xx |
| 167 | + uses: actions/checkout@v4 |
| 168 | + with: |
| 169 | + path: sources/meta-solidrun-arm-lx2xxx |
| 170 | + |
| 171 | + - name: Checkout dependency layers |
| 172 | + shell: bash {0} |
| 173 | + run: | |
| 174 | + # initialise repo tool from base branch |
| 175 | + repo init -u https://github.com/SolidRun/meta-solidrun-arm-lx2xxx.git -b scarthgap -m ls-6.6.52-2.2.0-sr.xml |
| 176 | +
|
| 177 | + # overwrite manifest.xml with pull-request version |
| 178 | + cp sources/meta-solidrun-arm-lx2xxx/ls-6.6.52-2.2.0-sr.xml .repo/manifests/ls-6.6.52-2.2.0-sr.xml |
| 179 | +
|
| 180 | + # prevent repo tool from changing already downloaded pull-request version of this repository |
| 181 | + mkdir .repo/local_manifests |
| 182 | + echo "<manifest><remove-project name=\"meta-solidrun-arm-lx2xxx\"/></manifest>" > .repo/local_manifests/ignore_self.xml |
| 183 | +
|
| 184 | + # fetch all other layers from manifest |
| 185 | + repo sync |
| 186 | +
|
| 187 | + - name: Create cache dir |
| 188 | + run: mkdir -p buildcache |
| 189 | + |
| 190 | + - name: Fetch cache from server |
| 191 | + uses: tespkg/actions-cache/restore@v1 |
| 192 | + with: |
| 193 | + endpoint: ciserver.ci |
| 194 | + port: 9000 |
| 195 | + insecure: true |
| 196 | + accessKey: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 197 | + secretKey: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 198 | + bucket: cicache |
| 199 | + use-fallback: false |
| 200 | + key: ${{ github.repository }}/scarthgap |
| 201 | + path: | |
| 202 | + buildcache |
| 203 | +
|
| 204 | + - name: Configure |
| 205 | + shell: bash {0} |
| 206 | + run: | |
| 207 | + export EULA="1" |
| 208 | + BASEDIR=$PWD |
| 209 | + source ./setup-env -m lx2160ardb-rev2 -b build |
| 210 | + bitbake-layers add-layer $BASEDIR/sources/meta-solidrun-arm-lx2xxx |
| 211 | + echo "TMPDIR = \"\${TOPDIR}/tmp-\${MACHINE}\"" >> conf/local.conf |
| 212 | + echo "IMAGE_FSTYPES:append = \" wic.gz wic.bmap \"" >> conf/local.conf |
| 213 | + echo "# break dependency cycle with core-image-minimal used as initramfs" >> conf/local.conf |
| 214 | + echo "IMAGE_FSTYPES:remove:pn-core-image-minimal = \"wic.gz wic.bmap\"" >> conf/local.conf |
| 215 | + echo "require conf/includes/ci.conf" >> conf/local.conf |
| 216 | +
|
| 217 | + - name: Download Sources |
| 218 | + shell: bash {0} |
| 219 | + run: | |
| 220 | + source build/SOURCE_THIS |
| 221 | + export CACHE_DIR="$GITHUB_WORKSPACE/buildcache" |
| 222 | + export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CACHE_DIR" |
| 223 | +
|
| 224 | + echo "$TARGETS" | jq -c '.[]' | while read -r item; do |
| 225 | + machine=$(echo "$item" | jq -r '.machine') |
| 226 | + targets=($(echo "$item" | jq -r '.targets[]')) |
| 227 | +
|
| 228 | + env MACHINE="$machine" WKS_FILE="lx2160a-$type.wks.in" bitbake -k ${targets[@]} --runall=fetch |
| 229 | + done |
| 230 | + continue-on-error: true |
| 231 | + |
| 232 | + - name: Build |
| 233 | + if: ${{ !cancelled() }} |
| 234 | + id: build_step |
| 235 | + shell: bash {0} |
| 236 | + run: | |
| 237 | + source build/SOURCE_THIS |
| 238 | + export CACHE_DIR="$GITHUB_WORKSPACE/buildcache" |
| 239 | + export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CACHE_DIR" |
| 240 | +
|
| 241 | + echo "$TARGETS" | jq -c '.[]' | while read -r item; do |
| 242 | + machine=$(echo "$item" | jq -r '.machine') |
| 243 | + targets=($(echo "$item" | jq -r '.targets[]')) |
| 244 | +
|
| 245 | + env MACHINE="$machine" WKS_FILE="lx2160a-$type.wks.in" bitbake -k ${targets[@]} |
| 246 | + done |
| 247 | + continue-on-error: true |
| 248 | + |
| 249 | + - name: Update cache on the server (build may have failed) |
| 250 | + if: ${{ !cancelled() }} |
| 251 | + uses: tespkg/actions-cache/save@v1 |
| 252 | + with: |
| 253 | + endpoint: ciserver.ci |
| 254 | + port: 9000 |
| 255 | + insecure: true |
| 256 | + accessKey: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 257 | + secretKey: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 258 | + bucket: cicache |
| 259 | + use-fallback: false |
| 260 | + key: ${{ github.repository }}/scarthgap |
| 261 | + path: | |
| 262 | + buildcache |
| 263 | +
|
| 264 | + - name: Select artifacts for publishing |
| 265 | + if: ${{ (!cancelled()) && (steps.build_step.outcome == 'success') }} |
| 266 | + shell: bash -e {0} |
| 267 | + run: | |
| 268 | + echo "$TARGETS" | jq -c '.[]' | while read -r item; do |
| 269 | + machine=$(echo "$item" | jq -r '.machine') |
| 270 | + artifacts=($(echo "$item" | jq -r '.artifacts[]')) |
| 271 | +
|
| 272 | + tmpdir=$PWD/build/tmp-$machine/deploy/images/$machine |
| 273 | + deploydir=$PWD/deploy/$machine |
| 274 | + mkdir -vp $deploydir |
| 275 | +
|
| 276 | + pushd $tmpdir |
| 277 | + ls -lh |
| 278 | + cp -v -L ${artifacts[@]} $deploydir/ |
| 279 | + popd |
| 280 | + done |
| 281 | +
|
| 282 | + - name: Deploy to the local minio storage |
| 283 | + if: ${{ (!cancelled()) && (steps.build_step.outcome == 'success') }} |
| 284 | + uses: yakubique/minio-upload@v1.1.3 |
| 285 | + with: |
| 286 | + endpoint: http://ciserver.ci:9000 |
| 287 | + insecure: true |
| 288 | + access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 289 | + secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 290 | + bucket: cipublish |
| 291 | + source: ./deploy/ |
| 292 | + "target": "/${{ needs.info.outputs.local_artifacts_path }}/" |
| 293 | + recursive: true |
| 294 | + |
| 295 | + - name: Fail Late |
| 296 | + if: ${{ steps.build_step.outcome == 'failure' }} |
| 297 | + shell: bash {0} |
| 298 | + run: exit 1 |
| 299 | + |
| 300 | + test_images: |
| 301 | + name: Test on Hardware |
| 302 | + needs: |
| 303 | + - info |
| 304 | + - build |
| 305 | + runs-on: self-hosted |
| 306 | + timeout-minutes: 90 |
| 307 | + |
| 308 | + steps: |
| 309 | + - name: Generate Temporary Image Download URLs |
| 310 | + id: dl_url |
| 311 | + shell: bash {0} |
| 312 | + run: | |
| 313 | + echo "lx2162a_rev2_clearfog_fsl_image_networking_url=http://ciserver.ci:8000/cipublish/${{ needs.build.outputs.local_artifacts_path }}/lx2162a-rev2-clearfog/fsl-image-networking-lx2162a-rev2-clearfog.rootfs.wic.gz" >> "$GITHUB_OUTPUT" |
| 314 | + echo "lx2162a_rev2_clearfog_fsl_image_networking_full_url=http://ciserver.ci:8000/cipublish/${{ needs.build.outputs.local_artifacts_path }}/lx2162a-rev2-clearfog/fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.wic.gz" >> "$GITHUB_OUTPUT" |
| 315 | +
|
| 316 | + - name: Checkout LAVA action |
| 317 | + uses: actions/checkout@v4 |
| 318 | + with: |
| 319 | + repository: SolidRun/lava-test-definitions |
| 320 | + path: .lava-action |
| 321 | + ssh-key: ${{ secrets.LAVA_ACTION_SECRET }} |
| 322 | + |
| 323 | + - name: Test Images on LAVA |
| 324 | + id: submit |
| 325 | + uses: ./.lava-action/.github/actions/lava-submit |
| 326 | + with: |
| 327 | + server: 192.168.15.184 |
| 328 | + port: 8001 |
| 329 | + timeout: 36000 |
| 330 | + jobs: | |
| 331 | + [ |
| 332 | + { |
| 333 | + "device_type": "lx2162a-solidrun", |
| 334 | + "tags": [], |
| 335 | + "image_url": "${{ steps.dl_url.outputs.lx2162a_rev2_clearfog_fsl_image_networking_url }}", |
| 336 | + "description": "LX2162A Clearfog Yocto - FSL Network - meta-solidrun-armlx2xxx/${{ needs.info.outputs.build_ref }} (${{ needs.info.outputs.build_rev }})", |
| 337 | + "compression": "xz", |
| 338 | + "all_devices": false |
| 339 | + },{ |
| 340 | + "device_type": "lx2162a-solidrun", |
| 341 | + "tags": [], |
| 342 | + "image_url": "${{ steps.dl_url.outputs.lx2162a_rev2_clearfog_fsl_image_networking_full_url }}", |
| 343 | + "description": "LX2162A Clearfog Yocto - FSL Network Full - meta-solidrun-armlx2xxx/${{ needs.info.outputs.build_ref }} (${{ needs.info.outputs.build_rev }})", |
| 344 | + "compression": "xz", |
| 345 | + "all_devices": false |
| 346 | + } |
| 347 | + ] |
0 commit comments