zmk/.github/workflows/nix-build.yml
Chris Andreae c7fc3432cd
Docker container and lambda function for performing firmware builds
Provides an entry point that builds and returns a combined LH + RH keyboard
firmware when provided a keymap via a POST body.

Wraps compilation with ccache, and includes a pre-warmed cache of the build in /tmp/ccache.
To maximize chance of a direct cache hit, changes the lambda driver to always build in /tmp/build.

some back of the envelope measurements (2012 xeon e3-1230v2, nixos)
clean build, no cache -> 21.308
clean build, cache -> 7.145
modified keymap, clean build, cache -> 12.127
2022-12-24 13:00:14 +09:00

62 lines
1.6 KiB
YAML

name: Build Glove80 Firmware
on:
push:
paths:
- ".github/workflows/nix-build.yml"
- "default.nix"
- "app/**"
- "nix/**"
branches:
- '**'
tags:
- '**'
pull_request:
paths:
- ".github/workflows/nix-build.yml"
- "default.nix"
- "app/**"
- "nix/**"
jobs:
build:
name: Build Glove80 Firmware
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-22.05
- uses: cachix/cachix-action@v12
with:
name: moergo-glove80-zmk-dev
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
skipPush: "${{ github.repository != 'moergo-sc/zmk' }}"
- name: Build Glove80 combined firmware
run: nix-build -A glove80_combined -o combined
- name: Copy result out of nix store
run: cp combined/glove80.uf2 glove80.uf2
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: glove80.uf2
path: glove80.uf2
release:
name: Create Release for Tag
if: >-
github.repository == 'moergo-sc/zmk'
&& github.event_name == 'push'
&& contains(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download compiled firmware artifact
uses: actions/download-artifact@v3
with:
name: glove80.uf2
- name: Create Release for Tag
uses: ncipollo/release-action@v1
with:
artifacts: "glove80.uf2"
artifactErrorsFailBuild: true
generateReleaseNotes: true