pull/6/head
Marcus Poehls 2019-12-17 13:44:54 +01:00
parent fe4aa78377
commit dfec8ec99f
6 changed files with 129 additions and 0 deletions

18
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,18 @@
on: [push]
jobs:
redis-action:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: ["4", "5"]
name: Start Redis Server v${{ matrix.redis-version }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Start Redis Server
uses: ./
with:
redis-version: ${{ matrix.redis-version }}

7
CHANGELOG.md Normal file
View File

@ -0,0 +1,7 @@
# Changelog
## 1.0.0 - 2019-12-xx
### Added
- `1.0.0` release 🚀 🎉

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM docker:stable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

81
README.md Normal file
View File

@ -0,0 +1,81 @@
<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 GitHub Action</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>
<a href="https://www.npmjs.com/package/@supercharge/strings"><img src="https://img.shields.io/npm/v/@supercharge/strings.svg" alt="Latest Version"></a>
</p>
<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. Heres 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: [8.x, 10.x, 12.x, 13.x]
redis-version: [4, 5]
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Start Redis
uses: superchargejs/redis-github-action@v1
with:
redis-version: ${{ matrix.redis-version }}
- run: npm install
- run: npm test
env:
CI: true
```
## License
MIT © [Supercharge](https://superchargejs.com)
---
> [superchargejs.com](https://superchargejs.com) &nbsp;&middot;&nbsp;
> GitHub [@superchargejs](https://github.com/superchargejs/) &nbsp;&middot;&nbsp;
> Twitter [@superchargejs](https://twitter.com/superchargejs)

16
action.yml Normal file
View File

@ -0,0 +1,16 @@
name: 'Redis Server in GitHub Actions'
description: 'Start a Redis server (on default port 6379)'
branding:
icon: 'database'
color: 'red'
inputs:
redis-version:
description: 'Redis version to use'
required: false
default: 'latest'
runs:
using: 'docker'
image: 'Dockerfile'

3
entrypoint.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
sh -c "docker run -d -p 6379:6379 redis:$INPUT_REDIS_VERSION"