aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 3df16e5a91539181f87ad34342e12151718c0596 (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
name: Build
on:
  - push
  - pull_request
  - workflow_dispatch
jobs:
  build:
    runs-on: ubuntu-20.04
    container:
      image: zmkfirmware/zmk-build-arm:2.4
    strategy:
      fail-fast: false
      matrix:
        include:
          - shield: corne_left
            board: nice_nano
          - shield: corne_right
            board: nice_nano
          - shield: microdox_left
            board: nice_nano
          - shield: microdox_right
            board: nice_nano
          - shield: qaz
            board: nice_nano
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Cache west modules
        uses: actions/cache@v2
        env:
          cache-name: cache-zephyr-modules
        with:
          path: |
            bootloader/
            modules/
            tools/
            zephyr/
            zmk/
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('config/west.yml') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-
        timeout-minutes: 2
        continue-on-error: true
      - name: Initialize workspace (west init)
        run: west init -l config
      - name: Update modules (west update)
        run: west update
      - name: Export Zephyr CMake package (west zephyr-export)
        run: west zephyr-export
      - name: Prepare variables
        id: variables
        run: |
          if [ -n "${{ matrix.shield }}" ]; then
            SHIELD_ARG="-DSHIELD=${{ matrix.shield }}"
            ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk"
          else
            SHIELD_ARG=
            ARTIFACT_NAME="${{ matrix.board }}-zmk"
          fi

          echo ::set-output name=shield-arg::${SHIELD_ARG}
          echo ::set-output name=artifact-name::${ARTIFACT_NAME}
      - name: Build (west build)
        run: west build -s zmk/app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }}
          -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
      - name: Generated DTS file
        if: always()
        run: cat -n build/zephyr/${{ matrix.board }}.dts.pre.tmp
      - name: Archive artifacts
        uses: actions/upload-artifact@v2
        with:
          name: ${{ steps.variables.outputs.artifact-name }}
          path: |
            build/zephyr/zmk.hex
            build/zephyr/zmk.uf2
        continue-on-error: true