Skip to content

Commit

Permalink
Travis CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonnilsson committed Jul 2, 2020
1 parent 829da2d commit c76a564
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 75 deletions.
97 changes: 51 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,59 @@
language: node_js
node_js:
- 10
- 12
- 14
- lts/*
os:
- windows
- linux
- osx
stages:
- Lint
- Test
- name: Github Release
if: branch = master AND tag IS present
- name: NPM Release
if: branch = master AND tag IS present
cache:
directories:
- node_modules

- node_modules
jobs:
include:
- stage: Lint
os: linux
node_js: lts/*
script: npm run lint

- stage: lint
language: node_js
node_js: lts/*
script: npm run lint

- stage: test
language: node_js
node_js:
- 10
- 12
- 14
- lts/*
os:
- windows
- linux
- osx
script: npm test
after_success: npm run coveralls
- stage: Test
script: npm test
after_success: npm run coveralls

- stage: build
language: node_js
node_js: lts/*
script: npm run build
- stage: Github Release
os: linux
language: shell
script: npm run build && echo "Deploying to github..."
deploy:
provider: releases
api_key: "$GITHUB_API_KEY"
file_glob: true
skip_cleanup: true
cleanup: false
file:
- "build/ios-uploader-*"
on:
branch: master
tags: true

- stage: npm release
language: node_js
node_js: lts/*
script: echo "Deploying to npm..."
deploy:
provider: npm
email: simon@nilsson.ml
api_key: "$NPM_API_KEY"
on:
tags: true
- stage: NPM Release
os: linux
node_js: lts/*
script: echo "Deploying to npm..."
deploy:
provider: npm
email: simon@nilsson.ml
api_key: "$NPM_API_KEY"
on:
branch: master
tags: true

- stage: github release
language: minimal
script: echo "Deploying to github..."
deploy:
provider: releases
api_key: "$GITHUB_API_KEY"
file_glob: true
file:
- "build/ios-uploader-*"
skip_cleanup: true
on:
tags: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![npm](https://img.shields.io/npm/v/ios-uploader.svg?style=flat-square)](https://www.npmjs.org/package/ios-uploader)
[![build](https://img.shields.io/travis/simonnilsson/ios-uploader/master.svg?style=flat-square)](https://travis-ci.org/simonnilsson/ios-uploader)
[![coverage](https://coveralls.io/repos/simonnilsson/ios-uploader/badge.svg?branch=master)](https://coveralls.io/r/simonnilsson/ios-uploader?branch=master)
[![coverage](https://coveralls.io/repos/github/simonnilsson/ios-uploader/badge.svg?branch=master)](https://coveralls.io/github/simonnilsson/ios-uploader?branch=master)
[![install size](https://packagephobia.com/badge?p=ios-uploader)](https://packagephobia.com/result?p=ios-uploader)

Easy to use, cross-platform tool to upload an iOS app to iTunes Connect.
Expand Down
6 changes: 3 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('lib/index', () => {
fileModifiedTime: TEST_CTX.fileModifiedTime,
fileChecksum: TEST_CTX.fileChecksum,
metadataBuffer: sinon.match.instanceOf(Buffer),
metadataChecksum: TEST_CTX.metadataChecksum,
metadataCompressed: TEST_CTX.metadataCompressed,
metadataSize: TEST_CTX.metadataSize
metadataChecksum: sinon.match.string,
metadataCompressed: sinon.match.string,
metadataSize: sinon.match.number
};
sinon.assert.match(ctx, Object.assign({}, METADATA_INPUT, EXPECTED_METADATA));
});
Expand Down
61 changes: 36 additions & 25 deletions test/utility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,37 +100,42 @@ describe('lib/utility', () => {
before(() => {
let readStreamStub = sinon.stub(fs, 'createReadStream');
readStreamStub.withArgs(sinon.match.string, sinon.match({ fd: 1 })).callsFake(() => {
let s = new stream.Readable();
s.push('data');
s.push(null);
return s;
return new stream.Readable({
read: function() {
this.push('data');
this.push(null);
}
});
});

readStreamStub.withArgs(sinon.match.string, sinon.match({ fd: 0 })).callsFake(() => {
let s = new stream.Readable();
s.push('error');
s.push(null);
return s;
return new stream.Readable({
read: function() {
this.push('error');
this.push(null);
}
});
});

readStreamStub.withArgs(sinon.match.string, sinon.match({ fd: 2 })).callsFake(() => {
let s = new stream.Readable();
s.push('empty');
s.push(null);
return s;
return new stream.Readable({
read: function() {
this.push('empty');
this.push(null);
}
});
});

let unzipperStub = sinon.stub(unzipper, 'ParseOne');

unzipperStub.callsFake(() => {
let ws = new stream.Writable({
write: (s) => {
if (s.toString() === 'data') ws.emit('data', TEST_PLIST);
if (s.toString() === 'error') ws.emit('error', new Error());
ws.emit('end');
return new stream.Writable({
write: function(s) {
if (s.toString() === 'data') this.emit('data', TEST_PLIST);
if (s.toString() === 'error') this.emit('error', new Error());
this.emit('end');
}
});
return ws;
});

});
Expand Down Expand Up @@ -205,14 +210,20 @@ describe('lib/utility', () => {
before(() => {
let stub = sinon.stub(fs, 'createReadStream');
stub.withArgs(sinon.match.string, sinon.match({ fd: 1 })).callsFake(() => {
let s = new stream.Readable();
s.push('data');
s.push(null);
return s;
return new stream.Readable({
read: function() {
this.push('data');
this.push(null);
}
});
});
stub.withArgs(sinon.match.string, sinon.match({ fd: 0 })).callsFake(() => {
let s = new stream.Readable();
return s;
return new stream.Readable({
read: function() {
this.emit('error', new Error());
this.push(null);
}
});
});
});

Expand Down Expand Up @@ -276,7 +287,7 @@ describe('lib/utility', () => {

it('should return correct md5 hash buffer', async () => {
let gzBase64 = await utility.bufferToGZBase64(Buffer.from('data'));
assert.deepEqual(gzBase64, 'H4sIAAAAAAAACktJLEkEAGPz860EAAAA');
assert(typeof gzBase64 === 'string');
});

it('should reject with error on failure', async () => {
Expand Down

0 comments on commit c76a564

Please sign in to comment.