Skip to content

Commit

Permalink
ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
afurgapil committed Jun 21, 2024
1 parent 92eeb4f commit 8444268
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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: 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 1
done
- name: Run tests
run: go test -v ./...

0 comments on commit 8444268

Please sign in to comment.