Skip to content

Commit

Permalink
Merge pull request #591 from nexB/feature/unittests
Browse files Browse the repository at this point in the history
Unit tests
  • Loading branch information
AyanSinhaMahapatra authored Oct 25, 2023
2 parents 7cae06e + 8ed4e40 commit f42d601
Show file tree
Hide file tree
Showing 269 changed files with 88,927 additions and 18,449 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# name of your github action
name: Release
name: Release CI

# this will help you specify when & which branch to run deployment
on:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Test CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm install
- run: npm test
36 changes: 36 additions & 0 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI Documentation

on: [push, pull_request]

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:
runs-on: ubuntu-20.04

strategy:
max-parallel: 4
matrix:
python-version: [3.9]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: pip install -r docs/requirements.txt

- name: Check Sphinx Documentation build minimally
working-directory: ./docs
run: sphinx-build -E -W source build

- name: Check for documentation style errors
working-directory: ./docs
run: ./scripts/doc8_style_check.sh

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Test residue
test-db

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
26 changes: 26 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build PDF & ePub
formats:
- epub
- pdf

# Where the Sphinx conf.py file is located
sphinx:
configuration: docs/source/conf.py

# specify build OS
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Setting the python version and doc build requirements
python:
install:
- requirements: docs/requirements.txt
86 changes: 86 additions & 0 deletions CODE_OF_CONDUCT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Contributor Covenant Code of Conduct
====================================

Our Pledge
----------

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our
project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, gender identity and
expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

Our Standards
-------------

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual
attention or advances
- Trolling, insulting/derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or
electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

Our Responsibilities
--------------------

Project maintainers are responsible for clarifying the standards of
acceptable behavior and are expected to take appropriate and fair
corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct, or to ban
temporarily or permanently any contributor for other behaviors that they
deem inappropriate, threatening, offensive, or harmful.

Scope
-----

This Code of Conduct applies both within project spaces and in public
spaces when an individual is representing the project or its community.
Examples of representing a project or community include using an
official project e-mail address, posting via an official social media
account, or acting as an appointed representative at an online or
offline event. Representation of a project may be further defined and
clarified by project maintainers.

Enforcement
-----------

Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by contacting the project team at pombredanne@gmail.com
or on the Gitter chat channel at https://matrix.to/#/#aboutcode-org_discuss:gitter.im
All complaints will be reviewed and investigated and will result in a
response that is deemed necessary and appropriate to the circumstances.
The project team is obligated to maintain confidentiality with regard to
the reporter of an incident. Further details of specific enforcement
policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in
good faith may face temporary or permanent repercussions as determined
by other members of the project’s leadership.

Attribution
-----------

This Code of Conduct is adapted from the `Contributor Covenant`_ ,
version 1.4, available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

.. _Contributor Covenant: https://www.contributor-covenant.org
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# <p align="center"><img src="src/assets/images/scancode-workbench-logo.png" align="center" alt="ScanCode Workbench">
</p>

[![Travis Build Status](https://travis-ci.org/nexB/scancode-workbench.svg?branch=develop)](https://travis-ci.org/nexB/scancode-workbench)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/nexB/scancode-workbench)](https://ci.appveyor.com/project/nexB/scancode-workbench)
[![Test CI](https://github.com/nexB/scancode-workbench/actions/workflows/Test.yml/badge.svg)](https://github.com/nexB/scancode-workbench/actions/workflows/Test.yml)
[![Release](https://github.com/nexB/scancode-workbench/actions/workflows/Release.yml/badge.svg)](https://github.com/nexB/scancode-workbench/actions/workflows/Release.yml)

ScanCode Workbench provides an advanced visual UI to help you quickly evaluate
license and other notices identified by
Expand All @@ -11,7 +11,7 @@ license and other notices identified by
and other interesting information in your code.

ScanCode Workbench is based on
[Electron](https://electron.atom.io/) and will be the primary desktop/GUI tool
[Electron](https://www.electronjs.org/) and will be the primary desktop/GUI tool
for using nexB’s [AboutCode tools](https://github.com/nexB/aboutcode). This app
works on Windows, OS X and Linux operating systems.

Expand All @@ -22,9 +22,9 @@ works on Windows, OS X and Linux operating systems.

* You can [download the latest release](https://github.com/nexB/scancode-workbench/releases)
for your operating system or build it yourself (see below). Once downloaded, you
can find `ScanCode-Workbench` under `dist/ScanCode-Workbench-<os>-x64-<version>`.
* ScanCode Workbench >= v2 is only compatible with scans from
[ScanCode v2.0.0](https://github.com/nexB/scancode-toolkit/releases) and
can find `ScanCode-Workbench` under `dist/ScanCode-Workbench-<os>-<arch>-<version>`
* ScanCode Workbench >= v4 is only compatible with scans from
[ScanCode v32.0.0](https://github.com/nexB/scancode-toolkit/releases) and
above which are run with the ScanCode `-i` option. For a list of available ScanCode
options see [How To: Set what will be detected in a scan](https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_set_what_will_be_detected_in_a_scan.html)

Expand All @@ -40,9 +40,9 @@ information captured by a scan. The samples are located at
the [documentation](https://scancode-workbench.readthedocs.io) for more
information on how to use ScanCode Workbench.

![Import a JSON file](https://scancode-workbench.readthedocs.io/en/develop/_images/import-json-file.gif)
[Import a JSON file](https://scancode-workbench.readthedocs.io/en/develop/_images/import-json-file.gif)

## Building
## Running locally

You'll need [Node.js](https://nodejs.org) (which comes with [npm](http://npmjs.com))
installed on your computer in order to build this app. For a list of platform
Expand All @@ -65,23 +65,21 @@ $ npm start

## Release Instructions

You can build a `dist` directory containing executables for any one of three
target platforms by running:
You'll need python 3.x to run the build. You can build a `dist` directory containing executables for your platform

Note: Due to usage of native modules, a build must be done on target platform only.

```bash
$ python build.py
$ npm run publish
```

After building is done, you can find `ScanCode-Workbench` under
`dist/ScanCode-Workbench-<os>-x64-<version>`. Archives (tar.gz and .zip) are
also built.

Note: A build for any of the three target platforms must be executed on the
targeted platform.

## Testing

Test ABCM functionality using:
Run tests using:

```bash
$ npm test
Expand All @@ -98,6 +96,6 @@ See the NOTICE file for more details.

If you have a question, a suggestion or find a bug, enter an issue.

[![Gitter chat](https://badges.gitter.im/aboutcode-org/gitter.png)](https://gitter.im/aboutcode-org/discuss)
[![Gitter chat](https://badges.gitter.im/aboutcode-org/gitter.png)](https://matrix.to/#/#aboutcode-org_discuss:gitter.im)

For questions and chats, you can join the Gitter channel at https://gitter.im/aboutcode-org/discuss
For questions and chats, you can join the Gitter channel at https://matrix.to/#/#aboutcode-org_discuss:gitter.im
File renamed without changes.
8 changes: 4 additions & 4 deletions archive_builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

# Copyright (c) 2017 - 2019 nexB Inc. http://www.nexb.com/ - All rights reserved.
# Copyright (c) nexB Inc. and others. All rights reserved.

"""
Run this script to build ScanCode Workbench. The script detects which OS
Expand Down Expand Up @@ -52,7 +52,7 @@

# Prepare file name for archive using platform, architecture & app version
archive_file_name = '-'.join([APP_NAME, PLATFORM_NAME, ARCH, APP_VERSION])
print("Composed Archive file name: '" + archive_file_name + "'")
print(f"Composed Archive file name: '{archive_file_name}'")

# Ensure archive directory dist/ is created, before attempting to store archive inside it
ensure_archive_directory = f"mkdir -p {ARCHIVE_DIR}"
Expand All @@ -64,13 +64,13 @@
zip_command = f"powershell Compress-Archive {PACKAGE_DIR}/* {ARCHIVE_DIR}/{archive_file_name}.zip"
print("Executing zip command on powershell:", zip_command)
os.system(zip_command)
print(f"Zip file ready in {ARCHIVE_DIR}/ !!")
print(f"Zip file ready: {ARCHIVE_DIR}/{archive_file_name}.zip")

# Prepare .tar.gz file for mac & linux
else:
tar_command = f"tar -czf {ARCHIVE_DIR}/{archive_file_name}.tar.gz -C {PACKAGE_DIR} ."
print("Executing tar command:", tar_command)
os.system(tar_command)
print(f"Tar file ready in {ARCHIVE_DIR}/ !!")
print(f"Tar file ready: {ARCHIVE_DIR}/{archive_file_name}.tar.gz")

print("Build succeeded !!!")
4 changes: 2 additions & 2 deletions attribution.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ <h2>About ScanCode Workbench 4.0.0:</h2>
</p>

<pre>
Copyright (c) 2016 - 2019 nexB Inc. and others. All rights reserved.</pre
Copyright (c) nexB Inc. and others. All rights reserved.</pre
>
<pre>
Software license
================

Copyright (c) 2016 nexB Inc. and others. All rights reserved.
Copyright (c) nexB Inc. and others. All rights reserved.
https://nexb.com and https://github.com/nexB/scancode-workbench/
The ScanCode Workbench software is licensed under the Apache License version 2.0.
ScanCode is a trademark of nexB Inc.
Expand Down
44 changes: 44 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Virtual environment
venv/

# sphinx build folder
build/

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db

# Editor backup files #
#######################
*~
Loading

0 comments on commit f42d601

Please sign in to comment.