mirror of
https://github.com/qmk/.github.git
synced 2026-09-07 16:00:17 +02:00
95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
name: Build Binaries
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
qmk_repo:
|
|
description: "qmk_firmware repo to build against"
|
|
default: "qmk/qmk_firmware"
|
|
required: false
|
|
type: string
|
|
qmk_ref:
|
|
description: "qmk_firmware branch to build against"
|
|
default: "master"
|
|
required: false
|
|
type: string
|
|
preparation_command:
|
|
description: "command to execute before `qmk userspace-compile`"
|
|
default: ""
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Userspace Firmware
|
|
runs-on: ubuntu-latest
|
|
container: ghcr.io/qmk/qmk_cli:latest
|
|
|
|
steps:
|
|
- name: Checkout Userspace
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ github.token }}
|
|
submodules: recursive
|
|
|
|
- name: Check if qmk_firmware exists
|
|
id: check_files
|
|
uses: andstor/file-existence-action@v3
|
|
with:
|
|
files: qmk_firmware
|
|
|
|
- name: Checkout QMK Firmware
|
|
uses: actions/checkout@v4
|
|
if: steps.check_files.outputs.files_exists == 'false'
|
|
with:
|
|
token: ${{ github.token }}
|
|
path: qmk_firmware
|
|
repository: ${{ inputs.qmk_repo || 'qmk/qmk_firmware' }}
|
|
ref: ${{ inputs.qmk_ref || 'master' }}
|
|
submodules: recursive
|
|
|
|
- name: Install QMK CLI dependencies
|
|
run: |
|
|
echo '$PATH'
|
|
echo $PATH | tr ':' '\n' | sed -e 's/^/ - /g'
|
|
pip install -r qmk_firmware/requirements.txt
|
|
|
|
- name: Configure QMK CLI
|
|
run: |
|
|
qmk config userspace_compile.parallel=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
|
|
qmk config user.qmk_home=$GITHUB_WORKSPACE/qmk_firmware
|
|
qmk config user.overlay_dir=$GITHUB_WORKSPACE
|
|
|
|
- name: Validate userspace
|
|
run: |
|
|
qmk userspace-doctor
|
|
|
|
- name: Preparation command
|
|
if: inputs.preparation_command != ''
|
|
run: |
|
|
${{ inputs.preparation_command }}
|
|
|
|
- name: Build
|
|
run: |
|
|
qmk userspace-compile -e DUMP_CI_METADATA=yes || touch .failed
|
|
# Generate the step summary markdown
|
|
./qmk_firmware/util/ci/generate_failure_markdown.sh > $GITHUB_STEP_SUMMARY || true
|
|
# Truncate to a maximum of 1MB to deal with GitHub workflow limit
|
|
truncate --size='<960K' $GITHUB_STEP_SUMMARY || true
|
|
# Exit with failure if the compilation stage failed
|
|
[ ! -f .failed ] || exit 1
|
|
|
|
- name: Upload binaries
|
|
uses: actions/upload-artifact@v4
|
|
if: always() && !cancelled()
|
|
continue-on-error: true
|
|
with:
|
|
name: Firmware
|
|
path: |
|
|
*.bin
|
|
*.hex
|
|
*.uf2
|