Skip to content

Commit 9a67b25

Browse files
authored
Merge pull request #4 from elagil/add_reusable_user_config_workflow
ci: add reusable user-config workflow
2 parents 3d01b75 + f01bfea commit 9a67b25

File tree

1 file changed

+1
-86
lines changed

1 file changed

+1
-86
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,5 @@
11
on: [push, pull_request, workflow_dispatch]
22

3-
name: Build
4-
53
jobs:
6-
matrix:
7-
runs-on: ubuntu-latest
8-
name: Fetch Build Keyboards
9-
outputs:
10-
matrix: ${{ steps.set-matrix.outputs.matrix }}
11-
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v2
14-
- name: Install yaml2json
15-
run: python3 -m pip install remarshal
16-
- id: set-matrix
17-
name: Fetch Build Matrix
18-
run: |
19-
matrix=$(yaml2json build.yaml | jq -c .)
20-
yaml2json build.yaml
21-
echo "::set-output name=matrix::${matrix}"
224
build:
23-
runs-on: ubuntu-latest
24-
container:
25-
image: zmkfirmware/zmk-build-arm:stable
26-
needs: matrix
27-
name: Build
28-
strategy:
29-
fail-fast: false
30-
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
31-
steps:
32-
- name: Prepare variables
33-
id: variables
34-
run: |
35-
if [ -n "${{ matrix.shield }}" ]; then
36-
EXTRA_CMAKE_ARGS="-DSHIELD=${{ matrix.shield }}"
37-
ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk"
38-
DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}"
39-
else
40-
EXTRA_CMAKE_ARGS=
41-
DISPLAY_NAME="${{ matrix.board }}"
42-
ARTIFACT_NAME="${{ matrix.board }}-zmk"
43-
fi
44-
echo ::set-output name=extra-cmake-args::${EXTRA_CMAKE_ARGS}
45-
echo ::set-output name=artifact-name::${ARTIFACT_NAME}
46-
echo ::set-output name=display-name::${DISPLAY_NAME}
47-
- name: Checkout
48-
uses: actions/checkout@v2
49-
- name: Cache west modules
50-
uses: actions/cache@v2
51-
env:
52-
cache-name: cache-zephyr-modules
53-
with:
54-
path: |
55-
modules/
56-
tools/
57-
zephyr/
58-
bootloader/
59-
zmk/
60-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('manifest-dir/west.yml') }}
61-
restore-keys: |
62-
${{ runner.os }}-build-${{ env.cache-name }}-
63-
${{ runner.os }}-build-
64-
${{ runner.os }}-
65-
- name: West Init
66-
run: west init -l config
67-
- name: West Update
68-
run: west update
69-
- name: West Zephyr export
70-
run: west zephyr-export
71-
- name: West Build (${{ steps.variables.outputs.display-name }})
72-
run: |
73-
west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/config ${{ steps.variables.outputs.extra-cmake-args }} ${{ matrix.cmake-args }}
74-
- name: ${{ steps.variables.outputs.display-name }} Kconfig file
75-
run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$"
76-
- name: Rename artifacts
77-
run: |
78-
mkdir build/artifacts
79-
if [ -f build/zephyr/zmk.uf2 ]
80-
then
81-
cp build/zephyr/zmk.uf2 "build/artifacts/${{ steps.variables.outputs.artifact-name }}.uf2"
82-
elif [ -f build/zephyr/zmk.hex ]
83-
then
84-
cp build/zephyr/zmk.hex "build/artifacts/${{ steps.variables.outputs.artifact-name }}.hex"
85-
fi
86-
- name: Archive (${{ steps.variables.outputs.display-name }})
87-
uses: actions/upload-artifact@v2
88-
with:
89-
name: firmware
90-
path: build/artifacts
5+
uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main

0 commit comments

Comments
 (0)