diff options
| author | Dimitris Mantzouranis <d3xter93@gmail.com> | 2022-01-15 12:49:11 +0200 |
|---|---|---|
| committer | Dimitris Mantzouranis <d3xter93@gmail.com> | 2022-01-15 14:22:49 +0200 |
| commit | 1ca3981c14f0277cef57ace91d150e306a89192f (patch) | |
| tree | 3dfe606f3e033ad9a33599ca362cdccdd7e8efb4 /lib/python | |
| parent | b96252da06fa079752695f97622075a8424fa5c0 (diff) | |
CI: move build in one script
Diffstat (limited to 'lib/python')
| -rwxr-xr-x | lib/python/build_all.py | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/lib/python/build_all.py b/lib/python/build_all.py index 87ab2db20..652ff2994 100755 --- a/lib/python/build_all.py +++ b/lib/python/build_all.py @@ -2,27 +2,36 @@ import subprocess import os import sys import re -BOARDS = [] +KEYBOARDS = [] +# Search the repository for Sonix SN32F2 keyboard directories +command = "grep -rl 'MCU = SN32F2' | sed -e 's/keyboards\///g' -e 's/\/rules.mk//g'| sort" +ret = subprocess.run(command, capture_output=True, shell=True) +BOARDS = ret.stdout.decode().split('\n') def main(): - for line in sys.stdin: - if line.strip() != "": + for line in BOARDS: + # We need to manipulate some non-standard directories + if line.strip() != "" and line.strip() != "lib/python/build_all.py": if re.match("^(gmmk)",line.strip()): - BOARDS.append(line.strip()+"/rev2") - BOARDS.append(line.strip()+"/rev3") + KEYBOARDS.append(line.strip()+"/rev2") + KEYBOARDS.append(line.strip()+"/rev3") if re.match("^(keychron/k)",line.strip()): - BOARDS.append(line.strip()) - BOARDS.append(line.strip()+"/via") - BOARDS.append(line.strip()+"/optical") - BOARDS.append(line.strip()+"/optical_via") - else: BOARDS.append(line.strip()) + KEYBOARDS.append(line.strip()) + # keychron K series white don't have yet via/optical support + if re.match("(?!.*white)",line.strip()): + KEYBOARDS.append(line.strip()+"/via") + KEYBOARDS.append(line.strip()+"/optical") + KEYBOARDS.append(line.strip()+"/optical_via") + else: KEYBOARDS.append(line.strip()) if __name__ == '__main__': main() error = False -for kb in BOARDS: - if subprocess.run(f"qmk compile -kb {kb} -km all -j{os.cpu_count()}", shell=True).returncode != 0: +for kb in KEYBOARDS: + # We are building for different chips, and some things need a clean pass, so make sure it's clean + build_command = f"qmk clean && qmk compile -kb {kb} -km all -j{os.cpu_count()}" + if subprocess.run(build_command, shell=True).returncode != 0: error = True if error: sys.exit(1) |
