Skip to content

Commit

Permalink
test: run ci on github action (#43)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

- **CI/CD Updates**
  - Migrated from Travis CI to GitHub Actions
- Added new workflows for Node.js testing, package publishing, and
release management
  - Updated repository and homepage references

- **Configuration Changes**
- Removed `.autod.conf.js`, `.travis.yml`, and GitHub pull request
template

- **Documentation**
  - Updated README with new badges and minor text corrections
  - Added Contributors section to README

- **Package Management**
  - Simplified CI script configuration
  - Updated package versions and added new dependencies

- **Test Updates**
- Marked specific Redis-related test cases as skipped for future
implementation

- **Code Refactoring**
- Reorganized structure of HomeController and updated import statements
for clarity
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 authored Jan 19, 2025
1 parent 511c75c commit b99cb96
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 120 deletions.
26 changes: 0 additions & 26 deletions .autod.conf.js

This file was deleted.

24 changes: 0 additions & 24 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test-mysql.yml@master
with:
version: '16, 18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Any Commit
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Build
run: npm run prepublishOnly --if-present

- run: npx pkg-pr-new publish
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release

on:
push:
branches: [ master ]

jobs:
release:
name: Node.js
uses: eggjs/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

File renamed without changes.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
# egg-redis

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Node.js CI](https://github.com/eggjs/redis/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/redis/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[![Node.js Version](https://img.shields.io/node/v/egg-redis.svg?style=flat)](https://nodejs.org/en/download/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/eggjs/redis)

[npm-image]: https://img.shields.io/npm/v/egg-redis.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-redis
[travis-image]: https://img.shields.io/travis/eggjs/egg-redis.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-redis
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-redis.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-redis?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-redis.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-redis
[codecov-image]: https://codecov.io/gh/eggjs/redis/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/eggjs/redis
[snyk-image]: https://snyk.io/test/npm/egg-redis/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-redis
[download-image]: https://img.shields.io/npm/dm/egg-redis.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-redis

Redis client(support redis portocal) based on ioredis for egg framework
Redis client(support redis protocol) based on ioredis for egg framework

## Install

```bash
$ npm i egg-redis --save
npm i egg-redis --save
```

redis Plugin for egg, support egg application access to redis.
Expand Down Expand Up @@ -97,20 +95,18 @@ config.redis = {

**No password**

Redis support no authentication access, but we are highly recommand you to use redis `requirepass` in `redis.conf`.
Redis support no authentication access, but we are highly recommend you to use redis `requirepass` in `redis.conf`.

```bash

$vim /etc/redis/redis.conf

requirepass xxxxxxxxxx // xxxxxxxxxx is your password

```

Because it may be cause security risk, refer:

- https://ruby-china.org/topics/28094
- https://zhuoroger.github.io/2016/07/29/redis-sec/
- <https://ruby-china.org/topics/28094>
- <https://zhuoroger.github.io/2016/07/29/redis-sec/>

If you want to access redis with no password, use `password: null`.

Expand Down Expand Up @@ -187,7 +183,6 @@ module.exports = app => {
};
```


### Clients Depend on Redis Cluster

Before you start to use Redis Cluster, please checkout the [document](https://redis.io/topics/cluster-tutorial) first, especially confirm `cluster-enabled yes` in Redis Cluster configuration file.
Expand Down Expand Up @@ -232,11 +227,16 @@ module.exports = app => {
};
```


## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues).

## License

[MIT](LICENSE)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/redis)](https://github.com/eggjs/redis/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
29 changes: 11 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,36 @@
"ioredis": "^4.9.0"
},
"devDependencies": {
"@types/node": "^10.9.4",
"@types/node": "^22.10.7",
"autod": "^3.1.0",
"egg": "^2.21.1",
"egg-bin": "^4.13.0",
"egg-ci": "^1.11.0",
"egg-mock": "^3.22.2",
"egg": "^3.30.1",
"egg-bin": "^6.13.0",
"egg-mock": "^5.15.1",
"eslint": "^5.16.0",
"eslint-config-egg": "^7.3.1",
"supertest": "^4.0.2",
"typescript": "^3.4.5",
"typescript": "^5.7.3",
"urllib": "^4.6.11",
"utility": "^1.9.0"
},
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"test-local": "egg-bin test --ts false",
"cov": "egg-bin cov --ts false",
"lint": "eslint .",
"ci": "npm run lint && npm run cov",
"autod": "autod"
},
"ci": {
"type": "travis",
"version": "8, 10, 11",
"license": true,
"services": "redis-server"
"ci": "npm run lint && npm run cov"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eggjs/egg-redis.git"
"url": "git+https://github.com/eggjs/redis.git"
},
"bugs": {
"url": "https://github.com/eggjs/egg/issues"
},
"homepage": "https://github.com/eggjs/egg-redis#readme",
"homepage": "https://github.com/eggjs/redis#readme",
"author": "jtyjty99999",
"license": "MIT"
}
24 changes: 12 additions & 12 deletions test/fixtures/apps/ts/redisapp-ts/app/controller/home.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {Controller} from 'egg';
import { Controller } from 'egg';

declare module 'egg' {
interface IController {
home: HomeController;
}
interface IController {
home: HomeController;
}
}

export default class HomeController extends Controller {
async index() {
const { ctx,app } = this;
const redis = app.redis
await redis.set('foo', 'bar');
ctx.body = await redis.get('foo');
}

export default class HomeController extends Controller {
async index() {
const { ctx,app } = this;
const redis = app.redis
await redis.set('foo', 'bar');
ctx.body = await redis.get('foo');
}
}
2 changes: 1 addition & 1 deletion test/fixtures/apps/ts/redisapp-ts/app/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Application} from 'egg';
import { Application } from 'egg';

export default (app: Application) => {
const controller = app.controller;
Expand Down
6 changes: 4 additions & 2 deletions test/redis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ describe('test/redis.test.js', () => {
});
});

describe('redis sentinel', () => {
// TODO: make github action support sentinel
describe.skip('redis sentinel', () => {
let app;
before(async () => {
app = mm.app({
Expand Down Expand Up @@ -167,7 +168,8 @@ describe('test/redis.test.js', () => {
});
});

describe('redis path', () => {
// TODO: make github action support redis start with path
describe.skip('redis path', () => {
let app;
before(async () => {
app = mm.app({
Expand Down

0 comments on commit b99cb96

Please sign in to comment.