Skip to content

Commit

Permalink
fix #106 stop using travis.ci as it is not free anymore (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr authored Jul 14, 2021
1 parent c502b70 commit 0f8f031
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 50 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: CI

on:
push:
branches:
- master
release:
types: [published]
pull_request:
branches:
- '**'

env:
PRIMARY_NODE_VERSION: 16.x
PRIMARY_OS: ubuntu-latest
REGISTRY: https://registry.npmjs.org/

jobs:
test:
name: CI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 16.x]

steps:

- name: Echo env variables
run: |
echo ref: ${{ github.event.client_payload.ref || github.ref }}
echo sha: ${{ github.event.client_payload.sha || github.sha }}
echo head ref: ${{ github.event.client_payload.head_ref || github.head_ref }}
echo base ref: ${{ github.event.client_payload.base_ref || github.base_ref }}
echo action: ${{ github.action }}
echo event: ${{ github.event_name }}
- uses: actions/checkout@v2
name: Checkout
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.node-version }}-node
restore-keys: |
${{ matrix.os }}-${{ matrix.node-version }}-node
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Snyk security check
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Run unit tests with coverage
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: npm run cover

- name: Run unit tests
if: "!(matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS)"
run: npm run test

publish_version:
name: Publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [6.x]
needs: [test]
if: github.event_name == 'release' && github.event.action == 'published'
steps:

- name: Checkout
uses: actions/checkout@v2

- name: fetch
run: |
git fetch --prune --unshallow
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: ${{ env.REGISTRY }}

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.node-version }}-node
restore-keys: |
${{ matrix.os }}-${{ matrix.node-version }}-node
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
registry: ${{ env.REGISTRY }}
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![Npm Version](https://img.shields.io/npm/v/squiss-ts.svg?style=popout)](https://www.npmjs.com/package/squiss-ts)
![node](https://img.shields.io/node/v-lts/squiss-ts)
[![Build Status](https://travis-ci.com/PruvoNet/squiss-ts.svg?branch=master)](https://travis-ci.com/PruvoNet/squiss-ts)
[![Test Coverage](https://api.codeclimate.com/v1/badges/64f26f52c548c8d1e010/test_coverage)](https://codeclimate.com/github/PruvoNet/squiss-ts/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/64f26f52c548c8d1e010/maintainability)](https://codeclimate.com/github/PruvoNet/squiss-ts/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/177b18abdb55fdf90cf8/test_coverage)](https://codeclimate.com/github/PruvoNet/squiss-ts/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/177b18abdb55fdf90cf8/maintainability)](https://codeclimate.com/github/PruvoNet/squiss-ts/maintainability)
[![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)
[![dependencies Status](https://david-dm.org/PruvoNet/squiss-ts/status.svg)](https://david-dm.org/PruvoNet/squiss-ts)
[![devDependencies Status](https://david-dm.org/PruvoNet/squiss-ts/dev-status.svg)](https://david-dm.org/PruvoNet/squiss-ts?type=dev)
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "squiss-ts",
"version": "4.1.1",
"version": "4.2.0",
"description": "High-volume SQS poller",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -49,9 +49,9 @@
"dependencies": {
"aws-sdk": "^2.720.0",
"linked-list": "^2.1.0",
"semver": "^7.3.2",
"semver": "^7.3.5",
"ts-type-guards": "^0.7.0",
"uuid": "^8.2.0"
"uuid": "^8.3.2"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "0.1.3",
Expand All @@ -73,8 +73,8 @@
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
"source-map-support": "^0.5.19",
"ts-node": "^8.10.2",
"ts-node": "^9.1.1",
"tslint": "^6.1.2",
"typescript": "^3.9.7"
"typescript": "^4.3.5"
}
}
4 changes: 2 additions & 2 deletions src/Squiss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Squiss extends (EventEmitter as new() => SquissEmitter) {
private _queueMaximumMessageSize = 0;
private _queueUrl: string;
private _delQueue = new Map<string, IDeleteQueueItem>();
private _delTimer: number | undefined;
private _delTimer: any;
private _activeReq: AWS.Request<SQS.Types.ReceiveMessageResult, AWS.AWSError> | undefined;

constructor(opts?: ISquissOptions | undefined) {
Expand Down Expand Up @@ -145,7 +145,7 @@ export class Squiss extends (EventEmitter as new() => SquissEmitter) {
return this.sqs.getQueueUrl(params).promise().then((data) => {
this._queueUrl = data.QueueUrl!;
if (this._opts.correctQueueUrl) {
const newUrl = url.parse(this.sqs.config.endpoint!);
const newUrl = url.parse(this.sqs.config.endpoint as string);
const parsedQueueUrl = url.parse(this._queueUrl);
newUrl.pathname = parsedQueueUrl.pathname;
this._queueUrl = url.format(newUrl);
Expand Down
1 change: 1 addition & 0 deletions src/gzipUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Compress = (buf: Buffer) => Promise<Buffer>;
let compress: Compress;
let decompress: Compress;

/* istanbul ignore next */
if (gte(process.version, '10.16.0')) {
const {brotliCompress, brotliDecompress} = require('zlib');
const {promisify} = require('util');
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* istanbul ignore file */
export {SQS, S3} from 'aws-sdk';
export {Squiss} from './Squiss';
export {
Expand Down
6 changes: 4 additions & 2 deletions src/test/src/Message.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

import {Message, Squiss} from '../../';
import {IMessageAttributes, Message, Squiss, SQS, S3} from '../../';
import {SquissStub} from '../stubs/SquissStub';
import {SQS, S3} from 'aws-sdk';
import {Blobs, S3Stub} from '../stubs/S3Stub';
import delay from 'delay';

Expand Down Expand Up @@ -67,6 +66,9 @@ describe('Message', () => {
s3Retriever: getS3Stub(),
s3Retain: false,
});
const attributes: IMessageAttributes = msg.attributes;
attributes.should.have.property('SomeNumber').equal(1);
attributes.should.have.property('SomeString').equal('s');
msg.should.have.property('body').equal('foo');
msg.should.have.property('subject').equal('some-subject');
msg.should.have.property('topicArn').equal(snsMsg.TopicArn);
Expand Down
8 changes: 6 additions & 2 deletions src/test/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import * as AWS from 'aws-sdk';
import {ISquissOptions, Squiss} from '../../';
import {SQSStub} from '../stubs/SQSStub';
import delay from 'delay';
import {IMessageOpts, Message } from '../../Message';
import {Message } from '../../';
import {IMessageOpts } from '../../Message';
// @ts-ignore
import * as sinon from 'sinon';
import * as chai from 'chai';
Expand Down Expand Up @@ -714,7 +715,10 @@ describe('index', () => {
Body: 'baz',
},
} as IMessageOpts);
inst!.deleteMessage(msg);
inst!.deleteMessage(msg)
.catch(() => {
// DO NOTHING
});
return wait().then(() => {
spy.should.be.calledOnce();
spy.should.be.calledWith(
Expand Down

0 comments on commit 0f8f031

Please sign in to comment.