From 7d02c7eaf3439a07c65314ef4fcce865c0b56e00 Mon Sep 17 00:00:00 2001 From: Mike Grimes Date: Fri, 21 Oct 2022 08:45:35 -0600 Subject: [PATCH 1/3] download recomp binaries instead of building --- .github/workflows/VerifyBuild.yml | 12 +++++------- .github/workflows/VerifyPR.yml | 10 ++++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/VerifyBuild.yml b/.github/workflows/VerifyBuild.yml index d8b74937..32251063 100644 --- a/.github/workflows/VerifyBuild.yml +++ b/.github/workflows/VerifyBuild.yml @@ -28,13 +28,11 @@ jobs: - name: Verify ROM run: if [[ $(echo "0cb115d8716dbbc2922fda38e533b9fe63bb9670 baseroms/dkr.z64" | sha1sum -c --quiet -) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi - - name: Build Recomp + - name: Download Recomp run: | - cd tools/ido-static-recomp/ - python3 build.py ido/5.3 -O2 - cp build5.3/out/usr/bin/cc build5.3/out/cc - cp build5.3/out/usr/lib/* build5.3/out/ - cd ../../ + 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: Build Tools run: | @@ -63,4 +61,4 @@ jobs: run: make clean - name: Verify NON_EQUIVALENT - run: make NON_EQUIVALENT=1 \ No newline at end of file + run: make NON_EQUIVALENT=1 diff --git a/.github/workflows/VerifyPR.yml b/.github/workflows/VerifyPR.yml index b1ec7238..58e46d3b 100644 --- a/.github/workflows/VerifyPR.yml +++ b/.github/workflows/VerifyPR.yml @@ -28,13 +28,11 @@ jobs: - name: Verify ROM run: if [[ $(echo "0cb115d8716dbbc2922fda38e533b9fe63bb9670 baseroms/dkr.z64" | sha1sum -c --quiet -) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi - - name: Build Recomp + - name: Download Recomp run: | - cd tools/ido-static-recomp/ - python3 build.py ido/5.3 -O2 - cp build5.3/out/usr/bin/cc build5.3/out/cc - cp build5.3/out/usr/lib/* build5.3/out/ - cd ../../ + 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: Build Tools run: | From 4afc3e4be9b3bf388ba81ec47948315729dbdfae Mon Sep 17 00:00:00 2001 From: Mike Grimes Date: Fri, 21 Oct 2022 09:18:56 -0600 Subject: [PATCH 2/3] Add automatic score updater --- .github/workflows/VerifyPR.yml | 12 +++++++++++- README.md | 2 ++ score.sh | 22 +++++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/VerifyPR.yml b/.github/workflows/VerifyPR.yml index b1ec7238..f323dcc2 100644 --- a/.github/workflows/VerifyPR.yml +++ b/.github/workflows/VerifyPR.yml @@ -63,4 +63,14 @@ jobs: run: make clean - name: Verify NON_EQUIVALENT - run: make NON_EQUIVALENT=1 \ No newline at end of file + run: make NON_EQUIVALENT=1 + + - name: Update decomp score in README + run: ./score.sh --update-readme + + - name: Update PR + uses: test-room-7/action-update-file@v1 + with: + file-path: README.md + commit-msg: Update score in README + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 2ccfed81..05ce2022 100755 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ s32 is_drumstick_unlocked(void) { As of October 3rd, 2022, this is our current score: ``` + ========================================== ADVENTURE ONE (ASM -> C Decompilation) ------------ 33.19% Complete ------------- @@ -138,6 +139,7 @@ As of October 3rd, 2022, this is our current score: ------------------------------------------ We are racing in Ancient Lake. (Lap 1/3) ========================================== + ``` --- diff --git a/score.sh b/score.sh index 5a22e15b..a8d86991 100755 --- a/score.sh +++ b/score.sh @@ -1 +1,21 @@ -python3 ./tools/python/score.py "$@" \ No newline at end of file +if [[ $1 == '--update-readme' ]]; then + export NEW_SCORE=$(python3 ./tools/python/score.py) + echo $NEW_SCORE + python3 - <<'EOF' > README.md.tmp +import sys +import os +import re +BEGIN='' +END='' +print( + re.sub( + fr'(?s).{BEGIN}.*{END}', + f'\n{BEGIN}\n{os.environ["NEW_SCORE"]}\n{END}', + open('README.md', 'r').read() + ) +) +EOF +mv README.md.tmp README.md +else + python3 ./tools/python/score.py "$@" +fi From 461d3316661e4c5a306ae68dd75d3c80a141f1ad Mon Sep 17 00:00:00 2001 From: Mike Grimes Date: Fri, 21 Oct 2022 10:03:51 -0600 Subject: [PATCH 3/3] output date string as well --- README.md | 4 ++-- score.sh | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 05ce2022..1d24e848 100755 --- a/README.md +++ b/README.md @@ -113,9 +113,9 @@ s32 is_drumstick_unlocked(void) { } ``` + As of October 3rd, 2022, this is our current score: ``` - ========================================== ADVENTURE ONE (ASM -> C Decompilation) ------------ 33.19% Complete ------------- @@ -139,8 +139,8 @@ As of October 3rd, 2022, this is our current score: ------------------------------------------ We are racing in Ancient Lake. (Lap 1/3) ========================================== - ``` + --- diff --git a/score.sh b/score.sh index a8d86991..ef5dbc63 100755 --- a/score.sh +++ b/score.sh @@ -5,12 +5,15 @@ if [[ $1 == '--update-readme' ]]; then import sys import os import re -BEGIN='' -END='' +from datetime import datetime + +BEGIN = '' +END = '' +DATE_STR = datetime.now().strftime('As of %B %-d, %Y, this is our current score:') print( re.sub( fr'(?s).{BEGIN}.*{END}', - f'\n{BEGIN}\n{os.environ["NEW_SCORE"]}\n{END}', + f'\n{BEGIN}\n{DATE_STR}\n```\n{os.environ["NEW_SCORE"]}\n```\n{END}', open('README.md', 'r').read() ) )