Skip to content

updated .env files

updated .env files #23

Workflow file for this run

name: Go API Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: librarymanagementsystem_test
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "^1.22.2"
- name: Install dependencies
run: go mod download
- name: Start PostgreSQL and wait for connection
run: |
sudo apt-get update
sudo apt-get install -y netcat
until nc -z localhost 5432; do
echo "Waiting for PostgreSQL..."
sleep 3
done
- name: Make create_migrations.sh executable
run: chmod +x scripts/create_migrations.sh
- name: Run database migrations
run: ./scripts/create_migrations.sh
- name: Run tests
run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic