Skip to content

Commit

Permalink
Merge pull request #372 from ipfs-shipyard/fix/tests-timeout
Browse files Browse the repository at this point in the history
CI and Tests stabilization
  • Loading branch information
lidel authored Feb 12, 2018
2 parents 888d3cf + 323b3ad commit bd5b201
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 26 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ As a courtesy, please add a comment informing about your intent. That way we wi

## Submitting Pull Requests

Just make sure your PR comes with its own tests and does pass [automated TravisCI tests](https://travis-ci.org/ipfs/ipfs-companion/branches).
Just make sure your PR comes with its own tests and does pass [automated CI build](https://ci.ipfs.team/blue/organizations/jenkins/IPFS%20Shipyard%2Fipfs-companion/pr).
See the [GitHub Flow Guide](https://guides.github.com/introduction/flow/) for details.

Read section below to get familiar with tools and commands that will make your work easier.
Expand Down Expand Up @@ -92,8 +92,8 @@ Each `npm` task can be run separately. The most useful ones are:

- `npm install` -- install all NPM dependencies
- `npm run build` -- build the add-on (copy external libraries, create `.zip` bundle)
- `npm run yarn-build` -- fast install+build with yarn
- `npm run docker-build` -- reproducible build using yarn.lock and specific version of yarn and node
- `npm run yarn-build` -- fast dependency install + build with yarn (installs and updates yarn.lock if needed)
- `npm run ci` -- reproducible test and build (with frozen yarn.lock)
- `npm test` -- run entire test suite
- `npm run lint` -- check for potential syntax problems (run all linters)
- `npm run lint:standard` -- run [standard](http://standardjs.com) linter ([IPFS JavaScript projects default to standard code style](https://github.com/ipfs/community/blob/master/js-project-guidelines.md#linting--code-style))
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM node:9.4.0-alpine
RUN apk add --update make gcc g++ python git
FROM node:9.5.0
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV PATH="/usr/src/app/node_modules/.bin:${PATH}"
COPY package.json /usr/src/app/package.json
COPY yarn.lock /usr/src/app/yarn.lock
RUN yarn
RUN npm run ci:install
COPY . /usr/src/app
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
![demo of v2.0.13](https://ipfs.io/ipfs/QmUxZrrjUGZVMjqc2noCRkQZr8B9JyGNj7sPpRoJ6uPQq1)

[![](https://img.shields.io/github/release/ipfs/ipfs-companion.svg)](https://github.com/ipfs/ipfs-companion/releases/latest)
[![](https://img.shields.io/badge/mozilla-full%20review-blue.svg)](https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/)
[![](https://img.shields.io/badge/mozilla-reviewed-blue.svg)](https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-blue.svg)](http://standardjs.com/)
[![localization status](https://d322cqt584bo4o.cloudfront.net/ipfs-companion/localized.svg)](https://crowdin.com/project/ipfs-companion)
[![Coverage Status](https://coveralls.io/repos/github/lidel/ipfs-firefox-addon/badge.svg?branch=master)](https://coveralls.io/github/lidel/ipfs-firefox-addon?branch=master)
[![build-status](https://travis-ci.org/ipfs-shipyard/ipfs-companion.svg?branch=master)](https://travis-ci.org/ipfs-shipyard/ipfs-companion)
[![build-status](https://img.shields.io/jenkins/s/http/ci.ipfs.team/job/IPFS%20Shipyard/job/ipfs-companion/job/master.svg)](https://ci.ipfs.team/blue/organizations/jenkins/IPFS%20Shipyard%2Fipfs-companion/activity?branch=master)<br>
[![#ipfs-in-web-browsers](https://img.shields.io/badge/irc-%23ipfs--in--web--browsers-brightgreen.svg)](https://webchat.freenode.net/?channels=ipfs-in-web-browsers)

> Browser extension that simplifies access to IPFS resources
Expand Down
34 changes: 29 additions & 5 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
node(label: 'linux') {
checkout scm
sh 'docker build -t ipfs-companion .'
sh 'docker run -i ipfs-companion yarn test'
sh 'docker run -i -v $(pwd)/build:/usr/src/app/build ipfs-companion yarn build'
archiveArtifacts artifacts: 'build/*.zip'
stage('git:checkout') {
cleanWs()
checkout scm
sh 'printenv'
}
stage('ci:install') {
sh 'docker build -t ipfs-companion:${JOB_BASE_NAME}-${BUILD_NUMBER} .'
}
catchError {
stage('ci:test') {
sh 'docker run -i --rm -e JUNIT_REPORT_PATH=test/report.xml -v $(pwd)/test:/usr/src/app/test:rw ipfs-companion:${JOB_BASE_NAME}-${BUILD_NUMBER} npm run ci:test'
}
}
junit allowEmptyResults: true, testResults: 'test/report.xml'
catchError {
stage('ci:build') {
sh 'mkdir -p $(pwd)/build'
sh 'docker run -i --rm -v $(pwd)/build:/usr/src/app/build:rw -v $(pwd)/add-on:/usr/src/app/add-on:rw ipfs-companion:${JOB_BASE_NAME}-${BUILD_NUMBER} npm run ci:build'
archiveArtifacts artifacts: 'build/*.zip', fingerprint: true
}
stage('lint:web-ext') {
sh 'docker run -i --rm -v $(pwd)/add-on:/usr/src/app/add-on:ro ipfs-companion:${JOB_BASE_NAME}-${BUILD_NUMBER} npm run lint:web-ext'
}
}
sh 'docker rmi -f ipfs-companion:${JOB_BASE_NAME}-${BUILD_NUMBER}'
sh 'ls -lh .'
sh 'ls -Rlh add-on'
sh 'ls -Rlh build'
cleanWs()
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@
"watch:content-scripts:ipfs-proxy:page": "watchify -p prundupify -t [ browserify-package-json --global ] add-on/src/contentScripts/ipfs-proxy/page.js -o add-on/dist/contentScripts/ipfs-proxy/page.js -v",
"watch:content-scripts:ipfs-proxy:content": "nodemon --exec \"browserify -p prundupify -t brfs -t [ browserify-package-json --global ] -s IpfsProxyContent add-on/src/contentScripts/ipfs-proxy/content.js -o add-on/dist/contentScripts/ipfs-proxy/content.js -v\" --watch add-on/src/contentScripts/ipfs-proxy/content.js --watch add-on/dist/contentScripts/ipfs-proxy/page.js",
"test": "run-s test:*",
"test:functional": " nyc --reporter=lcov --reporter=text mocha --require ignore-styles 'test/functional/**/*.test.js'",
"test:functional": " nyc --reporter=lcov --reporter=text mocha --timeout 15000 --require ignore-styles --reporter mocha-jenkins-reporter 'test/functional/**/*.test.js'",
"lint": "run-s lint:*",
"lint:standard": "standard --fix -v \"add-on/src/**/*.js\" \"test/**/*.js\"",
"lint:web-ext": "web-ext lint -s add-on/",
"precommit": "run-s -s clean build lint",
"prepush": "run-s -s precommit test build",
"firefox": "web-ext run -s add-on/ --browser-console",
"ci": "run-s ci:*",
"ci:install": "npx yarn@1.3.2 install --frozen-lockfile || npx yarn@1.3.2 install --frozen-lockfile",
"ci:test": "npx yarn@1.3.2 test",
"ci:build": "npx yarn@1.3.2 build ; chmod -R ugo+rwX build/ add-on/",
"yarn-build": "npx yarn@1.3.2 && npx yarn@1.3.2 build"
},
"private": true,
Expand All @@ -60,6 +64,7 @@
"ignore-styles": "5.0.1",
"mem-storage-area": "1.0.3",
"mocha": "4.0.1",
"mocha-jenkins-reporter": "0.3.10",
"nodemon": "1.14.11",
"npm-run-all": "4.1.2",
"nyc": "11.4.1",
Expand Down
16 changes: 7 additions & 9 deletions test/functional/lib/ipfs-companion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@ const browser = require('sinon-chrome')
const { URL } = require('url')
const { optionDefaults } = require('../../../add-on/src/lib/options')

describe('init', () => {
describe('init', function () {
let init

before(function () {
this.timeout = 1000 * 10
global.window = {}
global.browser = browser
global.URL = URL
init = require('../../../add-on/src/lib/ipfs-companion')
})

beforeEach(function () {
this.timeout = 1000 * 10
browser.flush()
})

it('should query local storage for options with hardcoded defaults for fallback', async () => {
it('should query local storage for options with hardcoded defaults for fallback', async function () {
browser.storage.local.get.returns(Promise.resolve(optionDefaults))
browser.storage.local.set.returns(Promise.resolve())
const ipfsCompanion = await init()
browser.storage.local.get.calledWith(optionDefaults)
ipfsCompanion.destroy()
})

after(() => {
after(function () {
delete global.window
delete global.browser
delete global.URL
Expand All @@ -39,18 +37,18 @@ describe('init', () => {
describe.skip('onStorageChange()', function () {
let init

before(() => {
before(function () {
global.window = {}
global.browser = browser
global.URL = URL
init = require('../../../add-on/src/lib/ipfs-companion')
})

beforeEach(() => {
beforeEach(function () {
browser.flush()
})

it('should update ipfs API instance on IPFS API URL change', async () => {
it('should update ipfs API instance on IPFS API URL change', async function () {
browser.storage.local.get.returns(Promise.resolve(optionDefaults))
browser.storage.local.set.returns(Promise.resolve())
browser.browserAction.setBadgeBackgroundColor.returns(Promise.resolve())
Expand All @@ -72,7 +70,7 @@ describe.skip('onStorageChange()', function () {
ipfsCompanion.destroy()
})

after(() => {
after(function () {
delete global.window
delete global.browser
delete global.URL
Expand Down
120 changes: 118 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,12 @@ debug@2, debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3, debug@^2.6.1, d
dependencies:
ms "2.0.0"

debug@2.6.8:
version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies:
ms "2.0.0"

debug@3.1.0, debug@^3.0.1, debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
Expand Down Expand Up @@ -2368,6 +2374,14 @@ dicer@^0.2.5:
readable-stream "1.1.x"
streamsearch "0.1.2"

diff@1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/diff/-/diff-1.0.7.tgz#24bbb001c4a7d5522169e7cabdb2c2814ed91cf4"

diff@3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9"

diff@3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75"
Expand Down Expand Up @@ -3650,6 +3664,17 @@ glob-parent@^3.1.0:
is-glob "^3.1.0"
path-dirname "^1.0.0"

glob@7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.2"
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.0, glob@^7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
Expand Down Expand Up @@ -3761,6 +3786,10 @@ growl@1.10.3:
version "1.10.3"
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f"

growl@1.9.2:
version "1.9.2"
resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f"

growly@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
Expand Down Expand Up @@ -5162,6 +5191,10 @@ json-text-sequence@^0.1:
dependencies:
delimit-stream "0.1.0"

json3@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1"

json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
Expand Down Expand Up @@ -5389,7 +5422,7 @@ level-js@^2.2.4:
typedarray-to-buffer "~1.0.0"
xtend "~2.1.2"

"level-js@github:timkuijsten/level.js#idbunwrapper":
level-js@timkuijsten/level.js#idbunwrapper:
version "2.2.3"
resolved "https://codeload.github.com/timkuijsten/level.js/tar.gz/18e03adab34c49523be7d3d58fafb0c632f61303"
dependencies:
Expand Down Expand Up @@ -5760,10 +5793,41 @@ lock-me@^1.0.3:
optionalDependencies:
fs-ext "github:baudehlo/node-fs-ext#master"

lodash._baseassign@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e"
dependencies:
lodash._basecopy "^3.0.0"
lodash.keys "^3.0.0"

lodash._basecopy@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36"

lodash._basecreate@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821"

lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"

lodash._isiterateecall@^3.0.0:
version "3.0.9"
resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c"

lodash.cond@^4.3.0:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"

lodash.create@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7"
dependencies:
lodash._baseassign "^3.0.0"
lodash._basecreate "^3.0.0"
lodash._isiterateecall "^3.0.0"

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
Expand Down Expand Up @@ -5804,6 +5868,14 @@ lodash.includes@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f"

lodash.isarguments@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"

lodash.isarray@^3.0.0:
version "3.0.4"
resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55"

lodash.isequalwith@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.isequalwith/-/lodash.isequalwith-4.4.0.tgz#266726ddd528f854f21f4ea98a065606e0fbc6b0"
Expand All @@ -5820,6 +5892,14 @@ lodash.isundefined@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz#23ef3d9535565203a66cefd5b830f848911afb48"

lodash.keys@^3.0.0:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
dependencies:
lodash._getnative "^3.0.0"
lodash.isarguments "^3.0.0"
lodash.isarray "^3.0.0"

lodash.map@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
Expand Down Expand Up @@ -6180,6 +6260,15 @@ mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
dependencies:
minimist "0.0.8"

mocha-jenkins-reporter@0.3.10:
version "0.3.10"
resolved "https://registry.yarnpkg.com/mocha-jenkins-reporter/-/mocha-jenkins-reporter-0.3.10.tgz#11b04b84f7bef0ffa2baae6cf6ae9c1c2a0c121b"
dependencies:
diff "1.0.7"
mkdirp "0.5.1"
mocha "^3.0.0"
xml "^1.0.1"

mocha@4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.0.1.tgz#0aee5a95cf69a4618820f5e51fa31717117daf1b"
Expand All @@ -6195,6 +6284,23 @@ mocha@4.0.1:
mkdirp "0.5.1"
supports-color "4.4.0"

mocha@^3.0.0:
version "3.5.3"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d"
dependencies:
browser-stdout "1.3.0"
commander "2.9.0"
debug "2.6.8"
diff "3.2.0"
escape-string-regexp "1.0.5"
glob "7.1.1"
growl "1.9.2"
he "1.1.1"
json3 "3.3.2"
lodash.create "3.1.1"
mkdirp "0.5.1"
supports-color "3.1.2"

module-deps@^4.0.8:
version "4.1.1"
resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-4.1.1.tgz#23215833f1da13fd606ccb8087b44852dcb821fd"
Expand Down Expand Up @@ -6279,7 +6385,7 @@ multihashing-async@~0.4.6, multihashing-async@~0.4.7:
murmurhash3js "^3.0.1"
nodeify "^1.0.1"

"multiplex@github:dignifiedquire/multiplex":
multiplex@dignifiedquire/multiplex:
version "6.7.0"
resolved "https://codeload.github.com/dignifiedquire/multiplex/tar.gz/b5d5edd30454e2c978ee8c52df86f5f4840d2eab"
dependencies:
Expand Down Expand Up @@ -8831,6 +8937,12 @@ subtext@^5.0.0:
pez "2.x.x"
wreck "12.x.x"

supports-color@3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5"
dependencies:
has-flag "^1.0.0"

supports-color@4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e"
Expand Down Expand Up @@ -9655,6 +9767,10 @@ xml2js@~0.4.4:
sax ">=0.6.0"
xmlbuilder "~9.0.1"

xml@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"

xmlbuilder@~9.0.1:
version "9.0.4"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.4.tgz#519cb4ca686d005a8420d3496f3f0caeecca580f"
Expand Down

0 comments on commit bd5b201

Please sign in to comment.