Skip to content

shogo82148/actions-setup-redis

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date
Apr 23, 2025
Mar 29, 2025
Jan 18, 2025
Apr 3, 2025
Jul 17, 2023
Jul 7, 2021
Jul 17, 2023
Oct 5, 2019
May 27, 2024
Mar 29, 2025
Jan 18, 2025
Apr 9, 2025
Mar 29, 2024
Apr 9, 2025
Aug 13, 2024
Jul 8, 2023
Apr 28, 2025
Apr 28, 2025
Nov 7, 2021
Nov 7, 2021
Dec 5, 2021

Repository files navigation

actions-setup-redis

GitHub Actions status

This action sets by redis database for use in actions by:

  • optionally downloading and caching a version of redis
  • start redis-server

Motivation

  • GitHub Actions supports Docker services, and there is the official redis image. but it works on only Linux.
  • Some test utils for redis (such as Test::RedisServer) requires redis-server installed on the local host.

Usage

See action.yml

Basic:

steps:
  - uses: actions/checkout@v4
  - uses: shogo82148/actions-setup-redis@v1
    with:
      redis-version: "7.x"
  - run: redis-cli ping

Matrix Testing:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - "ubuntu-latest"
          - "macOS-latest"
        # - 'windows-latest' # windows is currently not supported.
        redis:
          - "7.2"
          - "7.0"
          - "6.2"
          - "6.0"
          - "5.0"
          - "4.0"
    name: Redis ${{ matrix.redis }} on ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Setup redis
        uses: shogo82148/actions-setup-redis@v1
        with:
          redis-version: ${{ matrix.redis }}
          auto-start: "false"

      - name: tests with Test::RedisServer
        run: |
          cpanm Test::RedisServer
          prove -lv t

Configuration

distribution

The distribution. The valid values are redis or valkey. The default value is redis. You can use redis- and valkey- prefixes in redis-version instead of the distribution input. For example, the following two workflows install Valkey 7.2.

- uses: shogo82148/actions-setup-redis@v1
  with:
    distribution: "valkey"
    redis-version: "7.2"
- uses: shogo82148/actions-setup-redis@v1
  with:
    redis-version: "valkey-7.2"

redis-version

The version of Redis. The redis-version input supports the following syntax:

  • latest: the latest version of stable Redis
  • 7, 6, 5, 4: major versions
  • 7.2, 7.0: minor versions
  • 7.2.0, 7.2.1: patch versions

The default value is latest. The actions supports only stable versions.

redis-port

The port number that redis-server listens. The default value is 6379.

redis-tls-port

The port number that redis-server listens TLS connections. The default value is 0 and TLS is disabled.

auto-start

If the auto-start is true, the action starts redis-server as a daemon. If it is false, the action just install Redis commands, doesn't start redis-server. It is a boolean value, valid values are true or false. The default value is true.

redis-conf

Extra configurations for redis.conf. See Redis configuration.

Outputs

redis-port

The port number that redis-server listens.

jobs:
  build:
    runs-on: "ubuntu-latest"
    steps:
      - uses: actions/checkout@v4
      - id: setup
        uses: shogo82148/actions-setup-redis@v1

      # connect to the redis-server via TCP
      - run: |
          redis-cli -h 127.0.0.1 -p ${{ steps.setup.outputs.redis-port }} ping

redis-unix-socket

The unix domain socket path that redis-server listens.

jobs:
  build:
    runs-on: "ubuntu-latest"
    steps:
      - uses: actions/checkout@v4
      - id: setup
        uses: shogo82148/actions-setup-redis@v1

      # connect to the redis-server via unix domain socket
      - run: |
          redis-cli -s ${{ steps.setup.outputs.redis-unix-socket }} ping

redis-tls-port

The port number that redis-server listens TLS connections.

redis-tls-port

The directory path for TLS sample certificates/keys.

jobs:
  build:
    runs-on: "ubuntu-latest"
    steps:
      - uses: actions/checkout@v4
      - id: setup
        uses: shogo82148/actions-setup-redis@v1
        with:
          # TLS Support starts from v6.0.
          redis-version: "6.0"

          # TLS is disabled by default. You need extra configurations.
          redis-port: "0"
          redis-tls-port: "6379"

      # connect to the redis-server via TLS
      - run: |
          redis-cli -h 127.0.0.1 -p "${{ steps.setup.outputs.redis-tls-port }}" \
            --tls \
            --cert "${{ steps.setup.outputs.redis-tls-dir }}/redis.crt" \
            --key "${{ steps.setup.outputs.redis-tls-dir }}/redis.key" \
            --cacert "${{ steps.setup.outputs.redis-tls-dir }}/ca.crt" \
            ping

See TLS Support for more details.

License

The scripts and documentation in this project are released under the MIT License