Skip to content

Updated workflow file #3

Updated workflow file

Updated workflow file #3

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.4
- name: Build
run: go build -v ./...
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: bookreviewapp_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.4
- name: Run unit tests
run: go test -v -tags=unit ./...
- name: Run integration tests
env:
ENVIRONMENT: test
DATABASE_URL: ${{vars.DATABASE_URL}}
run: go test -v -tags=integration ./...