save current + previous commit progress report, and commit data in artifacts

This commit is contained in:
Matt P 2024-07-22 18:45:55 -05:00
parent ad2c8963d2
commit 5eb9e78b5c
2 changed files with 33 additions and 4 deletions

View File

@ -67,17 +67,25 @@ jobs:
name: ${{ matrix.version }}_maps
path: build/${{ matrix.version }}/**/*.MAP
- name: Generate Progress Report
- name: Generate Progress Reports
if: github.ref == 'refs/heads/main'
run: |
./objdiff-cli report generate -o progress.json
git log -1 --pretty='{"id": "%H", "email": "%ae", "time": "%ad", "message": "%s"}' --date=format:"%Y-%m-%dT%H:%M:%S" > progress-commit.json
git checkout HEAD~1
rm -rf ./build/
ninja all_source
./objdiff-cli report generate -o previous.json
- name: Save Artifact
- name: Save Progress Artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: progress
path: progress.json
path: |
progress.json
previous.json
progress-commit.json
website:
runs-on: ubuntu-latest
@ -89,7 +97,7 @@ jobs:
with:
repository: bfbbdecomp/website
- name: Download artifact
- name: Download Progress Artifacts
uses: actions/download-artifact@v4
with:
name: progress

21
tools/report.py Normal file
View File

@ -0,0 +1,21 @@
from pathlib import Path
import shutil
import subprocess
from pygit2 import GIT_CHECKOUT_FORCE, Repository
repo = Repository(".")
branch = repo.lookup_branch("main")
ref = repo.lookup_reference(branch.name)
repo.checkout(ref, strategy=GIT_CHECKOUT_FORCE)
for commit in list(repo.walk(repo.head.target)):
id = str(commit.id)
shutil.rmtree("./build", ignore_errors=True)
filename = f"./artifacts/{id}.json"
if (not Path(filename).is_file()):
repo.checkout_tree(commit, strategy=GIT_CHECKOUT_FORCE)
subprocess.run("ninja all_source", shell=True)
subprocess.run(f"./objdiff-cli report generate -o {filename}", shell=True)
else:
print("skipping " + filename)
print(commit.id)