From 681cc243f35db11ed813187ef311bc218a85fe49 Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Thu, 2 Jan 2025 21:09:53 +0100 Subject: [PATCH] refac: split verification steps into separate GH jobs. Fix score.py script crashing because of missing key. Update README to include ROM hash --- .github/workflows/VerifyBuild.yml | 91 ++++++++++++------------------- .github/workflows/VerifyPR.yml | 65 ---------------------- README.md | 2 +- tools/python/score.py | 5 +- 4 files changed, 41 insertions(+), 122 deletions(-) delete mode 100644 .github/workflows/VerifyPR.yml diff --git a/.github/workflows/VerifyBuild.yml b/.github/workflows/VerifyBuild.yml index 218dbcc3..5d98487a 100644 --- a/.github/workflows/VerifyBuild.yml +++ b/.github/workflows/VerifyBuild.yml @@ -1,73 +1,54 @@ name: Verify Build on: + pull_request_target: + branches: [master] push: - branches: [ master ] - # pull_request: - # branches: [ master ] + branches: [master] jobs: build: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push' }} + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y build-essential pkg-config git python3 libssl-dev wget binutils-mips-linux-gnu + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y build-essential pkg-config git python3 libssl-dev wget binutils-mips-linux-gnu - - name: Get ROM - run: wget -q -O baseroms/dkr.z64 ${{secrets.ROMURL}} + - name: Get ROM + run: wget -q -O baseroms/dkr.z64 ${{secrets.ROMURL}} - - name: Verify ROM - run: if [[ $(echo "0cb115d8716dbbc2922fda38e533b9fe63bb9670 baseroms/dkr.z64" | sha1sum -c --quiet -) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi + - name: Verify ROM + run: if [[ $(echo "0cb115d8716dbbc2922fda38e533b9fe63bb9670 baseroms/dkr.z64" | sha1sum -c --quiet -) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi - - name: Download Recomp - run: | - wget -q -O ido-static-recomp.tar.gz https://github.com/decompals/ido-static-recomp/releases/download/v0.1/ido-5.3-recomp-ubuntu-latest.tar.gz - mkdir -p tools/ido-static-recomp/build5.3/out - tar -xvzf ido-static-recomp.tar.gz -C tools/ido-static-recomp/build5.3/out + - name: Download Recomp + run: | + wget -q -O ido-static-recomp.tar.gz https://github.com/decompals/ido-static-recomp/releases/download/v1.0/ido-5.3-recomp-linux.tar.gz + mkdir -p tools/ido-static-recomp/build5.3/out + tar -xvzf ido-static-recomp.tar.gz -C tools/ido-static-recomp/build5.3/out - - name: Build Tools - run: | - cd tools - make -j4 - cd .. + - name: Build Tools + run: | + cd tools + make -j4 + cd .. - - name: Extract Assets - run: | - ./extract.sh - python3 tools/python/check_if_need_to_extract.py us_1.0 + - name: Extract Assets + run: | + ./extract.sh + python3 tools/python/check_if_need_to_extract.py us_1.0 - - name: Build ROM - run: make -j4 + - name: Build ROM + run: make -j4 - - name: Verify Build - run: if [[ $(sha1sum -c --quiet sha1/dkr.us_1.0.sha1) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi - - - name: Update Score - run: ./update-score.sh - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - add-paths: README.md - commit-message: "Update score" - - - name: Clean Build - run: make clean - - - name: Verify NON_MATCHING - run: make -j4 NON_MATCHING=1 - - - name: Clean Again - run: make clean - - - name: Verify NON_EQUIVALENT - run: make -j4 NON_EQUIVALENT=1 + - name: Verify Build + run: if [[ $(sha1sum -c --quiet sha1/dkr.us_1.0.sha1) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi \ No newline at end of file diff --git a/.github/workflows/VerifyPR.yml b/.github/workflows/VerifyPR.yml deleted file mode 100644 index 28b094bc..00000000 --- a/.github/workflows/VerifyPR.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Verify PR - -on: - pull_request_target: - branches: [ master ] - -jobs: - build: - if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y build-essential pkg-config git python3 libssl-dev wget binutils-mips-linux-gnu - - - name: Get ROM - run: wget -q -O baseroms/dkr.z64 ${{secrets.ROMURL}} - - - name: Verify ROM - run: if [[ $(echo "0cb115d8716dbbc2922fda38e533b9fe63bb9670 baseroms/dkr.z64" | sha1sum -c --quiet -) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi - - - name: Download Recomp - run: | - wget -q -O ido-static-recomp.tar.gz https://github.com/decompals/ido-static-recomp/releases/download/v1.0/ido-5.3-recomp-linux.tar.gz - mkdir -p tools/ido-static-recomp/build5.3/out - tar -xvzf ido-static-recomp.tar.gz -C tools/ido-static-recomp/build5.3/out - - - name: Build Tools - run: | - cd tools - make -j4 - cd .. - - - name: Extract Assets - run: | - ./extract.sh - python3 tools/python/check_if_need_to_extract.py us_1.0 - - - name: Build ROM - run: make -j4 - - - name: Verify Build - run: if [[ $(sha1sum -c --quiet sha1/dkr.us_1.0.sha1) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi - - - name: Clean Build - run: make clean - - - name: Verify NON_MATCHING - run: make -j4 NON_MATCHING=1 - - - name: Clean Again - run: make clean - - - name: Verify NON_EQUIVALENT - run: make -j4 NON_EQUIVALENT=1 - diff --git a/README.md b/README.md index e4e4a287..4023a291 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the N64. You will need to have a original copy of the ROM to extract the game's assets. -Currently, only the US 1.0 version of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time. +Currently, only the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time. As of July 4, 2024, this is our current score: diff --git a/tools/python/score.py b/tools/python/score.py index 664ece56..d7f49b64 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -92,7 +92,10 @@ class ScoreFileMatch: self.comment = comment self.functionName = functionName self.isDocumented = (comment != None) and not functionName.startswith("func_") - self.size = MAP_FILE.functionSizes[functionName] + if functionName in MAP_FILE.functionSizes: + self.size = MAP_FILE.functionSizes[functionName] + else: + self.size = 0 class ScoreFile: def __init__(self, filepath):