Fix: email-service-revamp #6
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: Build Binary and Run Tests | |
on: | |
pull_request: | |
branches: [dev] | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
environment: development | |
env: | |
TEST_USERNAME: postgres | |
TEST_PASSWORD: password | |
TEST_DB_NAME: db_name | |
TEST_DB_HOST: localhost | |
TEST_DB_PORT: 5432 | |
TEST_DB_CONNECTION: pgsql | |
TEST_TIMEZONE: Africa/Lagos | |
TEST_SSLMODE: disable | |
TEST_MIGRATE: true | |
REDIS_PORT: 6379 | |
REDIS_HOST: localhost | |
REDIS_DB: 0 | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ${{ env.TEST_USERNAME }} | |
POSTGRES_PASSWORD: ${{ env.TEST_PASSWORD }} | |
POSTGRES_DB: ${{ env.TEST_DB_NAME }} | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22.1" | |
- name: Create app config file | |
run: cp app-sample.env app.env | |
- name: Build the application | |
run: go build -o development_app | |
- name: Run the application | |
run: nohup ./development_app > /dev/null 2>&1 & | |
- name: Wait for application to start | |
run: | | |
for i in {1..30}; do | |
curl -s http://localhost:8019 && break | |
sleep 1 | |
done | |
- name: Run All Tests | |
run: go test ./... -timeout 300s |