|
| 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": ["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 | + ] |
| 105 | + },{ |
| 106 | + "machine": "lx2160a-rev2-clearfog-cx", |
| 107 | + "targets": ["fsl-image-networking", "fsl-image-networking-full"], |
| 108 | + "artifacts": [ |
| 109 | + "fsl-image-networking-lx2160a-rev2-clearfog-cx.rootfs.manifest", |
| 110 | + "fsl-image-networking-lx2160a-rev2-clearfog-cx.rootfs.wic.bmap", |
| 111 | + "fsl-image-networking-lx2160a-rev2-clearfog-cx.rootfs.wic.gz", |
| 112 | + "fsl-image-networking-full-lx2160a-rev2-clearfog-cx.rootfs.manifest", |
| 113 | + "fsl-image-networking-full-lx2160a-rev2-clearfog-cx.rootfs.wic.bmap", |
| 114 | + "fsl-image-networking-full-lx2160a-rev2-clearfog-cx.rootfs.wic.gz", |
| 115 | + "fsl-lx2160a-clearfog-cx.dtb", |
| 116 | + "Image.gz", |
| 117 | + "modules-lx2160a-rev2-clearfog-cx.tgz" |
| 118 | + ] |
| 119 | + },{ |
| 120 | + "machine": "lx2160a-rev2-half-twins", |
| 121 | + "targets": ["fsl-image-networking"], |
| 122 | + "artifacts": [ |
| 123 | + "fsl-image-networking-lx2160a-rev2-half-twins.rootfs.manifest", |
| 124 | + "fsl-image-networking-lx2160a-rev2-half-twins.rootfs.wic.bmap", |
| 125 | + "fsl-image-networking-lx2160a-rev2-half-twins.rootfs.wic.gz", |
| 126 | + "fsl-lx2160a-half-twins.dtb", |
| 127 | + "Image.gz", |
| 128 | + "modules-lx2160a-rev2-half-twins.tgz" |
| 129 | + ] |
| 130 | + },{ |
| 131 | + "machine": "lx2160a-rev2-honeycomb", |
| 132 | + "targets": ["fsl-image-networking", "fsl-image-networking-full"], |
| 133 | + "artifacts": [ |
| 134 | + "fsl-image-networking-lx2160a-rev2-honeycomb.rootfs.manifest", |
| 135 | + "fsl-image-networking-lx2160a-rev2-honeycomb.rootfs.wic.bmap", |
| 136 | + "fsl-image-networking-lx2160a-rev2-honeycomb.rootfs.wic.gz", |
| 137 | + "fsl-image-networking-full-lx2160a-rev2-honeycomb.rootfs.manifest", |
| 138 | + "fsl-image-networking-full-lx2160a-rev2-honeycomb.rootfs.wic.bmap", |
| 139 | + "fsl-image-networking-full-lx2160a-rev2-honeycomb.rootfs.wic.gz", |
| 140 | + "fsl-lx2160a-honeycomb.dtb", |
| 141 | + "Image.gz", |
| 142 | + "modules-lx2160a-rev2-honeycomb.tgz" |
| 143 | + ] |
| 144 | + },{ |
| 145 | + "machine": "lx2162a-rev2-clearfog", |
| 146 | + "targets": ["fsl-image-networking", "fsl-image-networking-full"], |
| 147 | + "artifacts": [ |
| 148 | + "fsl-image-networking-lx2162a-rev2-clearfog.rootfs.manifest", |
| 149 | + "fsl-image-networking-lx2162a-rev2-clearfog.rootfs.wic.bmap", |
| 150 | + "fsl-image-networking-lx2162a-rev2-clearfog.rootfs.wic.gz", |
| 151 | + "fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.manifest", |
| 152 | + "fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.wic.bmap", |
| 153 | + "fsl-image-networking-full-lx2162a-rev2-clearfog.rootfs.wic.gz", |
| 154 | + "fsl-lx2162a-clearfog.dtb", |
| 155 | + "Image.gz", |
| 156 | + "modules-lx2162a-rev2-clearfog.tgz" |
| 157 | + ] |
| 158 | + },{ |
| 159 | + "machine": "lx216xa-solidrun", |
| 160 | + "targets": ["fsl-image-networking", "fsl-image-networking-full"], |
| 161 | + "artifacts": [ |
| 162 | + "fsl-image-networking-lx216xa-solidrun.rootfs.manifest", |
| 163 | + "fsl-image-networking-lx216xa-solidrun.rootfs.wic.bmap", |
| 164 | + "fsl-image-networking-lx216xa-solidrun.rootfs.wic.gz", |
| 165 | + "fsl-image-networking-full-lx216xa-solidrun.rootfs.manifest", |
| 166 | + "fsl-image-networking-full-lx216xa-solidrun.rootfs.wic.bmap", |
| 167 | + "fsl-image-networking-full-lx216xa-solidrun.rootfs.wic.gz", |
| 168 | + "fsl-lx2160a-cex6-evb.dtb", |
| 169 | + "fsl-lx2160a-clearfog-cx.dtb", |
| 170 | + "fsl-lx2160a-half-twins.dtb", |
| 171 | + "fsl-lx2160a-honeycomb.dtb", |
| 172 | + "fsl-lx2162a-clearfog.dtb", |
| 173 | + "Image.gz", |
| 174 | + "modules-lx216xa-solidrun.tgz" |
| 175 | + ] |
| 176 | + } |
| 177 | + ] |
| 178 | + steps: |
| 179 | + - name: Checkout pull-request version of meta-solidrun-arm-lx2xx |
| 180 | + uses: actions/checkout@v4 |
| 181 | + with: |
| 182 | + path: sources/meta-solidrun-arm-lx2xxx |
| 183 | + |
| 184 | + - name: Checkout dependency layers |
| 185 | + shell: bash {0} |
| 186 | + run: | |
| 187 | + # initialise repo tool from base branch |
| 188 | + repo init -u https://github.com/SolidRun/meta-solidrun-arm-lx2xxx.git -b scarthgap -m ls-6.6.52-2.2.0-sr.xml |
| 189 | +
|
| 190 | + # overwrite manifest.xml with pull-request version |
| 191 | + 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 |
| 192 | +
|
| 193 | + # prevent repo tool from changing already downloaded pull-request version of this repository |
| 194 | + mkdir .repo/local_manifests |
| 195 | + echo "<manifest><remove-project name=\"meta-solidrun-arm-lx2xxx\"/></manifest>" > .repo/local_manifests/ignore_self.xml |
| 196 | +
|
| 197 | + # fetch all other layers from manifest |
| 198 | + repo sync |
| 199 | +
|
| 200 | + - name: Create cache dir |
| 201 | + run: mkdir -p buildcache |
| 202 | + |
| 203 | + - name: Fetch cache from server |
| 204 | + uses: tespkg/actions-cache/restore@v1 |
| 205 | + with: |
| 206 | + endpoint: ciserver.ci |
| 207 | + port: 9000 |
| 208 | + insecure: true |
| 209 | + accessKey: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 210 | + secretKey: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 211 | + bucket: cicache |
| 212 | + use-fallback: false |
| 213 | + key: ${{ github.repository }}/scarthgap |
| 214 | + path: | |
| 215 | + buildcache |
| 216 | +
|
| 217 | + - name: Configure |
| 218 | + shell: bash {0} |
| 219 | + run: | |
| 220 | + export EULA="1" |
| 221 | + BASEDIR=$PWD |
| 222 | + source ./setup-env -m lx2160ardb-rev2 -b build |
| 223 | + bitbake-layers add-layer $BASEDIR/sources/meta-solidrun-arm-lx2xxx |
| 224 | + echo "IMAGE_FSTYPES:append = \" wic.gz wic.bmap \"" |
| 225 | + echo "# break dependency cycle with core-image-minimal used as initramfs" |
| 226 | + echo "IMAGE_FSTYPES:remove:pn-core-image-minimal = \"wic.gz wic.bmap\"" >> conf/local.conf |
| 227 | + echo "require conf/includes/ci.conf" >> conf/local.conf |
| 228 | +
|
| 229 | + - name: Download Sources |
| 230 | + shell: bash {0} |
| 231 | + run: | |
| 232 | + source build/SOURCE_THIS |
| 233 | + export CACHE_DIR="$GITHUB_WORKSPACE/buildcache" |
| 234 | + export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CACHE_DIR" |
| 235 | +
|
| 236 | + echo "$TARGETS" | jq -c '.[]' | while read -r item; do |
| 237 | + machine=$(echo "$item" | jq -r '.machine') |
| 238 | + targets=($(echo "$item" | jq -r '.targets[]')) |
| 239 | +
|
| 240 | + env MACHINE="$machine" WKS_FILE="lx2160a-$type.wks.in" bitbake -k ${targets[@]} --runall=fetch |
| 241 | + done |
| 242 | + continue-on-error: true |
| 243 | + |
| 244 | + - name: Build |
| 245 | + if: ${{ !cancelled() }} |
| 246 | + id: build_step |
| 247 | + shell: bash {0} |
| 248 | + run: | |
| 249 | + source build/SOURCE_THIS |
| 250 | + export CACHE_DIR="$GITHUB_WORKSPACE/buildcache" |
| 251 | + export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CACHE_DIR" |
| 252 | +
|
| 253 | + echo "$TARGETS" | jq -c '.[]' | while read -r item; do |
| 254 | + machine=$(echo "$item" | jq -r '.machine') |
| 255 | + targets=($(echo "$item" | jq -r '.targets[]')) |
| 256 | +
|
| 257 | + env MACHINE="$machine" WKS_FILE="lx2160a-$type.wks.in" bitbake -k ${targets[@]} |
| 258 | + done |
| 259 | + continue-on-error: true |
| 260 | + |
| 261 | + - name: Update cache on the server (build may have failed) |
| 262 | + if: ${{ !cancelled() }} |
| 263 | + uses: tespkg/actions-cache/save@v1 |
| 264 | + with: |
| 265 | + endpoint: ciserver.ci |
| 266 | + port: 9000 |
| 267 | + insecure: true |
| 268 | + accessKey: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 269 | + secretKey: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 270 | + bucket: cicache |
| 271 | + use-fallback: false |
| 272 | + key: ${{ github.repository }}/scarthgap |
| 273 | + path: | |
| 274 | + buildcache |
| 275 | +
|
| 276 | + - name: Select artifacts for publishing |
| 277 | + if: ${{ (!cancelled()) && (steps.build_step.outcome == 'success') }} |
| 278 | + shell: bash -e {0} |
| 279 | + env: |
| 280 | + MACHINE: ${{ matrix.machine }} |
| 281 | + ARTIFACTS: ${{ join(matrix.publish_artifacts, ' ') }} |
| 282 | + run: | |
| 283 | + echo "$TARGETS" | jq -c '.[]' | while read -r item; do |
| 284 | + machine=$(echo "$item" | jq -r '.machine') |
| 285 | + artifacts=($(echo "$item" | jq -r '.artifacts[]')) |
| 286 | +
|
| 287 | + ls -lh build/tmp/deploy/images/$machine/ |
| 288 | + mkdir -p deploy/$MACHINE |
| 289 | + cp -v -L ${artifacts[@]} deploy/$MACHINE/ |
| 290 | + ls -lh deploy/$MACHINE/ |
| 291 | + done |
| 292 | +
|
| 293 | + - name: Deploy to the local minio storage |
| 294 | + if: ${{ (!cancelled()) && (steps.build_step.outcome == 'success') }} |
| 295 | + uses: yakubique/minio-upload@v1.1.3 |
| 296 | + with: |
| 297 | + endpoint: http://ciserver.ci:9000 |
| 298 | + insecure: true |
| 299 | + access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 300 | + secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 301 | + bucket: cipublish |
| 302 | + source: ./deploy/ |
| 303 | + "target": "/${{ needs.info.outputs.local_artifacts_path }}/" |
| 304 | + recursive: true |
| 305 | + |
| 306 | + - name: Fail Late |
| 307 | + if: ${{ steps.build_step.outcome == 'failure' }} |
| 308 | + shell: bash {0} |
| 309 | + run: exit 1 |
| 310 | + |
| 311 | + test_images: |
| 312 | + name: Test on Hardware |
| 313 | + needs: |
| 314 | + - info |
| 315 | + - build |
| 316 | + runs-on: self-hosted |
| 317 | + timeout-minutes: 90 |
| 318 | + |
| 319 | + steps: |
| 320 | + - name: Generate Temporary Image Download URLs |
| 321 | + id: dl_url |
| 322 | + shell: bash {0} |
| 323 | + run: | |
| 324 | + 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" |
| 325 | + 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" |
| 326 | +
|
| 327 | + - name: Checkout LAVA action |
| 328 | + uses: actions/checkout@v4 |
| 329 | + with: |
| 330 | + repository: SolidRun/lava-test-definitions |
| 331 | + path: .lava-action |
| 332 | + ssh-key: ${{ secrets.LAVA_ACTION_SECRET }} |
| 333 | + |
| 334 | + - name: Test Images on LAVA |
| 335 | + id: submit |
| 336 | + uses: ./.lava-action/.github/actions/lava-submit |
| 337 | + with: |
| 338 | + server: 192.168.15.184 |
| 339 | + port: 8001 |
| 340 | + timeout: 36000 |
| 341 | + jobs: | |
| 342 | + [ |
| 343 | + { |
| 344 | + "device_type": "lx2162a-solidrun", |
| 345 | + "tags": [], |
| 346 | + "image_url": "${{ steps.dl_url.outputs.lx2162a_rev2_clearfog_fsl_image_networking_url }}", |
| 347 | + "description": "LX2162A Clearfog Yocto - FSL Network - meta-solidrun-armlx2xxx/${{ needs.info.outputs.build_ref }} (${{ needs.info.outputs.build_rev }})", |
| 348 | + "compression": "xz", |
| 349 | + "all_devices": false |
| 350 | + },{ |
| 351 | + "device_type": "lx2162a-solidrun", |
| 352 | + "tags": [], |
| 353 | + "image_url": "${{ steps.dl_url.outputs.lx2162a_rev2_clearfog_fsl_image_networking_full_url }}", |
| 354 | + "description": "LX2162A Clearfog Yocto - FSL Network Full - meta-solidrun-armlx2xxx/${{ needs.info.outputs.build_ref }} (${{ needs.info.outputs.build_rev }})", |
| 355 | + "compression": "xz", |
| 356 | + "all_devices": false |
| 357 | + } |
| 358 | + ] |
0 commit comments