GithubHelp home page GithubHelp logo

supercharge / redis-github-action Goto Github PK

View Code? Open in Web Editor NEW
100.0 3.0 28.0 71 KB

Use Redis in GitHub Actions

License: MIT License

Shell 86.38% Dockerfile 13.62%
redis github-actions github-actions-docker supercharge

redis-github-action's Introduction



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 1,000 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: [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:

name: Run tests

on: [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:

name: Run tests

on: [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:

name: Run tests

on: [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:

name: Run tests

on: [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:

name: Run tests

on: [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


superchargejs.com  ·  GitHub @supercharge  ·  Twitter @superchargejs

redis-github-action's People

Contributors

gorlikitsme avatar jcmais avatar kien-cs avatar marcuspoehls avatar miketheman avatar newarifrh avatar yaraslauzhylko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

redis-github-action's Issues

Can I use redis version 6?

Hello I'm Cho
First of all, thanks to you, I am able to conduct a virtual test using redis.
Currently I am using redis version 6 in my server.
But your usage seems to only support versions 4 and 5, can I use 6?

Thanks.
Cho

v1.7 released?

You mention 1.7 in the docs and the changelog, but I don't see an actual tag or release for it.

Can you guys add redis-cli ?

Currently I add redis-tools myself, so my action.yml looks like this. I think it will be helpful if redis-cli is included in your action

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

- name: Install redis cli
  run: sudo apt-get install -y redis-tools

Error: "docker: invalid reference format"

See https://github.com/Vectorface/cache/pull/8/checks?check_run_id=1592485519

/usr/bin/docker run --name cc4956c4ab57414d304381943ac46fbbdd502f_656d49 --label cc4956 --workdir /github/workspace --rm -e INPUT_REDIS-VERSION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/cache/cache":"/github/workspace" cc4956:c4ab57414d304381943ac46fbbdd502f  ""
docker: invalid reference format.

Any thoughts? 🤔

Custom Redis image

Should it be possible to launch an alternative Redis package like Redis Stack by specifying a custom image name? 🤔

Potential implementation: #10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.