summaryrefslogtreecommitdiff
path: root/meta-raspberrypi/.github/workflows/yocto-builds.yml
blob: d237f0ab39f0a699e3384c5f37c0c2597dd62e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# SPDX-FileCopyrightText: Andrei Gherzan <andrei.gherzan@huawei.com>
#
# SPDX-License-Identifier: MIT

---

name: Builds

on:
  pull_request:

jobs:
  build:
    strategy:
      fail-fast: true
      matrix:
        machine:
          - raspberrypi
          - raspberrypi0-2w-64
          - raspberrypi0-2w
          - raspberrypi0
          - raspberrypi0-wifi
          - raspberrypi2
          - raspberrypi3-64
          - raspberrypi3
          - raspberrypi4-64
          - raspberrypi4
          - raspberrypi-cm3
          - raspberrypi-cm
          - raspberrypi-armv7
          - raspberrypi-armv8
        image: [rpi-test-image]
        distro: [poky]
    runs-on: [self-hosted, Linux]
    name: ${{ matrix.machine }}/${{ matrix.image }}/poky/systemd
    env:
      DL_DIR: /var/lib/ci/yocto/downloads
      SSTATE_DIR: /var/lib/ci/yocto/sstate
    steps:
      - name: Checkout the code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Define Yocto build files
        id: changed-files-specific
        uses: tj-actions/changed-files@v24
        with:
          files: |
            .github/actions/**
            .github/workflows/docker-images/yocto-builder/**
            .github/workflows/docker-images/*.sh
            .github/workflows/yocto-builds.yml
            classes/**
            conf/**
            dynamic-layers/**
            files/**
            lib/**
            recipes-**
            wic/**
      - name: Build a temporary yocto-builder image
        uses: ./.github/actions/docker-build
        with:
          docker_image: yocto-builder
          id: ${{ github.event.number }}
        if: steps.changed-files-specific.outputs.any_changed == 'true'
      - name: Build the image
        run: |
          docker run --rm \
            -v "$GITHUB_WORKSPACE:/work:ro" \
            -v "$DL_DIR:$DL_DIR:rw" \
            -v "$SSTATE_DIR:$SSTATE_DIR:rw" \
            --env "BASE_REF=$GITHUB_BASE_REF" \
            --env "MACHINE=${{ matrix.machine }}" \
            --env "DISTRO=${{ matrix.distro }}" \
            --env "IMAGE=${{ matrix.image }}" \
            --env "DL_DIR=$DL_DIR" \
            --env "SSTATE_DIR=$SSTATE_DIR" \
            "yocto-builder-${{ github.event.number }}" \
            /entrypoint-build.sh
        if: steps.changed-files-specific.outputs.any_changed == 'true'
      - name: Cleanup temporary docker image
        uses: ./.github/actions/docker-clean-image
        with:
          docker_image: yocto-builder-${{ github.event.number }}
        if: always()
      - name: Cleanup dangling docker images
        uses: ./.github/actions/docker-clean-dangling
        if: always()