-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from yxx4c/feat/cacheContext
Feat/cache context
- Loading branch information
Showing
30 changed files
with
1,875 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
install_dependencies: | ||
name: Install Project Dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Up Bun Package Manager | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install Project Dependencies | ||
run: bun install | ||
|
||
- name: Cache Node Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/bun.lockb') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules- | ||
build_library: | ||
name: Build Project Library | ||
runs-on: ubuntu-latest | ||
needs: install_dependencies | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Up Bun Package Manager | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Cache Node Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/bun.lockb') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules- | ||
- name: Cache Build Output Directory | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
dist | ||
key: ${{ runner.os }}-dist-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-dist- | ||
- name: Build the Project | ||
run: bun run build | ||
|
||
run_tests: | ||
name: Execute Test Suite | ||
runs-on: ubuntu-latest | ||
needs: build_library | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Up Bun Package Manager | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Cache Node Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/bun.lockb') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules- | ||
- name: Cache Build Output Directory | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
dist | ||
key: ${{ runner.os }}-dist-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-dist- | ||
- name: Install Dependencies for Example Project | ||
run: | | ||
cd example | ||
rm -rf node_modules | ||
bun install | ||
- name: Generate Prisma Client | ||
run: | | ||
cd example | ||
bunx prisma generate | ||
- name: Run Test Suite | ||
env: | ||
REDIS_SERVICE_URI: ${{ secrets.REDIS_SERVICE_URI }} | ||
POSTGRES_SERVICE_URI: ${{ secrets.POSTGRES_SERVICE_URI }} | ||
run: bun test | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# publish_to_npm: | ||
# name: Publish Package to NPM | ||
# runs-on: ubuntu-latest | ||
# needs: run_tests | ||
# steps: | ||
# - name: Checkout Repository | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Set Up Bun Package Manager | ||
# uses: oven-sh/setup-bun@v2 | ||
|
||
# - name: Publish Package to NPM | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
# run: bun publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: test | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
services: | ||
dragonfly: | ||
image: "docker.dragonflydb.io/dragonflydb/dragonfly" | ||
ports: | ||
- 6379:6379 | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 3 | ||
volumes: | ||
- dragonfly:/data | ||
postgres: | ||
image: postgres:alpine | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd "pg_isready -U user" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 3 | ||
env: | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: testdb | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Up Bun Package Manager | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install Project Dependencies | ||
run: bun install | ||
|
||
- name: Run Test Suite | ||
env: | ||
REDIS_SERVICE_URI: redis://localhost:6379 | ||
POSTGRES_SERVICE_URI: postgres://user:password@localhost:5432/testdb | ||
run: bun run test | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.env | ||
coverage | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
# Security Policy for prisma-extension-redis | ||
|
||
## Reporting a Vulnerability | ||
|
||
If a security vulnerability is discovered in `prisma-extension-redis`, please report it responsibly. Your assistance in keeping this project secure is greatly appreciated. | ||
|
||
To report a vulnerability, please follow these steps: | ||
|
||
1. **Do not disclose the vulnerability publicly** until it has been addressed. | ||
2. **Email the maintainer** at mail.yxx4c+security@gmail.com with the following information: | ||
- A description of the vulnerability | ||
- Steps to reproduce the issue | ||
- Any relevant code snippets or configurations | ||
|
||
Reports will be acknowledged as soon as possible, typically within a few days, depending on the complexity of the issue. | ||
|
||
## Supported Versions | ||
|
||
The latest version of `prisma-extension-redis` is currently supported. Users are encouraged to use the most recent version to benefit from any security updates. | ||
|
||
## Security Best Practices | ||
|
||
To enhance the security of applications using `prisma-extension-redis`, consider the following best practices: | ||
|
||
1. **Keep Dependencies Updated**: Regularly check for updates to `prisma-extension-redis` and its dependencies. | ||
2. **Use Environment Variables**: Store sensitive information, such as Redis connection strings and credentials, in environment variables instead of hardcoding them in the application. | ||
3. **Limit Redis Access**: Configure the Redis instance to allow access only from trusted sources. | ||
4. **Monitor Logs**: Regularly review application logs for any unusual activity. | ||
|
||
## Additional Resources | ||
|
||
- [OWASP Top Ten](https://owasp.org/www-project-top-ten/) - A list of the top ten security risks for web applications. | ||
- [Redis Security](https://redis.io/topics/security) - Best practices for securing Redis instances. | ||
|
||
Thank you for helping to keep `prisma-extension-redis` secure! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[test] | ||
|
||
coverage = true | ||
coverageReporter = ["text", "lcov"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.