-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the integration test github actions
- Loading branch information
Srikanth
committed
Oct 20, 2024
1 parent
3aeff0c
commit 4ec436d
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
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 |