Skip to content

CI: enable Codecov upload for public repo; README: add Codecov badge #9

CI: enable Codecov upload for public repo; README: add Codecov badge

CI: enable Codecov upload for public repo; README: add Codecov badge #9

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.22', '1.23']
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: taskqueue
POSTGRES_PASSWORD: taskqueue
POSTGRES_DB: taskqueue
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: ${{ matrix.go-version }}
- 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: Download dependencies
run: go mod download
- name: Run tests
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USERNAME: taskqueue
DB_PASSWORD: taskqueue
DB_DATABASE: taskqueue
DB_SSL_MODE: disable
run: go test -v -race -coverprofile=coverage.out ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build server
run: go build -v -o bin/server ./cmd/server
- name: Build worker
run: go build -v -o bin/worker ./cmd/worker