aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/build-template.yml
blob: 31184349e945131dd984cb62f20cb51468532ed7 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
on:
  workflow_call:
    inputs:
      host:
        required: true
        type: string
      images:
        required: true
        type: string
      machines:
        required: true
        type: string
      url:
        required: true
        type: string
      branch:
        required: true
        type: string
      ref:
        required: true
        type: string
      ref_type:
        type: string
        default: ref
    secrets:
      TUXSUITE_TOKEN:
        required: true

env:
  POKY_URL: https://git.yoctoproject.org/poky
  DISTRO: poky
  TCLIBC: glibc musl
  KERNELS: linaro-qcomlt yocto

jobs:
  build:
    name: ${{github.event_name}} - ${{github.ref}}
    runs-on: ubuntu-latest
    steps:
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: "3.x"
    - name: Install dependencies
      run: |
        python -m pip install --upgrade tuxsuite
    - name: Setup tux plan
      run: |
        cat << EOF > plan.yaml
        name: CI for ${{github.repository}}
        description: ${{github.workflow}} - ${{github.ref}}
        version: 1

        common: &commondata
          container: ${{inputs.host}}
          envsetup: poky/oe-init-build-env
          sources:
            git_trees:
              - branch: ${{inputs.branch}}
                url: $POKY_URL
              - ${{inputs.ref_type}}: ${{inputs.ref}}
                url: ${{inputs.url}}
          distro: $DISTRO
          target: ${{inputs.images}}
          bblayers_conf:
            - BBLAYERS += '../$(echo ${{github.repository}} | cut -d'/' -f2)'
          artifacts: []
        EOF

        for tclibc in ${TCLIBC}; do
        for kernel in ${KERNELS}; do
        cat << EOF >> plan.yaml
        ${tclibc}-${kernel}: &${tclibc}-${kernel}
          local_conf:
            - INHERIT += 'buildstats buildstats-summary'
            - INHERIT:remove = 'rm_work'
            - TCLIBC := '${tclibc}'
            - PREFERRED_PROVIDER_virtual/kernel := 'linux-${kernel}'
            - INITRAMFS_IMAGE ?= 'initramfs-rootfs-image'

        EOF
        done
        done

        cat << EOF >> plan.yaml
        jobs:
        EOF

        # FIXME: loop over kernels instead of hardcoding them, need to support armv7a and modem first
        for tclibc in ${TCLIBC}; do
        cat << EOF >> plan.yaml
          - name: ${tclibc}
            bakes:
        EOF
        for machine in ${{inputs.machines}}; do
        cat << EOF >> plan.yaml
              - { <<: [*commondata, *${tclibc}-linaro-qcomlt], machine: ${machine}, name: ${machine}-${tclibc} }
        EOF
        if [ "${machine}" = "qcom-armv8a" -a "${{inputs.branch}}" = "master" ] ; then
        cat << EOF >> plan.yaml
              - { <<: [*commondata, *${tclibc}-yocto], machine: qcom-armv8a, name: qcom-armv8a-${tclibc}-yocto }
        EOF
        fi
        done
        done

        echo "Ready to submit this Tux Plan:"
        cat plan.yaml
    - name: Run build
      run: |
        tuxsuite plan plan.yaml
      env:
        TUXSUITE_TOKEN: ${{ secrets.TUXSUITE_TOKEN }}