Skip to content
Open
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
67 changes: 64 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
- "go.mod"
- "go.sum"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
golangci:
name: Lint
Expand All @@ -35,7 +39,7 @@ jobs:

# step 3: run golangci-lint
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: --timeout=5m
Expand All @@ -60,10 +64,67 @@ jobs:

# step 4: run test
- name: Run coverage
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
run: go test -race -shuffle=on -count=1 -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...

# step 5: upload coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

benchmark:
name: Benchmark
runs-on: ubuntu-latest
if: false
permissions:
contents: read
pull-requests: write
steps:
# step 1: checkout repository code
- name: Checkout code into workspace directory
uses: actions/checkout@v4

# step 2: set up go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable

# step 3: install dependencies
- name: Install all Go dependencies
run: go mod download

# step 4: restore previous benchmark history (if exists)
- name: Restore benchmark history
id: benchmark-cache
uses: actions/cache/restore@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-benchmark-

# step 5: run benchmark
- name: Run benchmarks
run: go test -run=^$ -bench=. -benchmem ./... | tee benchmark.txt

# step 6: upload benchmark
- name: Upload benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the benchmark.txt came from
tool: "go"
# Where the output from the benchmark tool is stored
output-file-path: benchmark.txt
# Where the previous data file is stored
external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true

# step 7: persist updated benchmark history
- name: Save benchmark history
if: always()
uses: actions/cache/save@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark-${{ github.ref_name }}-${{ github.run_id }}
18 changes: 14 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
# Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,macos,linux,go,dotenv
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,macos,linux,go,dotenv
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,dotenv,go,linux,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,dotenv,go,linux,windows

### dotenv ###
.env
Expand Down Expand Up @@ -50,7 +50,8 @@ go.work
.LSOverride

# Icon must end with two \r
Icon
Icon


# Thumbnails
._*
Expand Down Expand Up @@ -120,7 +121,16 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,macos,linux,go,dotenv
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,dotenv,go,linux,windows

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

dist/
tmp/

/configs/*
!/configs/*.example.*

go.work*
coverage.*
benchmark.*
Loading
Loading