Skip to content

Commit

Permalink
ci: separate build & test stages
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 29, 2019
1 parent ce07285 commit c3063d0
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ npm-debug.log
.DS_Store
.esm-cache

# Bundle
target

# Typescript
*.tsbuildinfo
.tsbuildinfo
Expand Down
49 changes: 44 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
language: node_js
node_js:
- "8"
- "10"
- "12"
- "13"
sudo: false

install: skip
before_install: skip
before_script: skip
script: skip

env:
- CACHE_NAME=${TRAVIS_OS_NAME}-${CC}-ALL_IN_ONE
- CASHER_DIR=${TRAVIS_HOME}/.casher

cache:
directories:
- ./target
- target
- node_modules

stages:
- build
- test

jobs:
include:
- stage: build
node_js:
- "12"
install:
- echo "target dir content:"
- ls -l target
- yarn install
- yarn build
- echo "target dir content:"
- ls -l target
script: skip
- stage: test
node_js:
- "6"
- "8"
- "10"
- "12"
- "13"
install:
- echo "target dir content:"
- ls -l target
before_install: skip
before_script: skip
script:
- yarn test
59 changes: 0 additions & 59 deletions example/jsonrpc.js

This file was deleted.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
],
"license": "MIT",
"version": "2.1.0",
"source": "src/main/ts/index.ts",
"main": "jsonrpc.js",
"module": "jsonrpc.mjs",
"unpkg": "jsonrpc.umd.js",
"browser": "jsonrpc.umd.js",
"types": "jsonrpc.d.ts",
"source": "target/jsonrpc.ts",
"main": "target/jsonrpc.js",
"module": "target/jsonrpc.mjs",
"unpkg": "target/jsonrpc.umd.js",
"browser": "target/jsonrpc.umd.js",
"types": "target/jsonrpc.d.ts",
"typescript": {
"definition": "jsonrpc.d.ts"
"definition": "target/jsonrpc.d.ts"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -42,10 +42,11 @@
},
"scripts": {
"build:tsc": "tsc -p tsconfig.build.json",
"build:microbundle": "microbundle jsonrpc.ts --name jsonrpc --strict",
"build": "yarn build:microbundle",
"build:target": "rm -rf ./target && mkdir -p ./target && find . -name \"jsonrpc.*\" -exec cp '{}' ./target/ \\;",
"build:microbundle": "microbundle build jsonrpc.ts --name jsonrpc --strict",
"build": "yarn build:microbundle && yarn build:target",
"lint": "tslint -p tsconfig.json -t stylish jsonrpc.ts",
"test": "npm run lint && tman"
"test": "yarn lint && tman"
},
"files": [
"README.md",
Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
const assert = require('assert')
const tman = require('tman')

test(require('../jsonrpc.js'))
test(require('../jsonrpc.umd'))
test(require('esm')(module)('../jsonrpc.mjs'))
test(require('../target/jsonrpc.js'))
test(require('../target/jsonrpc.umd'))
test(require('esm')(module)('../target/jsonrpc.mjs'))

require('ts-node/register')
test(require('../jsonrpc.ts').default)
test(require('../target/jsonrpc.ts').default)

function test (jsonrpc) {
tman.suite('jsonrpc', function () {
Expand Down

0 comments on commit c3063d0

Please sign in to comment.