fix(ci): add Redis service to test and build jobs to resolve connection refused errors
Some checks failed
CI / lint (push) Successful in 14s
CI / test (push) Failing after 1m48s
CI / build (push) Has been skipped
CI / docker (push) Has been skipped

This commit is contained in:
2026-08-20 17:40:37 +03:00
parent 904c0c35ce
commit 6396f4e6ab

View File

@@ -52,6 +52,17 @@ jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
# Set health checks to wait until redis is ready
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
needs: lint
steps:
- uses: actions/checkout@v4
@@ -73,11 +84,35 @@ jobs:
- name: Download Go modules
run: go mod download
- name: Set up Redis
run: |
# Wait for Redis to be ready
for i in {1..30}; do
if redis-cli ping | grep -q PONG; then
echo "Redis is ready"
break
fi
echo "Waiting for Redis..."
sleep 1
done
- name: Run tests
env:
REDIS_ADDR: localhost:6379
run: go test ./... -v -race -cover
build:
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
needs: test
steps:
- uses: actions/checkout@v4
@@ -99,7 +134,21 @@ jobs:
- name: Download Go modules
run: go mod download
- name: Set up Redis
run: |
# Wait for Redis to be ready
for i in {1..30}; do
if redis-cli ping | grep -q PONG; then
echo "Redis is ready"
break
fi
echo "Waiting for Redis..."
sleep 1
done
- name: Build binary
env:
REDIS_ADDR: localhost:6379
run: go build -o api ./cmd/api
docker:
@@ -132,4 +181,3 @@ jobs:
gitea.mrixs.me/mrixs/trip-planner:${{ github.sha }}
cache-from: type=registry,ref=gitea.mrixs.me/mrixs/trip-planner:buildcache
cache-to: type=registry,ref=gitea.mrixs.me/mrixs/trip-planner:buildcache,mode=max