Skip to content

Commit

Permalink
Merge pull request #23 from Losant/SP-13330
Browse files Browse the repository at this point in the history
[SP-13330] housekeeping, switch away from travis
  • Loading branch information
eeerin authored Aug 30, 2024
2 parents 39c5998 + 4730776 commit eec5639
Show file tree
Hide file tree
Showing 11 changed files with 1,637 additions and 1,499 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run Tests

on:
push:
branches:
- master
pull_request:
types: ['opened', 'reopened', 'synchronize']

jobs:
test:
strategy:
matrix:
nodejs: [ '18', '20', '22' ]
redis-version: [4, 5, 6, 7]
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
pull-requests: write
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.nodejs }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodejs }}
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --frozen-lockfile
- run: yarn test
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.2
20.16.0
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

***

## 0.5.2 - 2024-08-29

- Switch from Travis to Github Actions.
- Add Node 22 to test suite.
- Update development/test dependencies.

## 0.5.1 - 2023-11-09

- Add type definitions.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Losant
Copyright (c) 2024 Losant

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Node Redis GCRA Library

[![Build Status](https://api.travis-ci.com/Losant/redis-gcra.svg?branch=master)](https://travis-ci.com/Losant/redis-gcra) [![npm version](https://badge.fury.io/js/redis-gcra.svg)](https://badge.fury.io/js/redis-gcra)
![Build Status](https://github.com/Losant/redis-gcra/actions/workflows/test.yml/badge.svg?branch=master) [![npm version](https://badge.fury.io/js/redis-gcra.svg)](https://badge.fury.io/js/redis-gcra)

This module is an implementation of [GCRA](https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm) for rate limiting based on [Redis](https://redis.io/).

Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redis-gcra",
"version": "0.5.1",
"version": "0.5.2",
"description": "Rate limiting based on Generic Cell Rate Algorithm",
"main": "lib/index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -31,8 +31,7 @@
"lint:changed": "lint-staged",
"test": "mocha test 2>&1",
"test:watch": "mocha --watch test 2>&1",
"reinstall": "rm -rf node_modules && yarn install",
"prepare": "husky install"
"reinstall": "rm -rf node_modules && yarn install"
},
"repository": {
"type": "git",
Expand All @@ -43,9 +42,9 @@
},
"devDependencies": {
"@losant/eslint-config-losant": "^1.6.1",
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"mocha": "^10.2.0",
"husky": "^9.1.5",
"lint-staged": "^15.2.9",
"mocha": "^10.7.3",
"should": "^13.2.3",
"ioredis": ">=4.0.0 <6.0.0",
"redis": ">=4.1.0 <5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion test/ioredis-gcra-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const RedisGCRA = require('../lib');

describe('ioRedis-RedisGCRA', () => {
before(() => {
this.redis = new Redis({ db: 4 });
this.redis = new Redis({ db: 4, host: process.env.REDIS_HOST || 'localhost' });
this.redis.on('error', (err) => { throw err; });
this.limiter = RedisGCRA({ redis: this.redis });
});
Expand Down
3 changes: 2 additions & 1 deletion test/node-redis-gcra-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const RedisGCRA = require('../lib');
describe('Node-Redis-RedisGCRA', () => {
before(async () => {
this.redis = Redis.createClient({
scripts: RedisGCRA.defineNodeRedisScripts(Redis)
scripts: RedisGCRA.defineNodeRedisScripts(Redis),
url: `redis://@${process.env.REDIS_HOST || 'localhost'}/4`
});
await this.redis.connect();
this.redis.on('error', (err) => { throw err; });
Expand Down
Loading

0 comments on commit eec5639

Please sign in to comment.