Skip to content

Commit

Permalink
Merge branch 'develop' into feature/45
Browse files Browse the repository at this point in the history
  • Loading branch information
Grochni committed May 8, 2023
2 parents 477a5cd + adb9ea0 commit 85ef18d
Show file tree
Hide file tree
Showing 440 changed files with 337,464 additions and 35,511 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions .binocularrc_ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"github": { "auth": { "token": ""}},
"arango": { "host": "localhost", "port": "8529", "user": "root", "password":"openSesame"}
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
/ui
coverage/
/dist
4 changes: 2 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extends:
- prettier
- lambdas
parserOptions:
ecmaVersion: 8
ecmaVersion: 2020
sourceType: 'module'
rules:
prettier/prettier:
Expand All @@ -16,7 +16,7 @@ rules:
no-console: off
indent: ['error', 2, { "SwitchCase": 1 }]
max-len: ["error", { "code": 140 }]
comma-dangle: ["error", "never"]
comma-dangle: ["error", "only-multiline"]
operator-linebreak: ['error', 'after', { "overrides": { "?": "before", ":": "before"} }]
linebreak-style: ["error", "unix"]
quotes:
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/build-bincoular.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build Binocular

on:
pull_request:
branches:
- develop

#env: set env if needed

jobs:

build:

runs-on: ubuntu-latest
services:

arangodb:
image: arangodb:3.7
ports:
- 8529:8529
env:
ARANGO_ROOT_PASSWORD: openSesame

steps:

- name: Checkout Repository
uses: actions/checkout@v3

- name: Checkout Repository to scan
uses: actions/checkout@v3
with:
ref: develop
fetch-depth: 0
path: test

- name: Set .pupilrc variables
uses: microsoft/variable-substitution@v1
with:
files: .binocularrc_ci
env:
github.auth.token: ${{ secrets.GITHUB_TOKEN }}

- name: Rename binocularrc
run: mv .binocularrc_ci .binocularrc

- name: Set node version
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Run eslint
run: npm run eslint

- name: Run binocular
run: node binocular.js --no-open --no-server ./test

- name: Build
run: npm run build

- name: Publish artifact
uses: actions/upload-artifact@v3
with:
name: binocular_ui
path: dist/

# - name: Run tests
# run: npm run test

# - name: Collect coverage
# run: npm run coverage
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/node_modules
/ui/assets
.pupil
.pupilrc
/dist
.binocular
.binocularrc
db/
*.log
coverage/
Expand All @@ -12,4 +12,6 @@ coverage/
out
pkg
.grandle

/ui/db_export
/.devcontainer
.DS_Store
5 changes: 3 additions & 2 deletions .jestrc-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"transform": {
".*": "<rootDir>/../../node_modules/babel-jest"
},
"moduleFileExtensions": ["js", "jsx"],
"moduleFileExtensions": ["js", "jsx","json"],
"collectCoverage": true,
"coverageDirectory": "<rootDir>/../../coverage/ui"
"coverageDirectory": "<rootDir>/../../coverage/ui",
"transformIgnorePatterns": ["node_modules/(?!d3|d3-array|internmap|delaunator|robust-predicates)"]
}
3 changes: 2 additions & 1 deletion .jestrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"transform": {
".*": "<rootDir>/../../node_modules/babel-jest"
},
"moduleFileExtensions": ["js", "jsx", "json"]
"moduleFileExtensions": ["js", "jsx","json"],
"transformIgnorePatterns": ["node_modules/(?!d3|d3-array|internmap|delaunator|robust-predicates)"]
}
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
coverage/
.pupilrc
.binocularrc
18 changes: 18 additions & 0 deletions .pupilrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"github": {
"auth": {
"type": "client",
"token": "tnGQ3BuRV+xFVDtpn3vnq/cW8yKsIHrSLFf/i7KyQYg"
}
},
"arango": {
"host": "localhost",
"port": 8529,
"user": "root",
"password": "binocular"
},
"indexers": {
"its": "github",
"ci": "travis"
}
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8
FROM node:16

RUN npm config -g set user root

Expand Down
103 changes: 71 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
Pupil
Binocular
=====

[![Build Status](https://travis-ci.org/INSO-TUWien/Binocular.svg?branch=feature%2F10)](https://travis-ci.org/INSO-TUWien/Binocular)
[![Build Binocular](https://github.com/INSO-TUWien/Binocular/actions/workflows/build-bincoular.yml/badge.svg?branch=develop)](https://github.com/INSO-TUWien/Binocular/actions/workflows/build-bincoular.yml)

Pupil is a tool for visualizing data from various software-engineering
Binocular is a tool for visualizing data from various software-engineering
tools. It works as a command-line tool run from a git-repository. When
run, pupil will gather data from the repository and the GitLab
run, Binocular will gather data from the repository and the GitLab
REST-API and persist it to a configured ArangoDB instance.

Pupil then hosts interactive visualizations about the gathered data
Binocular then hosts interactive visualizations about the gathered data
via a web-interface.

## Naming

"Pupil" is the name used in this repository and also the name used in
the source code to refer to itself. In the accompanying master's
thesis, "pupil" is referred to as "zivsed". On the INSO projects page,
it is described as "binocular". Don't get confused, its all the same
thing - naming is hard `¯\_(ツ)_/¯`.

## Dependencies

* node.js >= 8
* ArangoDB (tested with 3.1.28)
* node.js 18
* ArangoDB (tested with 3.8.2)

## Installation

Pupil is not yet published on the npm registry. To install it, you
Binocular is not yet published on the npm registry. To install it, you
should clone this repository and then link it:

``` shell
$ git clone git@gitlab.com:romand/pupil.git
$ cd pupil
pupil$ npm link # <- this will make the `pupil` executable available in your $PATH
$ git clone https://github.com/INSO-TUWien/Binocular.git
$ cd Binocular
/Binocular $ npm link # <- this will make the `Binocular` executable available in your $PATH
```

### Configuration

As pupil needs to access an ArangoDB instance, you have to configure
the database connection before you can use pupil. This can be done in
the global pupil-configuration file `~/.pupilrc`. Additionally, the
As Binocular needs to access an ArangoDB instance, you have to configure
the database connection before you can use Binocular. This can be done in
the global Binocular configuration file `~/.binocularrc`. Additionally, the
configuration file also stores authentication data for the consumed
REST-APIs. The configuration file is read by the [rc
module](https://www.npmjs.com/package/rc). Check its documentation to
Expand All @@ -51,6 +43,7 @@ json.
- `gitlab`: Object holding gitlab configuration options
- `url`: The URL to the GitLab-Instance you want to connect to. Use the
base-url, not the API-URL (see the example)!
- `project`:
- `token`: The personal access token generated by your GitLab user to
use for authentication (see
https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
Expand All @@ -70,7 +63,7 @@ json.
Should only be used if the repository could not detect the indexers automatically.
- `its`: Holds the name of the issue tracking system indexer,for instance, gitlab or github
- `ci`: Since the CI indexer importer is searching for the corresponding file in the repository, it can be necessary to specify the
correct indexer like, for example, travis.
correct indexer like, for example, gitlab, github or travis.

A sample configuration file looks like this:

Expand All @@ -83,38 +76,84 @@ A sample configuration file looks like this:
"github": {
"auth": {
"type": "basic",
"username": "YOUR_GITLAB_USER",
"password": "YOUR_GITLAB_PASSWORD"
"username": "YOUR_GITHUB_USER",
"token": "YOUR_GITHUB_OAUTH_TOKEN"
}
},
"arango": {
"host": "localhost",
"host": "127.0.0.1",
"port": 8529,
"user": "YOUR_ARANGODB_USER",
"password": "YOUR_ARANGODB_PASSWORD"
},
"indexers": {
"its": "github",
"ci": "travis"
"ci": "github"
}
}
```


You may override configuration options for specific projects by
placing another `.pupilrc` file in the project's root directory.
placing another `.binocularrc` file in the project's root directory.

You may also modify a config to the `gitlab.json` file in `./ui/config`. This file sets
the GitLab API settings for the CodeHotspots-visualization for
offline execution. This is only necessary if you want to automatically
set those options within for example an GitLab pipeline.

#### Configuration options
- `server`: GitLab API server url
- `projectId`: GitLab project ID

A sample configuration file looks like this:
``` javascript
{
"server":"GITLAB_API_URL",
"projectId":"GITLAB_PROJECT_ID"
}
```

## Usage

To run pupil, simply execute `pupil` from the repository you want to
run pupil on (you can try it on the pupil-repo itself!). Pupil will
To run Binocular, simply execute `binocular` from the repository you want to
run Binocular on (you can try it on the Binocular-repo itself!). Binocular will
try to guess reasonable defaults for configuration based on your
`.git/config`. A browser window should pop up automatically with
pupil's web-interface showing the indexing progress and the
Binocular's web-interface showing the indexing progress and the
visualizations.

For testing, you can also execute Binocular directly in the Binocular
Dictionary by running the command:
``` shell
npm run dev
```
If you run Windows (does not support chaining of commands) you
should use the command:
``` shell
npm run dev-concurrently
```
This will start both the node backend and webpack frontend server
for the Binocular dictionary and mine it. If you run Binocular for the
first time it will show webpack errors for missing JSON files. This
happens because to build the frontend it needs an export of the db to
build so that it can fall back to run without the backend. This
is necessary when binocular gets executed within a GitLab
pipeline/GitHub action. Those errors aren't a problem because when
you execute Binocular for the first time and the indexer are finished it
will create the db export by itself and place it into the correct
folder. After the exported JSON files of the db are available it is
possible to build an offline executable version of Binocular by
executing the command
``` shell
npm run build
```
This will create a html and js file in the dist folder that can be
opened without the backend running. It is also possible
to place the exported JSON files of a different mining job under `./ui/db_export/` and build the frontend. (not
all features will be available in the offline build)

## Contributing

For an explanation of pupil's architecture, please see the [Contribution
For an explanation of Binocular's architecture, please see the [Contribution
guidelines for this project](docs/CONTRIBUTING.md)
8 changes: 8 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["@babel/react",
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": 3
}]
]
}
Loading

0 comments on commit 85ef18d

Please sign in to comment.