mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 06:09:57 +00:00
CI: check for removed goal_src code that we want or need to perserve (#2987)
This commit is contained in:
parent
ed6782d11b
commit
3252136c1f
11
.github/workflows/inform-pages-repo.yaml
vendored
11
.github/workflows/inform-pages-repo.yaml
vendored
@ -25,11 +25,12 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Package Dependencies
|
||||
run: >
|
||||
sudo apt install build-essential cmake
|
||||
clang gcc g++ lcov make nasm libxrandr-dev
|
||||
libxinerama-dev libxcursor-dev libpulse-dev
|
||||
libxi-dev zip ninja-build
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install build-essential cmake \
|
||||
clang gcc g++ lcov make nasm libxrandr-dev \
|
||||
libxinerama-dev libxcursor-dev libpulse-dev \
|
||||
libxi-dev zip ninja-build libgl1-mesa-dev
|
||||
|
||||
- name: Setup Buildcache
|
||||
uses: mikehardy/buildcache-action@v2.1.0
|
||||
|
10
.github/workflows/linting.yaml
vendored
10
.github/workflows/linting.yaml
vendored
@ -40,6 +40,16 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Python Dependencies
|
||||
run: pip install unidiff colorama
|
||||
|
||||
- name: Check for Removed goal_src/ Code
|
||||
# FYI - if you run this `git diff` on windows, it creates a utf-16 LE file
|
||||
run: |
|
||||
git fetch origin
|
||||
git diff origin/master > lint-changes.diff
|
||||
python ./scripts/ci/lint-gsrc-removals.py
|
||||
|
||||
- name: Check for Unresolved Conflicts
|
||||
run: python ./scripts/gsrc/check-for-conflicts.py
|
||||
|
||||
|
11
.github/workflows/linux-build-clang.yaml
vendored
11
.github/workflows/linux-build-clang.yaml
vendored
@ -32,11 +32,12 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Package Dependencies
|
||||
run: >
|
||||
sudo apt install build-essential cmake
|
||||
clang gcc g++ lcov make nasm libxrandr-dev
|
||||
libxinerama-dev libxcursor-dev libpulse-dev
|
||||
libxi-dev zip ninja-build libgl1-mesa-dev
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install build-essential cmake \
|
||||
clang gcc g++ lcov make nasm libxrandr-dev \
|
||||
libxinerama-dev libxcursor-dev libpulse-dev \
|
||||
libxi-dev zip ninja-build libgl1-mesa-dev
|
||||
|
||||
- name: Setup Buildcache
|
||||
uses: mikehardy/buildcache-action@v2.1.0
|
||||
|
11
.github/workflows/linux-build-gcc.yaml
vendored
11
.github/workflows/linux-build-gcc.yaml
vendored
@ -28,11 +28,12 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Package Dependencies
|
||||
run: >
|
||||
sudo apt install build-essential cmake
|
||||
clang gcc g++ lcov make nasm libxrandr-dev
|
||||
libxinerama-dev libxcursor-dev libpulse-dev
|
||||
libxi-dev zip ninja-build libgl1-mesa-dev
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install build-essential cmake \
|
||||
clang gcc g++ lcov make nasm libxrandr-dev \
|
||||
libxinerama-dev libxcursor-dev libpulse-dev \
|
||||
libxi-dev zip ninja-build libgl1-mesa-dev
|
||||
|
||||
- name: Setup Buildcache
|
||||
uses: mikehardy/buildcache-action@v2.1.0
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -75,3 +75,4 @@ __pycache__/
|
||||
/jak2-*.json
|
||||
/TODO.md
|
||||
unifont-15.0.03.ttf
|
||||
*.diff
|
||||
|
6
.vscode/opengoal.code-snippets
vendored
6
.vscode/opengoal.code-snippets
vendored
@ -17,12 +17,6 @@
|
||||
"body": [";; og:ignore-form:${1:substr}"],
|
||||
"description": "If the provided substr is found in the starting line of a form, the entire form will be omitted when copying decompiled code into the file"
|
||||
},
|
||||
"og:update-with-merge": {
|
||||
"scope": "opengoal",
|
||||
"prefix": ["og:update-with-merge"],
|
||||
"body": [";; og:update-with-merge"],
|
||||
"description": "The file will be updated with a git merge-file instead of naive copy-paste"
|
||||
},
|
||||
"og:preserve-this": {
|
||||
"scope": "opengoal",
|
||||
"prefix": ["og:preserve-this"],
|
||||
|
@ -25,8 +25,6 @@ a single mesh, so it's limited to tests like single foreground mesh vs. sphere.
|
||||
Another limitation is that triangles don't have per-tri pat info.
|
||||
|#
|
||||
|
||||
;; og:update-with-merge
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
;; name in dgo: castle-obs
|
||||
;; dgos: CAS
|
||||
|
||||
;; og:update-with-merge:substr
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define *cas-conveyor-room-id* 0)
|
||||
|
@ -13,8 +13,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; og:update-with-merge
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod draw hud-helldog ((obj hud-helldog))
|
||||
|
@ -5,8 +5,6 @@
|
||||
;; name in dgo: ctypal-obs
|
||||
;; dgos: CPA
|
||||
|
||||
;; og:update-with-merge:substr
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype water-anim-ctypal (water-anim)
|
||||
|
@ -5,8 +5,6 @@
|
||||
;; name in dgo: airlock
|
||||
;; dgos: GAME, COMMON
|
||||
|
||||
;; og:update-with-merge
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype com-airlock (process-drawable)
|
||||
|
@ -5,8 +5,6 @@
|
||||
;; name in dgo: pal-obs
|
||||
;; dgos: PAE, PAC
|
||||
|
||||
;; og:update-with-merge:substr
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype pal-falling-plat (process-drawable)
|
||||
|
51
scripts/ci/lint-gsrc-removals.py
Normal file
51
scripts/ci/lint-gsrc-removals.py
Normal file
@ -0,0 +1,51 @@
|
||||
# Gets the diff between this PR and `origin/master`
|
||||
# If there are any 'og:preserve-this' lines removed, the script returns 1
|
||||
|
||||
import unidiff
|
||||
from colorama import Fore
|
||||
|
||||
with open("lint-changes.diff", encoding="utf-8") as f:
|
||||
diff = f.read()
|
||||
|
||||
patch_set = unidiff.PatchSet.from_string(diff)
|
||||
|
||||
flagged_deletions = []
|
||||
|
||||
for patched_file in patch_set:
|
||||
file_path = patched_file.path
|
||||
for hunk in patched_file:
|
||||
for line in hunk:
|
||||
if line.is_removed and "og:preserve-this" in line.value.strip():
|
||||
flagged_deletions.append(
|
||||
{
|
||||
"file": file_path,
|
||||
"line_num": line.source_line_no,
|
||||
"deletion": line.value.strip(),
|
||||
}
|
||||
)
|
||||
|
||||
print(flagged_deletions)
|
||||
|
||||
if len(flagged_deletions) > 0:
|
||||
print(
|
||||
Fore.RED
|
||||
+ "Flagged goal_src code has been deleted, either you made a mistake or you better know what you're doing!" + Fore.RESET
|
||||
)
|
||||
for flagged_deletion in flagged_deletions:
|
||||
print(
|
||||
" - {}{}{}:{}{}{} - {}{}{}".format(
|
||||
Fore.CYAN,
|
||||
flagged_deletion["file"],
|
||||
Fore.RESET,
|
||||
Fore.GREEN,
|
||||
flagged_deletion["line_num"],
|
||||
Fore.RESET,
|
||||
Fore.RED,
|
||||
flagged_deletion["deletion"],
|
||||
Fore.RESET,
|
||||
)
|
||||
)
|
||||
print(Fore.RESET)
|
||||
exit(1)
|
||||
print("No flagged goal_src code was deleted (hopefully!)")
|
||||
exit(0)
|
Loading…
Reference in New Issue
Block a user