106 lines
2.3 KiB
Markdown
106 lines
2.3 KiB
Markdown
<div align="center">
|
||
<a href="https://superchargejs.com">
|
||
<img width="471" style="max-width:100%;" src="https://superchargejs.com/images/supercharge-text.svg" />
|
||
</a>
|
||
<br/>
|
||
<br/>
|
||
<p>
|
||
<h3>Redis in GitHub Actions</h3>
|
||
</p>
|
||
<p>
|
||
Start a Redis server in your GitHub Actions.
|
||
</p>
|
||
<br/>
|
||
<p>
|
||
<a href="#usage"><strong>Usage</strong></a>
|
||
</p>
|
||
<br/>
|
||
<br/>
|
||
<p>
|
||
<em>Follow <a href="http://twitter.com/marcuspoehls">@marcuspoehls</a> and <a href="http://twitter.com/superchargejs">@superchargejs</a> for updates!</em>
|
||
</p>
|
||
</div>
|
||
|
||
---
|
||
|
||
|
||
## 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:
|
||
|
||
```yaml
|
||
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/redis-github-action@1.3.0
|
||
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:
|
||
|
||
```yaml
|
||
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/redis-github-action@1.3.0
|
||
with:
|
||
redis-version: ${{ matrix.redis-version }}
|
||
redis-port: 12345
|
||
|
||
- name: …
|
||
```
|
||
|
||
|
||
## License
|
||
MIT © [Supercharge](https://superchargejs.com)
|
||
|
||
---
|
||
|
||
> [superchargejs.com](https://superchargejs.com) ·
|
||
> GitHub [@supercharge](https://github.com/supercharge) ·
|
||
> Twitter [@superchargejs](https://twitter.com/superchargejs)
|