From a6c806595714679604df0eabdb93148fd3f41f0b Mon Sep 17 00:00:00 2001
From: Tyler Wilding
Date: Tue, 29 Jun 2021 20:31:35 -0400
Subject: [PATCH] Docs: Automatically build / update decompile line count on
documentation site (#650)
* prep work for next step
* better formatting on latest updates
* test
* fix mistakes
---
.github/workflows/build-doc-app.yaml | 42 +++++++++++++++++++++
.github/workflows/scripts/line-count.sh | 5 +++
docs/gh-pages-proj/src/config/progress.json | 8 ++++
docs/gh-pages-proj/src/progress.js | 8 +---
docs/gh-pages-proj/src/views/Home.vue | 14 +++++--
5 files changed, 68 insertions(+), 9 deletions(-)
create mode 100644 .github/workflows/build-doc-app.yaml
create mode 100644 .github/workflows/scripts/line-count.sh
create mode 100644 docs/gh-pages-proj/src/config/progress.json
diff --git a/.github/workflows/build-doc-app.yaml b/.github/workflows/build-doc-app.yaml
new file mode 100644
index 0000000000..112bfa6271
--- /dev/null
+++ b/.github/workflows/build-doc-app.yaml
@@ -0,0 +1,42 @@
+name: Re-build Doc Site
+
+# Controls when the action will run. Triggers the workflow on push or pull request
+# events but only for the master branch
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - 'goal_src/**'
+ - 'docs/gh-pages-proj/**'
+
+jobs:
+ lint:
+ name: Update Documentation Site
+ runs-on: ubuntu-20.04
+ # Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
+ timeout-minutes: 10
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v2
+
+ # just do a sed for now
+ - name: Update Line Count
+ run: |
+ chmod +x ./.github/workflows/scripts/line-count.sh
+ ./.github/workflows/scripts/line-count.sh
+
+ - name: Update Site
+ run: |
+ cd docs/gh-pages-proj
+ npm install
+ npm run build
+ cd ../..
+ cp -r ./docs/gh-pages-proj/dist/* ./docs/
+
+ - name: Add & Commit
+ uses: EndBug/add-and-commit@v7.2.1
+ with:
+ default_author: github_actions
+ pull_strategy: "NO-PULL"
+ message: "Updated github pages site"
diff --git a/.github/workflows/scripts/line-count.sh b/.github/workflows/scripts/line-count.sh
new file mode 100644
index 0000000000..f856a79a2a
--- /dev/null
+++ b/.github/workflows/scripts/line-count.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+LINE_COUNT=$(find ./goal_src -name '*.gc' | xargs wc -l | tail -1 | awk -F'[^0-9]+' '{ print $2 }')
+
+sed -i "s/.*value.*/ \"value\": ${LINE_COUNT},/g" ./docs/gh-pages-proj/src/config/progress.json
diff --git a/docs/gh-pages-proj/src/config/progress.json b/docs/gh-pages-proj/src/config/progress.json
new file mode 100644
index 0000000000..1b4f96ff33
--- /dev/null
+++ b/docs/gh-pages-proj/src/config/progress.json
@@ -0,0 +1,8 @@
+{
+ "jak1": {
+ "locPercentage": {
+ "value": 5.5,
+ "label": "Lines of Code"
+ }
+ }
+}
diff --git a/docs/gh-pages-proj/src/progress.js b/docs/gh-pages-proj/src/progress.js
index e45269bd2a..7ef618e55c 100644
--- a/docs/gh-pages-proj/src/progress.js
+++ b/docs/gh-pages-proj/src/progress.js
@@ -1,7 +1,3 @@
-const projectProgress = {
- jak1: {
- decomp: 5
- }
-}
+const projectProgress = require('./config/progress.json')
-export default projectProgress
\ No newline at end of file
+export default projectProgress
diff --git a/docs/gh-pages-proj/src/views/Home.vue b/docs/gh-pages-proj/src/views/Home.vue
index 70b49e956c..3ce00c9e20 100644
--- a/docs/gh-pages-proj/src/views/Home.vue
+++ b/docs/gh-pages-proj/src/views/Home.vue
@@ -62,7 +62,9 @@
buffer-value="0"
:value="jak1BlackLabelStatus.decompDone"
stream
+ height="25"
>
+ {{jak1BlackLabelStatus.decompLabel}} - {{jak1BlackLabelStatus.decompDone}}%
@@ -86,7 +88,7 @@
{{ pr.user.login }}
- {{ pr.body }}
+
{{ pr.body }}
@@ -110,6 +112,11 @@
background-size: cover;
min-height: 50vh;
}
+.wrapped-pre {
+ word-wrap: normal;
+ white-space: pre-wrap;
+ font-family: "Roboto", sans-serif !important;
+}