chore: migrate CI to github, refactore CI and npm scripts, linting fixes (#1023)

This commit is contained in:
Anix 2020-02-14 15:22:53 +05:30 committed by GitHub
parent b3d9b966df
commit 5f7464af48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 71 additions and 28 deletions

View File

@ -27,7 +27,5 @@ jobs:
run: npm run bootstrap run: npm run bootstrap
- name: Build - name: Build
run: npm run build run: npm run build
- name: linting
run: npm run lint
- name: end to end - name: end to end
run: npm run test:e2e run: npm run test:e2e

31
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Linting Checks
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
build:
runs-on: ubuntu-16.04
strategy:
matrix:
node-version: [10.x, 12.x, 13.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: bootstrap
run: npm run bootstrap
- name: Build
run: npm run build
- name: Linting
run: npm run lint

31
.github/workflows/unit.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Unit tests Suite
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
build:
runs-on: ubuntu-16.04
strategy:
matrix:
node-version: [10.x, 12.x, 13.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: bootstrap
run: npm run bootstrap
- name: Build
run: npm run build
- name: Unit tests
run: npm run test

View File

@ -1,23 +0,0 @@
sudo: false
language: node_js
node_js: stable
node_js:
- '10'
- '8'
- '12'
branches:
only:
- master
- develop
cache:
directories:
- node_modules
before_install:
- npm update
install:
- npm install
script:
- npm run build
- npm run test:e2e
script:
- npm run lint

View File

@ -26,8 +26,9 @@
"serve:ssr": "cross-env SSR=1 node server", "serve:ssr": "cross-env SSR=1 node server",
"dev": "run-p serve watch:*", "dev": "run-p serve watch:*",
"dev:ssr": "run-p serve:ssr watch:*", "dev:ssr": "run-p serve:ssr watch:*",
"lint": "eslint . --fix", "lint": "eslint .",
"test": "mocha test/*/**", "fixlint" : "eslint . --fix",
"test": "mocha ./test/**/*.test.js",
"testServer": "node cypress/setup.js", "testServer": "node cypress/setup.js",
"test:e2e": "start-server-and-test testServer http://localhost:3000 cy:run", "test:e2e": "start-server-and-test testServer http://localhost:3000 cy:run",
"posttest:e2e": "rimraf cypress/fixtures/docs", "posttest:e2e": "rimraf cypress/fixtures/docs",

View File

@ -58,15 +58,19 @@ export default function () {
if (config.loadSidebar === true) { if (config.loadSidebar === true) {
config.loadSidebar = '_sidebar' + config.ext config.loadSidebar = '_sidebar' + config.ext
} }
if (config.loadNavbar === true) { if (config.loadNavbar === true) {
config.loadNavbar = '_navbar' + config.ext config.loadNavbar = '_navbar' + config.ext
} }
if (config.coverpage === true) { if (config.coverpage === true) {
config.coverpage = '_coverpage' + config.ext config.coverpage = '_coverpage' + config.ext
} }
if (config.repo === true) { if (config.repo === true) {
config.repo = '' config.repo = ''
} }
if (config.name === true) { if (config.name === true) {
config.name = '' config.name = ''
} }

View File

@ -22,10 +22,11 @@ export function getAndRemoveConfig(str = '') {
.replace(/^'/, '') .replace(/^'/, '')
.replace(/'$/, '') .replace(/'$/, '')
.replace(/(?:^|\s):([\w-]+:?)=?([\w-]+)?/g, (m, key, value) => { .replace(/(?:^|\s):([\w-]+:?)=?([\w-]+)?/g, (m, key, value) => {
if(key.indexOf(':') === -1){ if (key.indexOf(':') === -1) {
config[key] = (value && value.replace(/"/g, '')) || true config[key] = (value && value.replace(/"/g, '')) || true
return '' return ''
} }
return m return m
}) })
.trim() .trim()