Skip to content
Open
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
48 changes: 0 additions & 48 deletions .eslintrc

This file was deleted.

53 changes: 53 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// this plugin is used to make all rules default to warnings
require('eslint-plugin-only-warn');

module.exports = {
extends: 'standard',
plugins: ['only-warn'], // makes all rules default to warnings
ignorePatterns: ['gulpfile.js', 'webpack.config.js', 'app/bower_components/**'],
globals: {
org: true,
CryptoJS: true,
_: true,
$: true,
angular: true,
ecEditor: true,
EkTelemetry: true,
EkstepEditor: true,
EkstepEditorAPI: true,
Class: true,
UUID: true,
WebFontConfig: true,
TextWYSIWYG: true,
ManifestGenerator: true,
WebFont: true,
fabric: true,
ServiceConstants: true,
async: true,
Fingerprint2: true,
describe: true,
jasmine: true,
afterAll: true,
beforeAll: true,
it: true,
spyOn: true,
expect: true,
xit: true,
EventBus: true,
beforeEach: true,
canvas: true,
Plugin: true,
createjs: true,
p: true,
basePlugin: true,
Mousetrap: true,
afterEach: true,
location: true,
X2JS: true
},
rules: {
indent: [2, 'tab'],
'no-tabs': 0,
'no-throw-literal': 'error',
}
}
101 changes: 101 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Build and Test on Pull Request

on:
pull_request:
branches:
- '**'

env:
CONTENT_PLUGIN_VERSION: ${{ vars.CONTENT_PLUGIN_VERSION || 'release-8.0.0' }}

jobs:
build-test:
runs-on: ubuntu-latest
env:
version_number: ${{ github.ref_name }}
build_number: ${{ github.run_number }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js 10
uses: actions/setup-node@v3
with:
node-version: 10.24.1

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}

- name: Clone plugins (from fork)
run: |
git clone --branch ${{ env.CONTENT_PLUGIN_VERSION }} https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins

- name: Install dependencies
run: |
which bower || sudo npm install -g [email protected]
which grunt || sudo npm install -g [email protected]
which gulp || sudo npm install -g [email protected]
sudo apt-get install build-essential libpng-dev

- name: Bower cache clean
working-directory: app
run: bower cache clean --allow-root

- name: Bower install
working-directory: app
run: bower install --force --allow-root

- name: Install global npm packages
run: npm install --legacy-peer-deps

- name: Gulp packageCorePlugins
run: gulp packageCorePlugins

- name: Plugin build
run: npm run plugin-build

- name: Run build
run: npm run build

- name: Test
run: npm run test
continue-on-error: true

- name: Set up Node.js 14 (for Sonar)
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install SonarQube scanner
run: npm install -g sonarqube-scanner

- name: Run SonarQube scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner

lint:
needs: build-test
runs-on: ubuntu-latest

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

- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}

- name: Run Lint
run: npm run lint
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,27 @@ We use [SemVer](https://semver.org/) for versioning. For the versions available,

## Any Issues?
We have an open and active [issue tracker](https://project-sunbird.atlassian.net/issues/). Please report any issues.

# GitHub Actions

## Build and Test on Pull Request

This GitHub Actions workflow runs **build, test, and lint checks** automatically when a pull request is opened against any branch.

### When It Runs

- **Trigger**: On every `pull_request` to any branch (`'**'`)

### Prerequisites Before Triggering

Make sure the following are set up **before** opening a pull request:

### Secrets
`SONAR_TOKEN`: For SonarQube authentication

### Repository Variables
`CONTENT_PLUGIN_VERSION`: Have to specify the branch or tag you want fetch. By default it will take `release-8.0.0`

Note: The secrets and variables should be set in Github UI (`settings/secrets and variables/actions`).

For any changes to the workflow, update the file `.github/workflows/build-test.yml` accordingly.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"css-tree": "1.0.0-alpha.29",
"csso": "3.5.1",
"cssnano": "4.1.10",
"eslint": "^5.6.0",
"eslint": "^8.57.1",
"global": "^4.4.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-only-warn": "^1.0.4",
"expose-loader": "^0.7.5",
"express-http-proxy": "^1.2.0",
"extract": "^1.0.0",
Expand Down Expand Up @@ -105,7 +107,8 @@
"plugin-build": "webpack --config webpack.plugin.config.js",
"build-editor": "npm run test && npm run collection-plugins && npm run build",
"test": "karma start karmaconf.js",
"build-npm-pkg": "gulp packageCorePlugins && npm run plugin-build && webpack --env.channel=NPM_PACKAGE && cd generic-editor && gulp copystyleImages && gulp clean && gulp injectrenamedfiles"
"build-npm-pkg": "gulp packageCorePlugins && npm run plugin-build && webpack --env.channel=NPM_PACKAGE && cd generic-editor && gulp copystyleImages && gulp clean && gulp injectrenamedfiles",
"lint": "eslint . --quiet"
},
"repository": {
"type": "git",
Expand Down