Skip to content

add workflow for tests #1

add workflow for tests

add workflow for tests #1

Workflow file for this run

name: Go Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres-test:
image: postgres:17.2
ports:
- "5432:5432"
env:
POSTGRES_DB: maek_test
POSTGRES_USER: maek
POSTGRES_PASSWORD: passwd
options: >-
--health-cmd "pg_isready -U maek -d maek_test"
--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.23.1'
- run: go version
- name: Install Go modules
run: go mod download
- name: Run Go tests with coverage
run: |
export SQL_CONN_TEST="postgres://maek:passwd@localhost:5432/maek_test?sslmode=disable"
export CGO_ENABLED=0
go test -v -coverprofile=coverage.out -covermode=atomic $(go list ./... | grep -v /vendor/)