1# SPDX-FileCopyrightText: Andrei Gherzan <andrei.gherzan@huawei.com>
2#
3# SPDX-License-Identifier: MIT
4
5name: Builds
6
7on:
8  pull_request:
9
10jobs:
11  build:
12    strategy:
13      fail-fast: true
14      matrix:
15        machine:
16          - raspberrypi
17          - raspberrypi0-2w-64
18          - raspberrypi0-2w
19          - raspberrypi0
20          - raspberrypi0-wifi
21          - raspberrypi2
22          - raspberrypi3-64
23          - raspberrypi3
24          - raspberrypi4-64
25          - raspberrypi4
26          - raspberrypi-cm3
27          - raspberrypi-cm
28        image: [rpi-test-image]
29        distro: [poky]
30    runs-on: [self-hosted, Linux]
31    name: ${{ matrix.machine }}/${{ matrix.image }}/poky/systemd
32    env:
33        DL_DIR: /var/lib/ci/yocto/downloads
34        SSTATE_DIR: /var/lib/ci/yocto/sstate
35    steps:
36      - name: Checkout the code
37        uses: actions/checkout@v2
38        with:
39          fetch-depth: 0
40      - name: Build a temporary yocto-builder image
41        uses: ./.github/actions/docker-build
42        with:
43          docker_image: yocto-builder
44          id: ${{ github.event.number }}
45      - name: Build the image
46        run: |
47          docker run --rm \
48            -v "$GITHUB_WORKSPACE:/work:ro" \
49            -v "$DL_DIR:$DL_DIR:rw" \
50            -v "$SSTATE_DIR:$SSTATE_DIR:rw" \
51            --env "BASE_REF=$GITHUB_BASE_REF" \
52            --env "MACHINE=${{ matrix.machine }}" \
53            --env "DISTRO=${{ matrix.distro }}" \
54            --env "IMAGE=${{ matrix.image }}" \
55            --env "DL_DIR=$DL_DIR" \
56            --env "SSTATE_DIR=$SSTATE_DIR" \
57            "yocto-builder-${{ github.event.number }}" \
58            /entrypoint-build.sh
59      - name: Cleanup temporary docker image
60        uses: ./.github/actions/docker-clean-image
61        with:
62          docker_image: yocto-builder-${{ github.event.number }}
63        if: always()
64      - name: Cleanup dangling docker images
65        uses: ./.github/actions/docker-clean-dangling
66        if: always()
67