Replaced the run-test.sh script with a Python script that runs our unit tests through pytest. Tests are now run in parallel to speed up running the entire test suite, and it allows for integration with other tools that support pytest, such as IDEs. Also removed a dependency on remarshal, because it depends on an old version of PyYAML that conflicts with other Python packages in our Docker image. Replaced it with yq.
121 lines
3.8 KiB
YAML
121 lines
3.8 KiB
YAML
name: Reusable user config build
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
build_matrix_path:
|
|
description: "Path to the build matrix file"
|
|
default: "build.yaml"
|
|
required: false
|
|
type: string
|
|
config_path:
|
|
description: "Path to the config directory"
|
|
default: "config"
|
|
required: false
|
|
type: string
|
|
fallback_binary:
|
|
description: "Fallback binary format, if no *.uf2 file was built"
|
|
default: "bin"
|
|
required: false
|
|
type: string
|
|
archive_name:
|
|
description: 'Archive output file name'
|
|
default: 'firmware'
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
matrix:
|
|
runs-on: ubuntu-latest
|
|
name: Fetch Build Keyboards
|
|
outputs:
|
|
build_matrix: ${{ steps.fetch_build_matrix.outputs.result }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Fetch Build Matrix
|
|
id: fetch_build_matrix
|
|
uses: mikefarah/yq@v4.30.8
|
|
with:
|
|
cmd: yq -o json ${{ inputs.build_matrix_path }}
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: zmkfirmware/zmk-build-arm:stable
|
|
needs: matrix
|
|
name: Build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }}
|
|
steps:
|
|
- name: Prepare variables
|
|
shell: sh -x {0}
|
|
run: |
|
|
if [ -n "${{ matrix.shield }}" ]
|
|
then
|
|
echo "extra_cmake_args=-DSHIELD=\"${{ matrix.shield }}\"" >> $GITHUB_ENV
|
|
echo "artifact_name=${{ matrix.shield }}-${{ matrix.board }}-zmk" >> $GITHUB_ENV
|
|
echo "display_name=${{ matrix.shield }} - ${{ matrix.board }}" >> $GITHUB_ENV
|
|
else
|
|
echo "extra_cmake_args=" >> $GITHUB_ENV
|
|
echo "artifact_name=${{ matrix.board }}-zmk" >> $GITHUB_ENV
|
|
echo "display_name=${{ matrix.board }}" >> $GITHUB_ENV
|
|
fi
|
|
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Cache west modules
|
|
uses: actions/cache@v3.0.11
|
|
continue-on-error: true
|
|
env:
|
|
cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
|
|
with:
|
|
path: |
|
|
modules/
|
|
tools/
|
|
zephyr/
|
|
bootloader/
|
|
zmk/
|
|
key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache_name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
|
|
- name: West Init
|
|
run: west init -l ${{ inputs.config_path }}
|
|
|
|
- name: West Update
|
|
run: west update
|
|
|
|
- name: West Zephyr export
|
|
run: west zephyr-export
|
|
|
|
- name: West Build (${{ env.display_name }})
|
|
shell: sh -x {0}
|
|
run: west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
|
|
|
|
- name: ${{ env.display_name }} Kconfig file
|
|
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort
|
|
|
|
- name: Rename artifacts
|
|
shell: sh -x {0}
|
|
run: |
|
|
mkdir build/artifacts
|
|
if [ -f build/zephyr/zmk.uf2 ]
|
|
then
|
|
cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2"
|
|
elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ]
|
|
then
|
|
cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
|
|
fi
|
|
|
|
- name: Archive (${{ env.display_name }})
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.archive_name }}
|
|
path: build/artifacts
|