I’m fairly new to GitHub actions and Redis.
I’m running a this CI on GitHub actions (code below)
name: sanity check
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version: [6]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- uses: supercharge/[email protected] # sets up Redis
with:
redis-version: ${{ matrix.redis-version }}
- run: node -v
- run: yarn -v
# - run: redis-cli ping
- run: yarn install
- run: yarn test --detectOpenHandles
so that I can perform integration tests with Redis, but this CI doesn’t exit (I’m running tests with Jest)
Is it because I’m not using Docker? What do I need to do to make sure this test exits? Locally, it runs fine (I start a Redis server manually though). Do I need Docker to make this work well? Any links for how to run Docker with Redis on GitHub actions if that’s the problem?
PS: If you need extra information about this, please let me know
2
Answers
The problem of Jest not exiting was probably because I was using the real redis nodejs client in my tests. I switced it to this
and I wasn't getting the error anymore
You probably don’t need this redis action, and you do not need anything docker related (although if you want, you can run redis using docker).
Just install
redis-server
and if you want the redis CLI, alsoredis-tools
.Here is a sample GitHub Action that installs and pings the redis server:
If you prefer using the action, here is a working workflow:
Finally, if your GitHub Action did not exit, it could have been a problem related to one of the recent GitHub Actions outages on May 20, May 18 or May 16.
If it’s none of the above, the problem is probably not redis related and you might want to reduce the number of "moving parts" until you see the faulty one.