Python Linting and Code Formatting (#298)

* Create common print_diff function

* Add pylint and black

* Fix linting, move classes to utils

* Add black/pylint to github actions

* Fix linting

* Move Bin and SymInfo into their own files

* Split out format

* Tidy up workdlows and pip, add readme

* Lint tests, add tests to readme
This commit is contained in:
Thomas Phillips
2023-11-26 07:27:42 +13:00
committed by GitHub
parent fb0d1ccb62
commit b14116cc93
22 changed files with 1675 additions and 789 deletions

View File

@@ -38,7 +38,7 @@ jobs:
build/ISLE.PDB
build/LEGO1.DLL
build/LEGO1.PDB
compare:
needs: build
runs-on: windows-latest
@@ -70,15 +70,14 @@ jobs:
path: legobin
key: legobin
- name: Build isledecomp library
- name: Install python packages
shell: bash
run: |
pip install tools/isledecomp
pip install -r tools/requirements.txt
- name: Summarize Accuracy
shell: bash
run: |
pip install -r tools/reccmp/requirements.txt
python3 tools/reccmp/reccmp.py -S ISLEPROGRESS.SVG --svg-icon tools/reccmp/isle.png -H ISLEPROGRESS.HTML legobin/ISLE.EXE build/ISLE.EXE build/ISLE.PDB . | tee ISLEPROGRESS.TXT
python3 tools/reccmp/reccmp.py -S LEGO1PROGRESS.SVG -T 1929 --svg-icon tools/reccmp/lego1.png -H LEGO1PROGRESS.HTML legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB . | tee LEGO1PROGRESS.TXT
@@ -96,7 +95,7 @@ jobs:
shell: bash
run: |
python3 tools/verexp/verexp.py legobin/LEGO1.DLL build/LEGO1.DLL
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
@@ -104,7 +103,7 @@ jobs:
path: |
ISLEPROGRESS.*
LEGO1PROGRESS.*
upload:
needs: [build, compare]
runs-on: ubuntu-latest
@@ -113,16 +112,16 @@ jobs:
- uses: actions/checkout@v3
with:
repository: 'probonopd/uploadtool'
- uses: actions/download-artifact@master
with:
name: Win32
path: build
- uses: actions/download-artifact@master
with:
name: Accuracy Report
- name: Upload Continuous Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -133,6 +132,6 @@ jobs:
build/LEGO1.DLL \
ISLEPROGRESS.* \
LEGO1PROGRESS.*
curl -X POST -F key=$UPLOAD_KEY -F 'file=@ISLEPROGRESS.SVG' https://legoisland.org/progress/
curl -X POST -F key=$UPLOAD_KEY -F 'file=@LEGO1PROGRESS.SVG' https://legoisland.org/progress/

View File

@@ -19,4 +19,21 @@ jobs:
LEGO1/*.cpp LEGO1/*.h \
LEGO1/realtime/*.cpp LEGO1/realtime/*.h \
LEGO1/tgl/*.h \
LEGO1/viewmanager/*.cpp LEGO1/viewmanager/*.h
LEGO1/viewmanager/*.cpp LEGO1/viewmanager/*.h
python-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install python libraries
shell: bash
run: |
pip install black pylint pytest -r tools/requirements.txt
- name: Run pylint and black
shell: bash
run: |
pylint tools --ignore=build
black --check tools

View File

@@ -9,12 +9,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build isledecomp library
- name: Install python libraries
run: |
pip install tools/isledecomp
pip install -r tools/requirements.txt
- name: Run checkorder.py
run: |
pip install -r tools/checkorder/requirements.txt
python3 tools/checkorder/checkorder.py --verbose --enforce ISLE
python3 tools/checkorder/checkorder.py --verbose --enforce LEGO1