add circleCI pipeline

This commit is contained in:
Pooya Parsa 2018-03-19 10:46:11 +03:30
parent ca1242d5ec
commit 731ce56067
3 changed files with 51 additions and 27 deletions

View File

@ -1,9 +1,13 @@
version: 2 version: 2
defaults: &defaults
working_directory: /usr/src/app
docker:
- image: banian/node-headless-chrome
jobs: jobs:
build: install:
working_directory: /usr/src/app <<: *defaults
docker:
- image: banian/node-headless-chrome
steps: steps:
# Checkout repository # Checkout repository
- checkout - checkout
@ -23,17 +27,54 @@ jobs:
paths: paths:
- "node_modules" - "node_modules"
# Test lint:
<<: *defaults
- run: - run:
name: Tests name: ESLint
command: NODE_ENV=test yarn test && yarn coverage command: yarn lint
# Release edge build:
<<: *defaults
- run: - run:
name: Publish nuxt-edge name: Build Fixtures
command: yarn build-fixtures
test:
<<: *defaults
- run:
name: Test
command: yarn jest test/
release:
- run:
name: release
command: | command: |
if [ "${CIRCLE_BRANCH}" == "dev" ]; then if [ "${CIRCLE_BRANCH}" == "dev" ]; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
./scripts/release-edge ./scripts/release-edge
fi fi
workflows:
version: 2
install-and-parallel-test:
jobs:
- install
- lint:
requires:
- install
- build:
requires:
- install
- test:
requires:
- build
- release:
requires:
- build
- lint
- test

View File

@ -1,21 +1,8 @@
module.exports = { module.exports = {
'testEnvironment': 'node', 'testEnvironment': 'node',
'coverageDirectory': './coverage/', 'coverageDirectory': './coverage/',
'collectCoverage': false,
'setupTestFrameworkScriptFile': './test/utils/setup', 'setupTestFrameworkScriptFile': './test/utils/setup',
'testMatch': [ 'testMatch': [
'<rootDir>/test/*.test.js' '<rootDir>/test/*.test.js'
],
'projects': [
// {
// 'displayName': 'Lint',
// 'runner': 'jest-runner-eslint',
// 'testMatch': [
// '<rootDir>/lib/*.js'
// ]
// },
{
'displayName': 'Test'
}
] ]
} }

View File

@ -42,17 +42,13 @@
}, },
"scripts": { "scripts": {
"build-fixtures": "node ./scripts/build-fixtures", "build-fixtures": "node ./scripts/build-fixtures",
"test": "npm run lint && npm run build-fixtures && jest test/", "test": "npm run build-fixtures && jest",
"test:unit": "jest", "test:unit": "jest",
"coverage": "codecov", "coverage": "codecov",
"lint": "eslint --ext .js,.mjs,.vue bin/* build/ lib/ test/ examples/", "lint": "eslint --ext .js,.mjs,.vue bin/* build/ lib/ test/ examples/",
"precommit": "npm run lint", "precommit": "npm run lint",
"postinstall": "opencollective postinstall || exit 0" "postinstall": "opencollective postinstall || exit 0"
}, },
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
},
"engines": { "engines": {
"node": ">=8.0.0", "node": ">=8.0.0",
"npm": ">=5.0.0" "npm": ">=5.0.0"