Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Automatically build / update decompile line count on documentation site #650

Merged
merged 4 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build-doc-app.yaml
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 5 additions & 0 deletions .github/workflows/scripts/line-count.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions docs/gh-pages-proj/src/config/progress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"jak1": {
"locPercentage": {
"value": 5.5,
"label": "Lines of Code"
}
}
}
8 changes: 2 additions & 6 deletions docs/gh-pages-proj/src/progress.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const projectProgress = {
jak1: {
decomp: 5
}
}
const projectProgress = require('./config/progress.json')

export default projectProgress
export default projectProgress
14 changes: 11 additions & 3 deletions docs/gh-pages-proj/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
buffer-value="0"
:value="jak1BlackLabelStatus.decompDone"
stream
height="25"
>
{{jak1BlackLabelStatus.decompLabel}} - {{jak1BlackLabelStatus.decompDone}}%
</v-progress-linear>
</v-col>
</v-row>
Expand All @@ -86,7 +88,7 @@
{{ pr.user.login }}
</p>
<div class="text--primary">
{{ pr.body }}
<pre class="wrapped-pre">{{ pr.body }}</pre>
</div>
</v-card-text>
<v-card-actions>
Expand All @@ -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;
}
</style>

<script>
Expand All @@ -122,7 +129,8 @@ export default {
return {
recentPRs: [],
jak1BlackLabelStatus: {
decompDone: projectProgress.jak1.decomp
decompDone: (projectProgress.jak1.locPercentage.value / 750000.0) * 100.0,
decompLabel: projectProgress.jak1.locPercentage.label
}
};
},
Expand All @@ -141,7 +149,7 @@ export default {
`https://api.github.com/search/issues?q=repo:water111/jak-project+is:pr+is:merged&sort=updated`
);
const data = await response.json();
const numPRs = 6;
const numPRs = 9;
for (var i = 0; i < numPRs; i++) {
var pr = data.items[i];
if (pr.body.length == 0) {
Expand Down