Skip to content

Commit

Permalink
add workflow for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karngyan committed Dec 21, 2024
1 parent dc90a4b commit 837ee31
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/tests-go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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/)

0 comments on commit 837ee31

Please sign in to comment.