Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
database

GitHub Action

Redis Server in GitHub Actions

1.4.0

Redis Server in GitHub Actions

database

Redis Server in GitHub Actions

Start a Redis server

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Redis Server in GitHub Actions

uses: supercharge/[email protected]

Learn more about this action in supercharge/redis-github-action

Choose a version



Redis in GitHub Actions

Start a Redis server in your GitHub Actions.


Usage



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 a 1000 words. Here’s an exemplary GitHub Action using a Redis server in versions 4 and 5 to test a Node.js app:

name: Run tests

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x]
        redis-version: [4, 5, 6]

    steps:
    - name: Git checkout
      uses: actions/checkout@v2

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      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 Redis on a Custom Port

You can start the Redis instance on a custom port using the redis-port input:

name: Run tests

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x, 16.x]
        redis-version: [4, 5, 6]

    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:

name: Run tests

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x, 16.x]
        redis-version: [4, 5, 6]

    steps:
    - name: Start Redis
      uses: supercharge/[email protected]
      with:
        redis-version: ${{ matrix.redis-version }}
        redis-container-name: redis-auth-token-cache

    - name: 

License

MIT © Supercharge


superchargejs.com  ·  GitHub @supercharge  ·  Twitter @superchargejs