diff options
author | Joel Spadin <[email protected]> | 2023-04-22 23:16:36 -0500 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2023-04-24 16:07:04 -0700 |
commit | 32ae776c42215d7302ab47787cbfb47298ccb532 (patch) | |
tree | 683b220ca15ec1ab8a7cd130ee86f2512c2b3432 /.github | |
parent | 9c4f1e02d14e2903d7ec377fc3042bb704cc7253 (diff) | |
download | zmk-32ae776c42215d7302ab47787cbfb47298ccb532.tar.gz zmk-32ae776c42215d7302ab47787cbfb47298ccb532.zip |
refactor: Add more checks to pre-commit
Updated existing pre-commit hooks and added some new hooks:
- Remove trailing whitespace
- Ensure every non-empty file ends with a new line
- Check YAML file validity
- Prevent adding large files
- Ensure any scripts with shebangs are executable
Added a GitHub action to run pre-commit on every commit. Removed any
existing actions which duplicate pre-commit.
Ran pre-commit on the codebase.
Diffstat (limited to '.github')
-rw-r--r-- | .github/pull_request_template.md | 24 | ||||
-rw-r--r-- | .github/workflows/build-user-config.yml | 4 | ||||
-rw-r--r-- | .github/workflows/build.yml | 6 | ||||
-rw-r--r-- | .github/workflows/clang-format-lint.yml | 29 | ||||
-rw-r--r-- | .github/workflows/doc-checks.yml | 10 | ||||
-rw-r--r-- | .github/workflows/hardware-metadata-validation.yml | 11 | ||||
-rw-r--r-- | .github/workflows/pre-commit.yml | 15 |
7 files changed, 33 insertions, 66 deletions
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9c3543dd28..9e523a36c5 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,15 @@ <!-- If you're adding a board/shield please fill out this check-list, otherwise you can delete it --> + ## Board/Shield Check-list - - [ ] This board/shield is tested working on real hardware - - [ ] Definitions follow the general style of other shields/boards upstream ([Reference](https://zmk.dev/docs/development/new-shield)) - - [ ] `.zmk.yml` metadata file added - - [ ] Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited) - - [ ] General consistent formatting of DeviceTree files - - [ ] Keymaps do not use deprecated key defines (Check using the [upgrader tool](https://zmk.dev/docs/codes/keymap-upgrader)) - - [ ] `&pro_micro` used in favor of `&pro_micro_d/a` if applicable - - [ ] If split, no name added for the right/peripheral half - - [ ] Kconfig.defconfig file correctly wraps *all* configuration in conditional on the shield symbol - - [ ] `.conf` file has optional extra features commented out - - [ ] Keyboard/PCB is part of a shipped group buy or is generally available in stock to purchase (OSH/personal projects without general availability should create a zmk-config repo instead) + +- [ ] This board/shield is tested working on real hardware +- [ ] Definitions follow the general style of other shields/boards upstream ([Reference](https://zmk.dev/docs/development/new-shield)) +- [ ] `.zmk.yml` metadata file added +- [ ] Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited) +- [ ] General consistent formatting of DeviceTree files +- [ ] Keymaps do not use deprecated key defines (Check using the [upgrader tool](https://zmk.dev/docs/codes/keymap-upgrader)) +- [ ] `&pro_micro` used in favor of `&pro_micro_d/a` if applicable +- [ ] If split, no name added for the right/peripheral half +- [ ] Kconfig.defconfig file correctly wraps _all_ configuration in conditional on the shield symbol +- [ ] `.conf` file has optional extra features commented out +- [ ] Keyboard/PCB is part of a shipped group buy or is generally available in stock to purchase (OSH/personal projects without general availability should create a zmk-config repo instead) diff --git a/.github/workflows/build-user-config.yml b/.github/workflows/build-user-config.yml index 3d89ed7b32..b1e0602d54 100644 --- a/.github/workflows/build-user-config.yml +++ b/.github/workflows/build-user-config.yml @@ -19,8 +19,8 @@ on: required: false type: string archive_name: - description: 'Archive output file name' - default: 'firmware' + description: "Archive output file name" + default: "firmware" required: false type: string diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f472f755c9..82b156e106 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -131,7 +131,7 @@ jobs: for (const configuration of combinedUnique) { if (!perBoard[configuration.board]) perBoard[configuration.board] = []; - + perBoard[configuration.board].push({ shield: configuration.shield, 'cmake-args': configuration['cmake-args'], @@ -234,7 +234,7 @@ jobs: }; } } else if (hm.exposes) { - return hm.exposes.flatMap(i => + return hm.exposes.flatMap(i => metadata.interconnects[i].shields.flatMap(s => boardAndShield(hm, s)) ); } else { @@ -243,7 +243,7 @@ jobs: break; case "shield": if (hm.features && hm.features.includes("keys")) { - return hm.requires.flatMap(i => + return hm.requires.flatMap(i => metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm)) ); } else { diff --git a/.github/workflows/clang-format-lint.yml b/.github/workflows/clang-format-lint.yml deleted file mode 100644 index 8c2cfbcfce..0000000000 --- a/.github/workflows/clang-format-lint.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Clang Format - -on: - push: - paths: - - ".github/workflows/clang-format-lint.yml" - - "app/boards/**/*.c" - - "app/include/**/*.h" - - "app/src/**" - - "app/drivers/**/*.c" - - "app/drivers/**/*.h" - pull_request: - paths: - - ".github/workflows/clang-format-lint.yml" - - "app/boards/**/*.c" - - "app/include/**/*.h" - - "app/src/**" - - "app/drivers/**/*.c" - - "app/drivers/**/*.h" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: DoozyX/[email protected] - with: - source: "./app" - extensions: "h,c" diff --git a/.github/workflows/doc-checks.yml b/.github/workflows/doc-checks.yml index d048a03e0a..91e65e6d31 100644 --- a/.github/workflows/doc-checks.yml +++ b/.github/workflows/doc-checks.yml @@ -21,16 +21,6 @@ jobs: - name: ESLint run: npm run lint working-directory: docs - prettier: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: bahmutov/npm-install@v1 - with: - working-directory: docs - - name: Prettier check - run: npm run prettier:check - working-directory: docs typecheck: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/hardware-metadata-validation.yml b/.github/workflows/hardware-metadata-validation.yml index 4b10a28b12..100928368e 100644 --- a/.github/workflows/hardware-metadata-validation.yml +++ b/.github/workflows/hardware-metadata-validation.yml @@ -15,17 +15,6 @@ on: - "app/scripts/west_commands/metadata.py" jobs: - check-metadata-format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/checkout@v3 - - uses: bahmutov/npm-install@v1 - with: - working-directory: app - - name: Prettier Check - run: npm run prettier:check - working-directory: app validate-metadata: runs-on: ubuntu-latest container: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..a6583d4f71 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,15 @@ +name: pre-commit + +on: + pull_request: + push: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: pre-commit/[email protected] |