Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» CI check boards.h , pins.h
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 10, 2024
1 parent a964661 commit 14e1ce6
Show file tree
Hide file tree
Showing 5 changed files with 419 additions and 222 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ci-validate-boards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# ci-validate-boards.yml
# Validate boards.h to make sure it's all set up correctly
#

name: CI - Validate boards.h

# We can do the on: section as two items, one for pull requests and one for pushes...
on:
pull_request:
branches:
- bugfix-2.1.x
paths:
- 'Marlin/src/core/boards.h'
push:
branches:
- bugfix-2.1.x
paths:
- 'Marlin/src/core/boards.h'

jobs:
validate_pins_files:
name: Validate boards.h
if: github.repository == 'MarlinFirmware/Marlin'

runs-on: ubuntu-latest

steps:
- name: Check out the PR
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Select Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'

- name: Validate core/boards.h
run: |
make validate-boards -j
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ UNIT_TEST_CONFIG ?= default

help:
@echo "Tasks for local development:"
@echo "make marlin : Build marlin for the configured board"
@echo "make marlin : Build Marlin for the configured board"
@echo "make format-pins -j : Reformat all pins files (-j for parallel execution)"
@echo "make validate-pins -j : Validate all pins files, fails if any require reformatting"
@echo "make validate-boards -j : Validate boards.h and pins.h for standards compliance"
@echo "make tests-single-ci : Run a single test from inside the CI"
@echo "make tests-single-local : Run a single test locally"
@echo "make tests-single-local-docker : Run a single test locally, using docker"
Expand Down Expand Up @@ -102,3 +103,11 @@ format-pins: $(PINS)
validate-pins: format-pins
@echo "Validating pins files"
@git diff --exit-code || (git status && echo "\nError: Pins files are not formatted correctly. Run \"make format-pins\" to fix.\n" && exit 1)

BOARDS_FILE := Marlin/src/core/boards.h

.PHONY: validate-boards

validate-boards:
@echo "Validating boards.h file"
@python $(SCRIPTS_DIR)/validate_boards.py $(BOARDS_FILE) || (echo "\nError: boards.h file is not valid. Please check and correct it.\n" && exit 1)
Loading

0 comments on commit 14e1ce6

Please sign in to comment.