Skip to content

Commit

Permalink
Remove R (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr authored Jul 23, 2023
2 parents 6826fcf + f6cc211 commit cfa5863
Show file tree
Hide file tree
Showing 30 changed files with 271 additions and 1,764 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,12 @@ jobs:
steps:
- name: Checkout ReBench
uses: actions/checkout@v3
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.2.0'

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '19'

- name: Cache R packages
uses: actions/cache@v3
env:
cache-name: r-libs-420
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('src/stats/install.R') }}-2
# restore-keys: |
# ${{ runner.os }}-${{ env.cache-name }}-
# ${{ runner.os }}-

- name: Cache node modules
uses: actions/cache@v3
env:
Expand All @@ -70,10 +55,6 @@ jobs:
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-
- name: Install R libs
run: |
Rscript src/stats/install.R
- name: NPM CI
run: |
npm ci
Expand Down
15 changes: 2 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,12 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Add Node.js repo
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -

RUN sh -c 'echo "deb http://cloud.r-project.org/bin/linux/debian bookworm-cran40/" > /etc/apt/sources.list.d/r-project.list' && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'


# R, Node.js, PostgreSQL, headers for R packages
# Node.js, PostgreSQL, headers for R packages
RUN apt-get update && apt-get install -y \
r-base build-essential nodejs \
build-essential nodejs unzip \
libfontconfig1-dev \
libpq-dev

# Copy only the install.R to enable caching
RUN mkdir -p /project/src/stats/
COPY ./src/stats/install.R /project/src/stats/

# Installing R libraries
RUN Rscript /project/src/stats/install.R

# Copy only package.json to enable caching
COPY ./package.json ./package-lock.json /project/

Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"koa": "2.14.2",
"koa-body": "6.0.1",
"koa-router": "12.0.0",
"mustache": "4.2.0",
"pg": "8.11.1",
"promisify-child-process": "4.1.2",
"tslog": "4.8.2",
Expand All @@ -38,7 +37,6 @@
"@types/ejs": "3.1.2",
"@types/koa": "2.13.6",
"@types/koa-router": "7.4.4",
"@types/mustache": "4.2.2",
"@types/pg": "8.10.2",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
Expand Down
9 changes: 0 additions & 9 deletions render-report.sh

This file was deleted.

39 changes: 4 additions & 35 deletions src/backend/compare/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import type {
WarmupDataPerCriterion
} from '../../shared/view-types.js';
import { respondProjectNotFound } from '../common/standard-responses.js';
import { dbConfig, refreshSecret, robustPath } from '../util.js';
import { prepareTemplate, processTemplate } from '../templates.js';
import { deleteReport, renderCompare, renderCompareNew } from './report.js';
import * as dataFormatters from '../../shared/data-format.js';
import * as viewHelpers from '../../shared/helpers.js';
import { refreshSecret } from '../util.js';
import { deleteReport, renderCompare } from './report.js';
import { TimelineRequest } from '../../shared/api.js';

export async function getProfileAsJson(
Expand Down Expand Up @@ -197,9 +194,6 @@ export async function redirectToNewCompareUrl(
}
}

/**
* @deprecated remove once the new compare page is feature complete
*/
export async function renderComparePage(
ctx: ParameterizedContext,
db: Database
Expand All @@ -210,43 +204,18 @@ export async function renderComparePage(
ctx.params.baseline,
ctx.params.change,
ctx.params.projectSlug,
dbConfig,
db
);
ctx.body = processTemplate('views/compare.html', data);
ctx.body = data.content;
ctx.type = 'html';

if (data.generatingReport) {
if (data.inProgress) {
ctx.set('Cache-Control', 'no-cache');
}

completeRequest(start, db, 'change');
}

const compareTpl = prepareTemplate(
robustPath('backend/compare/html/index.html'),
false,
robustPath('backend/compare/html')
);

export async function renderComparePageNew(
ctx: ParameterizedContext,
db: Database
): Promise<void> {
const start = startRequest();

const data = await renderCompareNew(
ctx.params.baseline,
ctx.params.change,
ctx.params.projectSlug,
db
);
ctx.body = compareTpl({ ...data, dataFormatters, viewHelpers });
ctx.type = 'html';

completeRequest(start, db, 'change-new');
}

export async function deleteCachedReport(
ctx: ParameterizedContext
): Promise<void> {
Expand Down
78 changes: 78 additions & 0 deletions src/backend/compare/html/gen-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!doctype html>
<html lang="en">
<head>
<title>ReBenchDB for {%= it.project %}: Comparing {%= it.baselineHash6 %} with {%= it.changeHash6 %}</title>

{%- include('header.html') %}

{% if (it.generatingReport) { %}
<meta http-equiv="refresh" content="30" />
{% } %}
</head>
<body class="compare timeline-multi">

<header>
<div class="jumbotron compare">
<h2>ReBenchDB for {%= it.project %}</h2>
{% if (it.revisionFound) { %}
<h3>Comparing <a href="{%= it.base.repourl%}/compare/{%= it.baselineHash%}...{%= it.changeHash%}">{%= it.baselineHash6%} with {%= it.changeHash6%}</a></h3>
{% } else { %}
<h3>Comparing {%= it.baselineHash6%} with {%= it.changeHash6%}</h3>
{% } %}
</div>
</header>

{% if (it.revisionFound) { %}
<div id="version-details" class="compare">
<h2>Version Details</h2>
<dl class="row">
<dt class="col-sm-2">Baseline</dt>
<dd class="col-sm-9">
<a href="{%= it.base.repourl%}/compare/{%= it.baselineHash%}"><span class="baseline-badge">{%= it.baselineHash6%}</span></a> {%= it.base.branchortag%}<br/>
{%= it.base.authorname%}
<pre>{%= it.base.commitmessage%}</pre>

{%= it.base.name%}
</dd>
<dt class="col-sm-2">Change</dt>
<dd class="col-sm-9">
<a href="{%= it.base.repourl%}/compare/{%= it.changeHash%}"><span class="change-badge">{%= it.changeHash6%}</span></a> {%= it.change.branchortag%}<br/>
{%= it.change.authorname%}
<pre>{%= it.change.commitmessage%}</pre>

{%= it.change.name%}
</dd>
<dt class="col-sm-2">Significant Change</dt>
<dd class="col-sm-9"><div class="form-row">
<input type="range" class="col-6 custom-range" min="0" max="15" step="0.5" id="significance" style="padding-top: 1.75ex; padding-right: 1em;" value="5">
<input type="text" readonly class="col-4 form-control-plaintext" id="significance-val" value="5%">
</div></dd>
</dl>
</div>
{% } %}

{% if (it.generatingReport) { %}
<div class="alert alert-secondary compare" role="alert">
<h4 class="alert-heading">Report is currently being generated</h4>
<p>Please wait, the requested report is currently still generated.</p>
<p>Last page reload was at {%= it.currentTime %}</p>
<hr>
<p class="mb-0">This can take a couple of minutes and the page will reload automatically.</p>
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
{% } %}

{% if (it.generationFailed) { %}
<div class="alert alert-warning compare" role="alert">
<h4 class="alert-heading">Report generation failed</h4>
<hr>
<h6>Error</h6>
<pre>{%= it.generationOutput %}</pre>
</div>
{% } %}
</body>
</html>
Loading

0 comments on commit cfa5863

Please sign in to comment.