Userspace workflow.

This commit is contained in:
Nick Brassel 2023-09-03 17:28:39 +10:00
parent da39824043
commit 926ad82367
No known key found for this signature in database

View File

@ -0,0 +1,105 @@
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
permissions:
contents: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: qmkfm/base_container
steps:
- name: Checkout Userspace
uses: actions/checkout@v3
with:
path: userspace
submodules: recursive
# This doesn't use actions/checkout as we want to allow qmk_firmware as a submodule
- name: Checkout QMK Firmware
run: |
if [ ! -d qmk_firmware ]; then
git clone -b ${{ inputs.qmk_ref || 'master' }} \
--depth=1000 --recurse-submodules --shallow-submodules \
https://github.com/${{ inputs.qmk_repo || 'qmk/qmk_firmware' }}.git
fi
########################################################
## Delete this section once userspace exists upstream ##
########################################################
- name: Patch QMK Firmware with userspace support
run: |
cd qmk_firmware
git config --global user.email "nonexistent@email-address.invalid"
git config --global user.name "QMK GitHub Actions User"
git remote add qmk https://github.com/qmk/qmk_firmware.git
git fetch qmk qmk-userspace
git merge --no-commit --squash qmk/qmk-userspace
cd ..
- name: Install QMK CLI
run: |
python3 -m pip install --upgrade qmk
python3 -m pip install -r qmk_firmware/requirements.txt
- name: Configure QMK CLI
run: |
qmk config mass_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/userspace
- name: Build
run: |
qmk mass-compile -e DUMP_CI_METADATA=yes -km ${{ github.repository_owner }} || 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@v3
if: always()
continue-on-error: true
with:
name: Firmware
path: |
userspace/*.bin
userspace/*.hex
userspace/*.uf2
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: marvinpinto/action-automatic-releases@latest
if: always()
with:
repo_token: "${{ github.token }}"
automatic_release_tag: "latest"
title: "Latest Firmware"
prerelease: false
files: |
**/*.hex
**/*.bin
**/*.uf2