Merge pull request #54 from mike8699/add-precommit

Automate `clang-format` with `pre-commit`, + other checks
This commit is contained in:
Aetias
2025-01-06 20:45:21 +01:00
committed by GitHub
8 changed files with 70 additions and 10 deletions
+31
View File
@@ -0,0 +1,31 @@
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Linting/style checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
check-latest: true
- name: Install pre-commit
run: pip install pre-commit
- name: Cache pre-commit hooks
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit/
# Invalidate the cache if the pre-commit config changes or the Python version changes
key: pre-commit-cache|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit checks
run: pre-commit run --all-files --verbose
+24
View File
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-yaml
args:
- --allow-multiple-documents
- id: debug-statements
- id: destroyed-symlinks
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5
hooks:
- id: clang-format
+7 -3
View File
@@ -21,11 +21,15 @@ Contents:
```shell
python -m pip install -r tools/requirements.txt
```
4. Run the setup script:
4. Install pre-commit hooks:
```shell
pre-commit install
```
5. Run the setup script:
```shell
python tools/setup.py
```
5. Run the Ninja configure script:
6. Run the Ninja configure script:
```shell
python tools/configure.py <eur|usa>
```
@@ -46,7 +50,7 @@ Now you can run `ninja` to build a ROM for the chosen version.
First, [extract the ARM7 BIOS from your DS device](https://wiki.ds-homebrew.com/ds-index/ds-bios-firmware-dump). Put the
ARM7 BIOS in the root directory of this repository, and verify that your dumped BIOS matches the one below:
| File name | SHA1 |
| File name | SHA1 |
| --------------- | ------------------------------------------ |
| `arm7_bios.bin` | `6ee830c7f552c5bf194c20a2c13d5bb44bdb5c03` |
+2 -2
View File
@@ -253,12 +253,12 @@ translations. Feel free to contribute to this list!
`EVIC` | Event Icon | Exclamation point icon on the map screen
`EQAR` | Earthquake Area
`FMSG` | Freestanding? Message | Freestanding textbox
`ITGE` | Item Generator | Spawns an item, such as a small key
`ITGE` | Item Generator | Spawns an item, such as a small key
`NCMA` | NPC Conversation Message?
`NCM2` | NPC Conversation Message 2?
`NMSG` | Navi Message | Starts dialogue with the fairy
`RMTG` | Room Tag | Midpoint of small rooms, such as houses
`SWDS` |
`SWDS` |
`SWOB` | Switch Object | Causes an event when one or more switches are active
`VOCA` | Voice Area | Listens for microphone volume while Link is in the area
`WNAR` | Wind Area | Creates gusts of wind that push Link
+1 -1
View File
@@ -2,7 +2,7 @@ This repository does not include any of the game's assets, and you will need an
Put the base ROM(s) in this directory. Please verify that your dumped ROM matches one of the versions below:
| Version | File name | SHA1 |
| Version | File name | SHA1 |
| ------- | -------------------- | ------------------------------------------ |
| EUR | `baserom_ph_eur.nds` | `02be55db55cf254bd064d2b3eb368b92a5b4156d` |
| USA | `baserom_ph_usa.nds` | `4c8f52dd719918bbcd46e73a8bae8628139c1b85` |
+2 -2
View File
@@ -158,7 +158,7 @@ def main():
command="./dsd rom build --config $in --rom $out $arm7_bios_flag"
)
n.newline()
n.rule(
name="objdiff",
command=f"./dsd objdiff --config-path $config_path {DSD_OBJDIFF_ARGS}"
@@ -258,7 +258,7 @@ def add_mwcc_builds(n: ninja_syntax.Writer, game_version: str, game_build: Path)
}
)
n.newline()
extension = source_file.suffix
ctx_file = str(game_build / source_file.with_suffix(f".ctx{extension}"))
n.build(
+1 -1
View File
@@ -46,7 +46,7 @@ try:
except subprocess.CalledProcessError as e:
print(e.stdout.decode())
exit(1)
output = output.decode()
# print(output)
+2 -1
View File
@@ -1,2 +1,3 @@
requests
pre-commit
pyperclip
requests