Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SP-13330] housekeeping, switch away from travis #23

Merged
merged 9 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run Tests

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

jobs:
test:
strategy:
matrix:
nodejs: [ '18', '20', '21', '22' ]
spacetc62 marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
container: ubuntu:latest
permissions:
actions: write
contents: read
pull-requests: write
services:
redis:
image: redis
spacetc62 marked this conversation as resolved.
Show resolved Hide resolved
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
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 }}
- run: npm install -g [email protected]
- run: yarn install --frozen-lockfile
- name: 'Run Tests'
run: yarn test
env:
REDIS_HOST: redis
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
Loading