Skip to content

Test CI/CD using redis install for diff os #21

Test CI/CD using redis install for diff os

Test CI/CD using redis install for diff os #21

name: Run test cases
on: [pull_request, push]
jobs:
run-test-cases:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.x, 18.x, 20.x]
steps:
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Setup Redis (Linux Only)
if: runner.os == 'Linux'
uses: supercharge/redis-github-action@1.2.0
with:
redis-version: 6
- name: Install Redis (Windows Only)
if: runner.os == 'Windows'
run: |
choco install redis
redis-server --service-install
redis-server --service-start
shell: pwsh
- name: Install Redis (macOS Only)
if: runner.os == 'macOS'
run: |
brew install redis
brew services start redis
- name: Install packages and run tests for node
run: |
npm install
npm run test
env:
REDIS_HOST: localhost
REDIS_PORT: 6379
- name: Coveralls (Uploading test report)
if: ${{ steps.get_branch.outputs.branch == 'main' }}
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}