Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: add ci
Browse files Browse the repository at this point in the history
fix: update lock

fix: ignore packages

fix: fix deps and add lock

fix: fix deps 2

fix: ignore packages 2

fix: add mocha reporter to karma

fix: remove unused cmd

chore: update lock

feat: add gitattributes

feat: test attributes

feat: test attributes 2

fix: fix stderr match

fix: fix more files line endings

fix: fix line ending

chore: remove lock

chore: fix win test run

chore: ignore lock

chore: change to yarn

chore: fix cov

chore: fix cov
  • Loading branch information
hugomrdias committed Nov 30, 2018
1 parent ce4ff3e commit b9eb997
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const path = require('path')
const IPFSFactory = require('ipfsd-ctl')
const parallel = require('async/parallel')
const MockPreloadNode = require('./test/utils/mock-preload-node')
Expand All @@ -21,6 +22,39 @@ module.exports = {
included: false
}],
browserNoActivityTimeout: 100 * 1000,
reporters: ['mocha-own', 'coverage-istanbul'],
coverageIstanbulReporter: {
reports: ['json'],
dir: path.join(__dirname, 'coverage'),
combineBrowserReports: true,
fixWebpackSourcePaths: true,
},
preprocessors: { 'node_modules/aegir/src/config/karma-entry.js': [ 'webpack', 'sourcemap' ] },
webpack: {
module: {
rules: [
// instrument only testing sources with Istanbul
{
test: /\.js$/,
use: { loader: 'istanbul-instrumenter-loader' },
include: path.resolve('src/')
}
]
}
},
customLaunchers: {
ChromeDocker: {
base: 'ChromeHeadless',
// We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs
// more permissions than Docker allows by default)
flags: ['--no-sandbox']
}
},
client: {
mocha: {
bail: true,
}
},
singleRun: true
},
hooks: {
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
test/** text eol=lf
src/init-files/** text eol=lf
99 changes: 99 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
image: hugomrdias/node-alpine:test
stages:
- check
- test
- cov
- pre-release
- release

variables:
DOCKER_DRIVER: overlay2

before_script:
- yarn

check:
stage: check
script:
- yarn lint
- yarn dep-check
# - npm install --no-lockfile @commitlint/config-conventional @commitlint/cli --save-dev
# - npx commitlint --extends=@commitlint/config-conventional --from=$CI_COMMIT_BEFORE_SHA --to=$CI_COMMIT_SHA
- yarn build
artifacts:
paths:
- dist/

linux-node-10:
image: node:10
stage: test
script:
- npx nyc -s npm run test:node -- --bail
artifacts:
paths:
- .nyc_output/

linux-node-11:
allow_failure: true
image: node:11
stage: test
script:
- npx nyc -s npm run test:node -- --bail
artifacts:
paths:
- .nyc_output/

macos-node-10:
stage: test
script:
- npx nyc -s npm run test:node -- --bail
tags:
- mac
artifacts:
paths:
- .nyc_output/

win-node-10:
stage: test
script:
- npx nyc -s npm run test:node -- --bail
tags:
- win
artifacts:
paths:
- .nyc_output/

test-browser-chrome:
image: hugomrdias/node-chrome:test
stage: test
script:
- AEGIR_BROWSERS=ChromeDocker yarn test:browser
artifacts:
paths:
- coverage/

test-browser-firefox:
allow_failure: true
image: hugomrdias/node-firefox:test
stage: test
script:
- AEGIR_BROWSERS=FirefoxHeadless yarn test:browser
artifacts:
paths:
- coverage/

cov:
stage: cov
before_script: []
script:
- cp coverage/coverage-final.json .nyc_output/browser.json
- npx nyc report --reporter text-summary --reporter html
dependencies:
- linux-node-10
- win-node-10
- macos-node-10
- test-browser-chrome
artifacts:
paths:
- coverage/
coverage: '/Lines : \d+\.\d+/'
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"release-major": "aegir release --type major -t node -t browser",
"coverage": "aegir coverage",
"coverage-publish": "aegir-coverage publish",
"dep-check": "npx dependency-check package.json './test/**/*.js' './src/**/*.js'"
"dep-check": "npx dependency-check package.json './test/**/*.js' './src/**/*.js' -i electron-webrtc -i wrtc"
},
"repository": {
"type": "git",
Expand All @@ -71,6 +71,8 @@
"hat": "0.0.3",
"interface-ipfs-core": "~0.88.0",
"ipfsd-ctl": "~0.40.1",
"istanbul-instrumenter-loader": "^3.0.1",
"karma-coverage-istanbul-reporter": "^2.0.4",
"ncp": "^2.0.0",
"qs": "^6.5.2",
"rimraf": "^2.6.2",
Expand Down
2 changes: 1 addition & 1 deletion test/cli/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('config', () => runOnAndOff((thing) => {

it('call config with no arguments', () => {
return ipfs('config')
.then(out => expect(out).to.include('bin.js config <key> [value]'))
.then(out => expect(out).to.include('Not enough non-option arguments: got 0, need at least 1'))
})
})

Expand Down

0 comments on commit b9eb997

Please sign in to comment.