Browse Source

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
pull/515/head
Josh Johnson 3 years ago
committed by GitHub
parent
commit
55b356ec69
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .gitignore
  2. 50
      .travis.yml
  3. 3
      .vscode/settings.json
  4. 15201
      package-lock.json
  5. 6
      package.json
  6. 1
      src/scripts/lib/utils.test.js

3
.gitignore

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

50
.travis.yml

@ -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

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

15201
package-lock.json

File diff suppressed because it is too large

6
package.json

@ -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"
}
]
}

1
src/scripts/lib/utils.test.js

@ -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);

Loading…
Cancel
Save