Skip to content

Commit 0f8f031

Browse files
authored
fix #106 stop using travis.ci as it is not free anymore (#108)
1 parent c502b70 commit 0f8f031

File tree

9 files changed

+150
-50
lines changed

9 files changed

+150
-50
lines changed

.github/workflows/ci.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types: [published]
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
env:
14+
PRIMARY_NODE_VERSION: 16.x
15+
PRIMARY_OS: ubuntu-latest
16+
REGISTRY: https://registry.npmjs.org/
17+
18+
jobs:
19+
test:
20+
name: CI
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
os: [ubuntu-latest, macos-latest]
25+
node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 16.x]
26+
27+
steps:
28+
29+
- name: Echo env variables
30+
run: |
31+
echo ref: ${{ github.event.client_payload.ref || github.ref }}
32+
echo sha: ${{ github.event.client_payload.sha || github.sha }}
33+
echo head ref: ${{ github.event.client_payload.head_ref || github.head_ref }}
34+
echo base ref: ${{ github.event.client_payload.base_ref || github.base_ref }}
35+
echo action: ${{ github.action }}
36+
echo event: ${{ github.event_name }}
37+
38+
- uses: actions/checkout@v2
39+
name: Checkout
40+
with:
41+
ref: ${{ github.event.client_payload.ref || github.ref }}
42+
43+
- name: Use Node.js ${{ matrix.node-version }}
44+
uses: actions/setup-node@v2
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
- name: Get npm cache directory
48+
id: npm-cache-dir
49+
run: |
50+
echo "::set-output name=dir::$(npm config get cache)"
51+
52+
- uses: actions/cache@v2
53+
id: npm-cache
54+
with:
55+
path: ${{ steps.npm-cache-dir.outputs.dir }}
56+
key: ${{ matrix.os }}-${{ matrix.node-version }}-node
57+
restore-keys: |
58+
${{ matrix.os }}-${{ matrix.node-version }}-node
59+
60+
- name: Install dependencies and build
61+
run: |
62+
npm install
63+
npm run build
64+
65+
- name: Snyk security check
66+
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
67+
uses: snyk/actions/node@master
68+
env:
69+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
70+
71+
- name: Run unit tests with coverage
72+
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
73+
uses: paambaati/codeclimate-action@v2.7.5
74+
env:
75+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
76+
with:
77+
coverageCommand: npm run cover
78+
79+
- name: Run unit tests
80+
if: "!(matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS)"
81+
run: npm run test
82+
83+
publish_version:
84+
name: Publish
85+
runs-on: ${{ matrix.os }}
86+
strategy:
87+
matrix:
88+
os: [ubuntu-latest]
89+
node-version: [6.x]
90+
needs: [test]
91+
if: github.event_name == 'release' && github.event.action == 'published'
92+
steps:
93+
94+
- name: Checkout
95+
uses: actions/checkout@v2
96+
97+
- name: fetch
98+
run: |
99+
git fetch --prune --unshallow
100+
101+
- name: Use Node.js ${{ matrix.node-version }}
102+
uses: actions/setup-node@v2
103+
with:
104+
node-version: ${{ matrix.node-version }}
105+
registry-url: ${{ env.REGISTRY }}
106+
107+
- name: Get npm cache directory
108+
id: npm-cache-dir
109+
run: |
110+
echo "::set-output name=dir::$(npm config get cache)"
111+
112+
- uses: actions/cache@v2
113+
id: npm-cache
114+
with:
115+
path: ${{ steps.npm-cache-dir.outputs.dir }}
116+
key: ${{ matrix.os }}-${{ matrix.node-version }}-node
117+
restore-keys: |
118+
${{ matrix.os }}-${{ matrix.node-version }}-node
119+
120+
- name: Install dependencies and build
121+
run: |
122+
npm install
123+
npm run build
124+
125+
- name: Publish
126+
uses: JS-DevTools/npm-publish@v1
127+
with:
128+
token: ${{ secrets.NPM_AUTH_TOKEN }}
129+
registry: ${{ env.REGISTRY }}

.travis.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[![Npm Version](https://img.shields.io/npm/v/squiss-ts.svg?style=popout)](https://www.npmjs.com/package/squiss-ts)
22
![node](https://img.shields.io/node/v-lts/squiss-ts)
33
[![Build Status](https://travis-ci.com/PruvoNet/squiss-ts.svg?branch=master)](https://travis-ci.com/PruvoNet/squiss-ts)
4-
[![Test Coverage](https://api.codeclimate.com/v1/badges/64f26f52c548c8d1e010/test_coverage)](https://codeclimate.com/github/PruvoNet/squiss-ts/test_coverage)
5-
[![Maintainability](https://api.codeclimate.com/v1/badges/64f26f52c548c8d1e010/maintainability)](https://codeclimate.com/github/PruvoNet/squiss-ts/maintainability)
4+
[![Test Coverage](https://api.codeclimate.com/v1/badges/177b18abdb55fdf90cf8/test_coverage)](https://codeclimate.com/github/PruvoNet/squiss-ts/test_coverage)
5+
[![Maintainability](https://api.codeclimate.com/v1/badges/177b18abdb55fdf90cf8/maintainability)](https://codeclimate.com/github/PruvoNet/squiss-ts/maintainability)
66
[![Known Vulnerabilities](https://snyk.io/test/github/PruvoNet/squiss-ts/badge.svg?targetFile=package.json)](https://snyk.io/test/github/PruvoNet/squiss-ts?targetFile=package.json)
77
[![dependencies Status](https://david-dm.org/PruvoNet/squiss-ts/status.svg)](https://david-dm.org/PruvoNet/squiss-ts)
88
[![devDependencies Status](https://david-dm.org/PruvoNet/squiss-ts/dev-status.svg)](https://david-dm.org/PruvoNet/squiss-ts?type=dev)

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "squiss-ts",
3-
"version": "4.1.1",
3+
"version": "4.2.0",
44
"description": "High-volume SQS poller",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -49,9 +49,9 @@
4949
"dependencies": {
5050
"aws-sdk": "^2.720.0",
5151
"linked-list": "^2.1.0",
52-
"semver": "^7.3.2",
52+
"semver": "^7.3.5",
5353
"ts-type-guards": "^0.7.0",
54-
"uuid": "^8.2.0"
54+
"uuid": "^8.3.2"
5555
},
5656
"devDependencies": {
5757
"@istanbuljs/nyc-config-typescript": "0.1.3",
@@ -73,8 +73,8 @@
7373
"sinon": "^9.0.2",
7474
"sinon-chai": "^3.5.0",
7575
"source-map-support": "^0.5.19",
76-
"ts-node": "^8.10.2",
76+
"ts-node": "^9.1.1",
7777
"tslint": "^6.1.2",
78-
"typescript": "^3.9.7"
78+
"typescript": "^4.3.5"
7979
}
8080
}

src/Squiss.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Squiss extends (EventEmitter as new() => SquissEmitter) {
4141
private _queueMaximumMessageSize = 0;
4242
private _queueUrl: string;
4343
private _delQueue = new Map<string, IDeleteQueueItem>();
44-
private _delTimer: number | undefined;
44+
private _delTimer: any;
4545
private _activeReq: AWS.Request<SQS.Types.ReceiveMessageResult, AWS.AWSError> | undefined;
4646

4747
constructor(opts?: ISquissOptions | undefined) {
@@ -145,7 +145,7 @@ export class Squiss extends (EventEmitter as new() => SquissEmitter) {
145145
return this.sqs.getQueueUrl(params).promise().then((data) => {
146146
this._queueUrl = data.QueueUrl!;
147147
if (this._opts.correctQueueUrl) {
148-
const newUrl = url.parse(this.sqs.config.endpoint!);
148+
const newUrl = url.parse(this.sqs.config.endpoint as string);
149149
const parsedQueueUrl = url.parse(this._queueUrl);
150150
newUrl.pathname = parsedQueueUrl.pathname;
151151
this._queueUrl = url.format(newUrl);

src/gzipUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Compress = (buf: Buffer) => Promise<Buffer>;
99
let compress: Compress;
1010
let decompress: Compress;
1111

12+
/* istanbul ignore next */
1213
if (gte(process.version, '10.16.0')) {
1314
const {brotliCompress, brotliDecompress} = require('zlib');
1415
const {promisify} = require('util');

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
/* istanbul ignore file */
34
export {SQS, S3} from 'aws-sdk';
45
export {Squiss} from './Squiss';
56
export {

src/test/src/Message.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'use strict';
22

3-
import {Message, Squiss} from '../../';
3+
import {IMessageAttributes, Message, Squiss, SQS, S3} from '../../';
44
import {SquissStub} from '../stubs/SquissStub';
5-
import {SQS, S3} from 'aws-sdk';
65
import {Blobs, S3Stub} from '../stubs/S3Stub';
76
import delay from 'delay';
87

@@ -67,6 +66,9 @@ describe('Message', () => {
6766
s3Retriever: getS3Stub(),
6867
s3Retain: false,
6968
});
69+
const attributes: IMessageAttributes = msg.attributes;
70+
attributes.should.have.property('SomeNumber').equal(1);
71+
attributes.should.have.property('SomeString').equal('s');
7072
msg.should.have.property('body').equal('foo');
7173
msg.should.have.property('subject').equal('some-subject');
7274
msg.should.have.property('topicArn').equal(snsMsg.TopicArn);

src/test/src/index.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import * as AWS from 'aws-sdk';
1818
import {ISquissOptions, Squiss} from '../../';
1919
import {SQSStub} from '../stubs/SQSStub';
2020
import delay from 'delay';
21-
import {IMessageOpts, Message } from '../../Message';
21+
import {Message } from '../../';
22+
import {IMessageOpts } from '../../Message';
2223
// @ts-ignore
2324
import * as sinon from 'sinon';
2425
import * as chai from 'chai';
@@ -714,7 +715,10 @@ describe('index', () => {
714715
Body: 'baz',
715716
},
716717
} as IMessageOpts);
717-
inst!.deleteMessage(msg);
718+
inst!.deleteMessage(msg)
719+
.catch(() => {
720+
// DO NOTHING
721+
});
718722
return wait().then(() => {
719723
spy.should.be.calledOnce();
720724
spy.should.be.calledWith(

0 commit comments

Comments
 (0)