Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 32 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Unit Tests
on: [push, pull_request]

permissions:
contents: read

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Download dependencies
run: go mod download

- name: Run unit tests
run: go test -race ./...

- name: Build
run: make build
45 changes: 45 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: GoReleaser Release
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
attestations: write

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Download dependencies
run: go mod download

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552
with:
distribution: goreleaser
# GoReleaser version
version: "~> v2"
# Arguments to pass to GoReleaser
args: release --clean
workdir: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Generate signed build provenance attestations for workflow artifacts
uses: actions/attest-build-provenance@v2
with:
subject-path: |
dist/*.tar.gz
dist/*.zip
dist/*.txt
50 changes: 50 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Lint
on:
push:
pull_request:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Verify dependencies
run: |
go mod verify
go mod download

LINT_VERSION=1.64.8
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
tar xz --strip-components 1 --wildcards \*/golangci-lint
mkdir -p bin && mv golangci-lint bin/

- name: Run checks
run: |
STATUS=0
assert-nothing-changed() {
local diff
"$@" >/dev/null || return 1
if ! diff="$(git diff -U1 --color --exit-code)"; then
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
git checkout -- .
STATUS=1
fi
}

assert-nothing-changed go fmt ./...
assert-nothing-changed go mod tidy

bin/golangci-lint run --out-format=colored-line-number --timeout=3m || STATUS=$?

exit $STATUS
51 changes: 51 additions & 0 deletions .github/workflows/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build
on:
pull_request:
branches:
- main
- release/*
paths:
- '**'
- '!docs/**'
- '!README.md'
- '!CONTRIBUTING.md'

env:
GOPRIVATE: github.com/streamnative
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Git token
run: |
git config --global user.email "[email protected]"
git config --global user.name "StreamNative Bot"
git config --global url."https://streamnativebot:${ACCESS_TOKEN}@github.com/".insteadOf "https://github.com/"

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Docker login
run: docker login -u="${{ secrets.DOCKER_USER }}" -p="${{ secrets.DOCKER_PASSWORD }}"

- name: Run GoReleaser (snapshot)
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea/
bin/
dist/

.DS_Store
tmp/
*.log

# Go
vendor
28 changes: 28 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
run:
timeout: 5m
tests: true
concurrency: 4

linters:
enable:
- govet
- errcheck
- staticcheck
- gofmt
- goimports
- revive
- ineffassign
- typecheck
- unused
- gosimple
- misspell
- nakedret
- bodyclose
- gocritic
- makezero
- gosec

output:
formats: colored-line-number
print-issued-lines: true
print-linter-name: true
47 changes: 47 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2
project_name: streamnative-mcp-server
before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
main: ./cmd/streamnative-mcp-server

archives:
- formats: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
formats: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

release:
draft: true
prerelease: auto
name_template: "StreamNative MCP Server {{.Version}}"
Loading