Add travis pipeline (#516)

* Update travis.yml

* Simplify ci pipeline

* Include css in bundle size check

* Set npm username via env var

* Specify branches

* Add build scripts

* Consistent ifs

* Add linting stage to pipeline

* Cache npm

* Cache cypress & npm folders + install using ci method

* Unignore package-lock
This commit is contained in:
Josh Johnson 2019-02-12 18:04:50 +00:00 committed by GitHub
parent ba09fb00e6
commit 55b356ec69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15251 additions and 13 deletions

3
.gitignore vendored
View File

@ -1,10 +1,7 @@
node_modules
npm-debug.log
.DS_Store
.gitignore
.idea
.vscode
package-lock.json
# Test
tests/reports

View File

@ -1,12 +1,44 @@
language: node_js
node_js:
- "8"
before_install:
- '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28'
- npm install -g npm@latest
- 10
cache:
directories:
- ~/.npm
- ~/.cache
install:
- npm install
script:
- npm run test
after_script:
- npm run bundlesize
- npm ci
jobs:
include:
- stage: Judging bundle size
script: npm run bundlesize
- stage: Linting code
script: npm run lint
- stage: Running tests
script: npm run test
- stage: Building for publish
if: branch = master
script: npm run build && npm run bump-cache
- stage: Publishing to NPM
if: branch = master
script: echo "Publishing to NPM..."
deploy:
provider: npm
email: $NPM_EMAIL_ADDRESS
api_key: $NPM_API_KEY
skip_cleanup: true
on:
tags: true
- stage: Publishing to GitHub releases
if: branch = master
script: echo "Publishing to Github releases..."
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
skip_cleanup: true
on:
tags: true

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"eslint.enable": true
}

15201
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
"scripts": {
"start": "run-p js:watch css:watch",
"build": "npm run js:build && npm run css:build",
"lint": "eslint assets/**/*.js",
"lint": "eslint $(find src -name '*.js')",
"coverage": "nyc npm run test:unit",
"bundlesize": "bundlesize",
"cypress:run": "$(npm bin)/cypress run",
@ -124,6 +124,10 @@
{
"path": "public/assets/scripts/choices.min.js",
"maxSize": "25 kB"
},
{
"path": "public/assets/styles/choices.min.css",
"maxSize": "2 kB"
}
]
}

View File

@ -251,6 +251,7 @@ describe('utils', () => {
describe('regexFilter', () => {
it('tests given regex against given value', () => {
// An email address regex
// eslint-disable-next-line
const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
expect(regexFilter('joe@bloggs.com', regex)).to.equal(true);