SonixQMK / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://sonixqmk.github.io/qmk_docs/
GNU General Public License v2.0
523 stars 412 forks source link

[CI] Add quick build workflow, add whitelist/blacklist support in build_all.py #206

Closed tmas closed 2 years ago

tmas commented 2 years ago

Description

This PR adds whitelist and blacklist options for build_all.py. You can specify a whitelist file by doing python3 lib/python/build_all.py --whitelist MY_WHITELIST and specify a blacklist file by doing python3 lib/python/build_all.py --blacklist MY_BLACKLIST. It also adds a debug option (--debug) which enables printing debug messages related to the whitelist and blacklist functionality.

In order to avoid cluttering up the existing if statement in the main function, I moved all logic that controls whether a line in the output of grep -rl 'MCU = SN32F2' | sed -e 's/keyboards\///g' -e 's/\/rules.mk//g'| sort should be built to a new function called should_include. Hopefully this should make maintenance a little bit easier if more filtering is required down the line.

I also added a new Github Actions workflow (auto-build-quick.yml) which only builds keyboards listed in the new quickbuild_whitelist file in the root of the repository. Dexter93 on Discord helped me out by providing the list of keyboards that are commonly used for testing.

Types of Changes

Issues Fixed or Closed by This PR

Checklist

dexter93 commented 2 years ago

Looks good to me. Only one final small linter issue here

`qmk format-python -n -a` stdout:
--- /__w/qmk_firmware/qmk_firmware/lib/python/build_all.py  (original)
+++ /__w/qmk_firmware/qmk_firmware/lib/python/build_all.py  (reformatted)
@@ -44,13 +44,13 @@
FAIL
qmk.tests.test_cli_commands.test_generate_api ... DEBUG:MILC:Running command: ['qmk', 'generate-api', '--dry-run']
     for line in BOARDS:
         # We need to manipulate some non-standard directories
         if should_include(line):
-            if re.match("^(gmmk)",line.strip()):
+            if re.match("^(gmmk)", line.strip()):
                 KEYBOARDS.append(line.strip() + "/rev2")
                 KEYBOARDS.append(line.strip() + "/rev3")
-            if re.match("^(keychron/k)",line.strip()):
+            if re.match("^(keychron/k)", line.strip()):
                 KEYBOARDS.append(line.strip())
                 # keychron K series white don't have yet via/optical support
-                if re.match("(?!.*white)",line.strip()):
+                if re.match("(?!.*white)", line.strip()):
                     KEYBOARDS.append(line.strip() + "/via")
                     KEYBOARDS.append(line.strip() + "/optical")
                     KEYBOARDS.append(line.strip() + "/optical_via")