Skip to content

Commit

Permalink
added the integration test github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Srikanth committed Oct 20, 2024
1 parent 3aeff0c commit 4ec436d
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Integration Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
integration-test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_USER: srikanth
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
options: >-
--health-cmd "pg_isready -U srikanth"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-retries 5

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22 # Use the required Go version

- name: Install Dependencies
run: |
go mod tidy
go mod download
- name: Set up Docker Compose
run: |
docker-compose up -d # Start the app along with postgres and redis containers
- name: Wait for Services to be Ready
run: sleep 20 # Ensure services are up and ready (adjust timing as needed)

- name: Run Integration Tests
run: |
go test -v ./... # Run your integration tests against the running containers
- name: Stop Docker Compose
run: docker-compose down

0 comments on commit 4ec436d

Please sign in to comment.