Skip to content

Commit

Permalink
arrange workflows: build and release
Browse files Browse the repository at this point in the history
- use QMK's docker image to setup build env
- unified the naming convention of release tags
- simpler build workflow
- release firmwares in form of zip archive
  - include README in the archive
  • Loading branch information
koron committed Sep 25, 2023
1 parent e1c0895 commit d83400e
Show file tree
Hide file tree
Showing 13 changed files with 381 additions and 317 deletions.
27 changes: 27 additions & 0 deletions .github/actions/checkout-qmk_firmware/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Checkout QMK firmware'

inputs:
version:
default: '0.22.3'
type: string
required: false
path:
default: '__qmk__'
type: string
required: false

runs:
using: 'composite'
steps:

- name: Checkout qmk_firmware
uses: actions/checkout@v4
with:
path: ${{ inputs.path }}
repository: qmk/qmk_firmware
submodules: recursive
ref: ${{ inputs.version }}

- name: Setup QMK
shell: bash
run: qmk setup --home ${{ inputs.path }} --yes
30 changes: 30 additions & 0 deletions .github/actions/release-archive/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Relase archive

inputs:
name:
type: string
required: true
version:
default: ${{ github.ref_name }}
type: string
required: false

runs:
using: 'composite'
steps:

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.name }}-firmwares

- name: Archive firmwares
shell: bash
run: |
zip -9 ${{ inputs.name }}-${{ inputs.version }}.zip keyball_${{ inputs.name }}_*.hex README.md
# Add README.md if available
if [ -f ${{ inputs.name }}/doc/firmware_README.md ] ; then
cp ${{ inputs.name }}/doc/firmware_README.md README.md
zip -9 ${{ inputs.name }}-${{ inputs.version }}.zip README.md
rm -f README.md
fi
30 changes: 22 additions & 8 deletions .github/actions/setup-qmk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,40 @@ inputs:
default: '__qmk__'
type: string
required: false
avrgcc_version:
default: '8.3.0'
type: string
required: false

runs:
using: 'composite'
steps:
- name: Checkout qmk_firmware
uses: actions/checkout@v3
with:
path: ${{ inputs.path }}
repository: qmk/qmk_firmware
submodules: recursive
ref: ${{ inputs.version }}

- name: Install git and pip
shell: bash
run: sudo apt-get install -y git python3-pip
run: sudo apt-get install -y git python3-pip libfl2

- name: Install QMK CLI
shell: bash
run: python3 -m pip install --user qmk

- name: Checkout qmk_firmware
uses: actions/checkout@v4
with:
path: ${{ inputs.path }}
repository: qmk/qmk_firmware
submodules: recursive
ref: ${{ inputs.version }}

- name: Setup QMK
shell: bash
run: qmk setup --home ${{ inputs.path }} --yes

- name: Install newer gcc-avr
shell: bash
run: |
# use https://github.com/ZakKemble/avr-gcc-build instead of default
wget -q --show-progress --progress=bar:force https://github.com/ZakKemble/avr-gcc-build/releases/download/v${{ inputs.avrgcc_version }}-1/avr-gcc-${{ inputs.avrgcc_version }}-x64-linux.tar.bz2 -O /tmp/avrgcc.tar.bz2
sudo tar xjf /tmp/avrgcc.tar.bz2 --strip-components=1 -C /usr/
rm -f /tmp/avrgcc.tar.bz2
avr-gcc --version
88 changes: 88 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build all firmwares

on:
push:
paths:
- 'qmk_firmware/keyboards/keyball/**.c'
- 'qmk_firmware/keyboards/keyball/**.h'
- 'qmk_firmware/keyboards/keyball/**.json'
- '.github/actions/setup-qmk/**.yml'
- '.github/workflows/build*.yml'
tags-ignore:
- '*'
branches:
- '*'
workflow_call: {}

jobs:

build:

strategy:
matrix:
keyboard: [ keyball39, keyball44, keyball61, keyball46, one47 ]
keymap: [ test, default, via ]
include:
- keyboard: keyball46
keymap: test_Left
- keyboard: keyball46
keymap: test_Both
- keyboard: keyball46
keymap: via_Left
- keyboard: keyball46
keymap: via_Both

name: Build ${{ matrix.keyboard }} w/ ${{ matrix.keymap }}

runs-on: ubuntu-latest
container:
image: ghcr.io/qmk/qmk_cli:latest

steps:

- name: Checkout source
uses: actions/checkout@v4

- name: Checkout qmk_firmware
uses: ./.github/actions/checkout-qmk_firmware

- name: Install a link to own source
run: ln -s $(pwd)/qmk_firmware/keyboards/keyball __qmk__/keyboards/keyball

- run: qmk compile -j 4 -kb keyball/${{ matrix.keyboard }} -km ${{ matrix.keymap }}

- name: Archive firmwares
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.keyboard }}-firmwares
path: __qmk__/*.hex

check-size:
name: Check size
runs-on: ubuntu-latest
needs:
- build

steps:

- uses: actions/download-artifact@v3
with: { name: keyball39-firmwares }

- uses: actions/download-artifact@v3
with: { name: keyball44-firmwares }

- uses: actions/download-artifact@v3
with: { name: keyball61-firmwares }

- uses: actions/download-artifact@v3
with: { name: keyball46-firmwares }

- uses: actions/download-artifact@v3
with: { name: one47-firmwares }

- name: List size of firmwares
run: |
for f in *.hex ; do
cut -c 2,3 $f | awk '{s+=strtonum("0x" $1)}END{printf "%5d/28672 (%2d%%, %5d bytes free) ",s,s*100/28672,28672-s}'
echo $f
done
61 changes: 0 additions & 61 deletions .github/workflows/keyball39.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/keyball44.yml

This file was deleted.

65 changes: 0 additions & 65 deletions .github/workflows/keyball46.yml

This file was deleted.

Loading

0 comments on commit d83400e

Please sign in to comment.