User Authentication Management #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go CI with Redis | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis:latest | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.4 | |
- name: Install dependencies | |
run: go mod tidy | |
working-directory: ./backend | |
- name: Wait for Redis to be ready | |
run: | | |
until nc -z localhost 6379; do | |
echo "Waiting for Redis..." | |
sleep 1 | |
done | |
# - name: Run tests | |
# env: | |
# REDIS_URL: redis://localhost:6379 | |
# run: go test ./... | |
# working-directory: ./backend | |
- name: Build the project | |
run: go build -v -o main main.go | |
working-directory: ./backend |