Build Yocto Images #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Yocto Images | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: ${{ matrix.machine }}/${{ matrix.image }} | |
| runs-on: [self-hosted, yocto-runner] | |
| env: | |
| DL_DIR: /cache/yocto/downloads | |
| SSTATE_DIR: /cache/yocto/sstate-cache | |
| REPOS_DIR: /cache/repos | |
| ARTIFACTS_DIR: /work/artifacts | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| machine: | |
| - beagley-ai | |
| - intel-corei7-64 | |
| - t3-gem-o1 | |
| image: [gemstone-image-rd] | |
| steps: | |
| - name: Create volume and directory structure | |
| run: | | |
| out=$(docker volume ls --quiet --filter name=ci-yocto-cache) | |
| if [ -z "$out" ]; then | |
| docker volume create ci-yocto-cache | |
| docker run \ | |
| --rm \ | |
| --volume ci-yocto-cache:/cache \ | |
| alpine:3.22 \ | |
| sh -c 'mkdir -p /cache/repos /cache/yocto && chown -R 1000:1000 /cache' | |
| else | |
| echo "Volume already exist. Skipping..." | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Check for changed files | |
| id: changed-files-specific | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| since_last_remote_commit: true | |
| files: | | |
| .github/actions/** | |
| .github/workflows/yocto-builder/** | |
| .github/workflows/build-yocto.yml | |
| repos.yml | |
| - name: Build a yocto-builder image if required | |
| uses: ./.github/actions/docker-build | |
| with: | |
| docker_image: yocto-builder | |
| id: 1 | |
| if: steps.changed-files-specific.outputs.any_changed == 'true' | |
| - name: Build the image | |
| run: | | |
| docker run --rm --security-opt apparmor=unconfined \ | |
| --security-opt seccomp=unconfined \ | |
| -v "$GITHUB_WORKSPACE:/work" \ | |
| -v "ci-yocto-cache:/cache:rw" \ | |
| --env "MACHINE=${{ matrix.machine }}" \ | |
| --env "IMAGE=${{ matrix.image }}" \ | |
| --env "DL_DIR=$DL_DIR" \ | |
| --env "SSTATE_DIR=$SSTATE_DIR" \ | |
| --env "REPOS_DIR=$REPOS_DIR" \ | |
| --env "ARTIFACTS_DIR=$ARTIFACTS_DIR" \ | |
| --ulimit "nofile=1024:1048576" \ | |
| "yocto-builder-1" \ | |
| /entrypoint.sh | |
| if: steps.changed-files-specific.outputs.any_changed == 'true' | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: yocto-${{ matrix.machine }}-${{ matrix.image }} | |
| path: ${{ github.workspace }}/artifacts/${{ matrix.machine }}-${{ matrix.image }} | |
| - name: Cleanup temporary docker image | |
| uses: ./.github/actions/docker-clean-image | |
| with: | |
| docker_image: yocto-builder-1 | |
| if: always() | |
| - name: Cleanup dangling docker images | |
| uses: ./.github/actions/docker-clean-dangling | |
| if: always() |