Skip to content

docker updated and ci workflow added #1

docker updated and ci workflow added

docker updated and ci workflow added #1

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os}}~go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}~go-
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v -race coverprofile=coverage.out ./...
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/testdb?sslmode=disable
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: coverage.out
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Build
run: go build -v ./cmd/server