diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c6da2de592..a2c0abde13 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -92,19 +92,15 @@ jobs: - name: Examples SAMD Devices if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py feather_m4 samd samd21_xplained_pro) + (cd examples && ../tools/scripts/examples_compile.py feather_m4 samd) - name: Examples SAMG Devices if: always() run: | (cd examples && ../tools/scripts/examples_compile.py samg55_xplained_pro) - - name: Examples SAME5x Devices - if: always() - run: | - (cd examples && ../tools/scripts/examples_compile.py same54_xplained_pro) - name: Examples SAME70 Devices if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py same70_xplained) + (cd examples && ../tools/scripts/examples_compile.py same70_xplained) - name: Examples SAMV Devices if: always() run: | @@ -112,7 +108,7 @@ jobs: - name: Examples RP20 Devices if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py feather_rp2040 rp_pico thingplus_rp2040) + (cd examples && ../tools/scripts/examples_compile.py rp_pico) - name: Execute Python Scripts if: always() run: | @@ -137,19 +133,19 @@ jobs: - name: Examples STM32F0 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py stm32f0_discovery stm32f072_discovery nucleo_f031k6 nucleo_f072rb nucleo_f091rc nucleo_f042k6 stm32f030f4p6_demo_board) + (cd examples && ../tools/scripts/examples_compile.py stm32f0_discovery stm32f072_discovery nucleo_f072rb nucleo_f042k6 stm32f030f4p6_demo_board) - name: Examples STM32F1 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py stm32f1_discovery nucleo_f103rb olimexino_stm32 blue_pill_f103 black_pill_f103) + (cd examples && ../tools/scripts/examples_compile.py stm32f1_discovery nucleo_f103rb blue_pill_f103) - name: Examples STM32F3 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py stm32f3_discovery nucleo_f303k8 nucleo_f303re nucleo_f334r8) + (cd examples && ../tools/scripts/examples_compile.py stm32f3_discovery nucleo_f303re) - name: Examples STM32F7 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py stm32f746g_discovery stm32f769i_discovery nucleo_f746zg nucleo_f767zi) + (cd examples && ../tools/scripts/examples_compile.py stm32f746g_discovery stm32f769i_discovery nucleo_f767zi) - name: Examples STM32G0 Series if: always() run: | @@ -157,31 +153,23 @@ jobs: - name: Examples STM32L0 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_l031k6 nucleo_l053r8) - - name: Examples STM32L1 Series - if: always() - run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_l152re stm32l1_discovery) + (cd examples && ../tools/scripts/examples_compile.py nucleo_l031k6) - name: Examples STM32L4 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py stm32l476_discovery nucleo_l476rg nucleo_l432kc nucleo_l452re nucleo_l496zg-p) + (cd examples && ../tools/scripts/examples_compile.py nucleo_l476rg nucleo_l432kc nucleo_l452re) - name: Examples STM32L5 Series if: always() run: | (cd examples && ../tools/scripts/examples_compile.py nucleo_l552ze-q) - - name: Examples STM32U5 Series - if: always() - run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_u575zi-q) - name: Examples STM32G4 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_g474re nucleo_g431rb nucleo_g431kb) + (cd examples && ../tools/scripts/examples_compile.py nucleo_g474re) - name: Examples STM32H7 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_h743zi nucleo_h723zg stm32h750vbt6_devebox) + (cd examples && ../tools/scripts/examples_compile.py nucleo_h723zg) stm32f4-examples-1: runs-on: ubuntu-22.04 @@ -201,7 +189,7 @@ jobs: - name: Examples STM32F4 Only Discovery Board if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py stm32f4_discovery stm32f429_discovery stm32f469_discovery stm32f401_discovery) + (cd examples && ../tools/scripts/examples_compile.py stm32f4_discovery stm32f469_discovery stm32f401_discovery) stm32f4-examples-2: runs-on: ubuntu-22.04 @@ -224,7 +212,7 @@ jobs: - name: Examples STM32F4 Without Discovery Board if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_f401re nucleo_f411re nucleo_f429zi nucleo_f446re nucleo_f446ze nucleo_f439zi black_pill_f401 black_pill_f411 stm32f407vet6_devebox stm32_f4ve) + (cd examples && ../tools/scripts/examples_compile.py nucleo_f401re nucleo_f411re nucleo_f429zi nucleo_f446re nucleo_f446ze nucleo_f439zi stm32f407vet6_devebox stm32_f4ve) avr-examples: runs-on: ubuntu-22.04 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f9a54e21c4..b390181f87 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -67,13 +67,18 @@ jobs: run: | (cd examples && ../tools/scripts/examples_compile.py linux) - - name: Compile STM32 Examples + - name: Generic Examples if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_f031k6 nucleo_f103rb nucleo_f303re nucleo_f411re nucleo_f746zg) - (cd examples && ../tools/scripts/examples_compile.py nucleo_g071rb nucleo_l031k6 nucleo_l152re nucleo_l476rg nucleo_g474re) + (cd examples && ../tools/scripts/examples_compile.py generic) + + - name: Compile STM32 Discovery Examples + if: always() + run: | + (cd examples && ../tools/scripts/examples_compile.py stm32f0_discovery stm32f072_discovery stm32f1_discovery stm32f3_discovery stm32f4_discovery) + (cd examples && ../tools/scripts/examples_compile.py stm32f401_discovery stm32f469_discovery stm32f746g_discovery stm32f769i_discovery) - name: Compile AVR Examples if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py avr) + (cd examples && ../tools/scripts/examples_compile.py avr arduino_nano arduino_uno srxe) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7590ae7a67..ffc23256a9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -100,24 +100,28 @@ jobs: with: submodules: 'recursive' - - name: Hosted Examples + - name: Hosted Unittests if: always() shell: bash run: | - (cd examples && python ../tools/scripts/examples_compile.py linux/assert linux/block_device/ram linux/build_info linux/git linux/logger linux/printf linux/etl linux/fiber) + (cd test && make run-hosted-windows) - - name: Hosted Unittests + - name: Hosted Examples if: always() shell: bash run: | - (cd test && make run-hosted-windows) + (cd examples && python ../tools/scripts/examples_compile.py linux) - - name: Compile STM32 Examples + - name: Generic Examples + if: always() + run: | + (cd examples && ../tools/scripts/examples_compile.py generic) + + - name: Compile STM32 Discovery Examples if: always() - shell: bash run: | - (cd examples && python ../tools/scripts/examples_compile.py nucleo_f031k6 nucleo_f103rb nucleo_f303re nucleo_f411re nucleo_f746zg) - (cd examples && python ../tools/scripts/examples_compile.py nucleo_g071rb nucleo_l031k6 nucleo_l152re nucleo_l476rg nucleo_g474re) + (cd examples && ../tools/scripts/examples_compile.py stm32f0_discovery stm32f072_discovery stm32f1_discovery stm32f3_discovery stm32f4_discovery) + (cd examples && ../tools/scripts/examples_compile.py stm32f401_discovery stm32f469_discovery stm32f746g_discovery stm32f769i_discovery) - name: Compile AVR Examples if: always() diff --git a/tools/scripts/examples_check.py b/tools/scripts/examples_check.py index 3fa837568a..4f13e7e30f 100755 --- a/tools/scripts/examples_check.py +++ b/tools/scripts/examples_check.py @@ -52,33 +52,39 @@ def check_builds_paths(projects): return result -def _get_paths_from_ci(files): - paths = set() - for file in files: - matches = re.findall(r"examples_compile.py (.*?)\)", file.read_text()) - paths |= set(m for match in matches for m in match.split(" ")) - return paths +def check_ci_workflows(folders): + def _check(path, missing=None): + path = ".github/workflows/" + path + matches = re.findall(r"examples_compile.py (.*?)\)", repopath(path).read_text()) + paths = set(m for match in matches for m in match.split(" ")) -def check_is_part_of_ci(projects): - folders = set(p.relative_to(repopath("examples")).parts[0] for p in projects) - result = 0 - # Linux files - paths = _get_paths_from_ci([repopath(".github/workflows/linux.yml")]) - paths = folders - paths - if paths: - print("\nLinux CI is missing examples: '{}'" - .format("', '".join(sorted(list(paths)))), file=sys.stderr) - print(" Please add these example folders to the appropriate CI job in\n" - " '.github/workflows/linux.yml'!") + if nonexistant_paths := paths - folders: + print("\nThe CI is trying to build examples that don't exist:\n\n- " + + "\n- ".join(sorted(list(nonexistant_paths))) + + "\n\n Please remove these example folders from the CI configuration:" + f"\n '{path}'!", file=sys.stderr) + + if missing is not None and (missing_paths := folders - paths - missing): + print("\nThe CI is missing examples:\n\n- " + + "\n- ".join(sorted(list(missing_paths))) + + "\n\n Please add these example folders to the appropriate CI job in" + f"\n '{path}'!", file=sys.stderr) + return len(missing_paths) + len(nonexistant_paths) - return len(paths) + return len(nonexistant_paths) + + errors = _check("linux.yml", {'rpi'}) + errors += _check("macos.yml") + errors += _check("windows.yml") + return errors if __name__ == "__main__": # Find all project files projects = list(repopath("examples").rglob("*/project.xml")) + folders = set(p.relative_to(repopath("examples")).parts[0] for p in projects) # Run a bunch of checks on them result = check_builds_paths(projects) - result += check_is_part_of_ci(projects) + result += check_ci_workflows(folders) # Return code if any exit(result)