Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supercharge/redis-github-action
Use Redis in GitHub Actions
https://github.com/supercharge/redis-github-action
github-actions github-actions-docker redis supercharge
Last synced: 4 days ago
JSON representation
Use Redis in GitHub Actions
- Host: GitHub
- URL: https://github.com/supercharge/redis-github-action
- Owner: supercharge
- License: mit
- Created: 2019-12-17T12:26:52.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-12T03:59:53.000Z (11 months ago)
- Last Synced: 2024-10-14T19:32:08.680Z (20 days ago)
- Topics: github-actions, github-actions-docker, redis, supercharge
- Language: Shell
- Homepage:
- Size: 69.3 KB
- Stars: 103
- Watchers: 3
- Forks: 29
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Redis in GitHub Actions
Start a Redis server in your GitHub Actions.
Follow @marcuspoehls and @superchargejs for updates!
---
## Introduction
This GitHub Action starts a Redis server on the default port `6379`.This is useful when running tests against a Redis database.
## Usage
A code example says more than 1,000 words. Here’s an exemplary GitHub Action using a Redis server in versions 4 and 5 to test a Node.js app:```yaml
name: Run testson: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
redis-version: [6, 7]steps:
- name: Git checkout
uses: actions/checkout@v3- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}- run: npm install
- run: npm test
env:
CI: true
```### Using a Custom Redis Image
You can utilize an alternative Redis image using the `redis-image` input:```yaml
name: Run testson: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: [6.2.4-v4, 6.2.6-v3]steps:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-image: redis/redis-stack-server
redis-version: ${{ matrix.redis-version }}- name: …
```### Using Redis on a Custom Port
You can start the Redis instance on a custom port using the `redis-port` input:```yaml
name: Run testson: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: [6, 7]steps:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
redis-port: 12345- name: …
```### Using a Custom Container Name
This GitHub Action provides a Redis Docker container. The default container name is `redis`. It can be helpful to customize the container name. For example, when running multiple Redis instances in parallel. You can customize the container name using the `redis-container-name` input:```yaml
name: Run testson: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: [6, 7]steps:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
redis-container-name: redis-auth-token-cache- name: …
```### Remove container when exit
Starting in v1.6.0, when running this action on a self-hosted runner, it’s helpful to remove the container so its name won’t conflict:```yaml
name: Run testson: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: [6, 7]steps:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
redis-remove-container: true # false by default- name: …
```### Using Authentication
Starting in v1.7.0, You can start the Redis with Authentication using the `redis-password` input:```yaml
name: Run testson: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: [6, 7]steps:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
redis-password: 'password'- name: …
```## License
MIT © [Supercharge](https://superchargejs.com)---
> [superchargejs.com](https://superchargejs.com) ·
> GitHub [@supercharge](https://github.com/supercharge) ·
> Twitter [@superchargejs](https://twitter.com/superchargejs)