Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 104 additions & 100 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,104 @@
name: CI

on:
pull_request:
push:
branches: [main]

jobs:
test:
name: Test (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21', '1.22', '1.23']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Download dependencies
run: go mod download

- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./...

- name: Upload coverage
if: matrix.go-version == '1.23'
uses: codecov/codecov-action@v4
with:
files: coverage.out
fail_ci_if_error: false

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true

- name: Build
run: go build ./...

- name: Verify go.mod is tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum

benchmark:
name: Benchmark
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true

- name: Run benchmarks
run: go test -bench=. -benchmem ./... | tee benchmark.txt

- name: Store benchmark result
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark.txt
#name: CI
#
#on:
# pull_request:
# push:
# branches: [main]
#
#jobs:
# test:
# name: Test (Go ${{ matrix.go-version }})
# runs-on: ubuntu-latest
# strategy:
# matrix:
# go-version: ['1.21', '1.22', '1.23']
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: ${{ matrix.go-version }}
# cache: true
# cache-dependency-path: go.mod
#
# - name: Download dependencies
# run: go mod download
#
# - name: Run tests
# run: go test -v -race -coverprofile=coverage.out ./...
#
# - name: Upload coverage
# if: matrix.go-version == '1.23'
# uses: codecov/codecov-action@v4
# with:
# files: coverage.out
# fail_ci_if_error: false
#
# lint:
# name: Lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: '1.23'
# cache: true
# cache-dependency-path: go.mod
#
# - name: Run golangci-lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: latest
# args: --timeout=5m
#
# build:
# name: Build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: '1.23'
# cache: true
# cache-dependency-path: go.mod
#
# - name: Build
# run: go build ./...
#
# - name: Verify go.mod is tidy
# run: |
# go mod tidy
# git diff --exit-code go.mod
#
# benchmark:
# name: Benchmark
# runs-on: ubuntu-latest
# if: github.event_name == 'pull_request'
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: '1.23'
# cache: true
# cache-dependency-path: go.mod
#
# - name: Run benchmarks
# run: go test -bench=. -benchmem ./... | tee benchmark.txt
#
# - name: Store benchmark result
# uses: actions/upload-artifact@v4
# with:
# name: benchmark-results
# path: benchmark.txt
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ linters-settings:
disabled-checks:
- hugeParam
- whyNoLint
- commentedOutCod
- commentedOutCode

gofmt:
simplify: true
Expand Down