Files
Memoh/.github/workflows/go-ci.yml
T

70 lines
1.5 KiB
YAML

name: Go CI
on:
push:
branches: ["main"]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
- ".golangci.yml"
- "db/queries/**/*.sql"
- "db/migrations/**/*.sql"
- ".github/workflows/go-ci.yml"
pull_request:
branches: ["main"]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
- ".golangci.yml"
- "db/queries/**/*.sql"
- "db/migrations/**/*.sql"
- ".github/workflows/go-ci.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.10.1
only-new-issues: true
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: go-coverage
path: coverage.txt
if-no-files-found: error