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
127 changes: 127 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache: true

- name: Install Buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint Protobufs
run: buf lint

- name: Format Check (gofmt)
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files not formatted:"
gofmt -d .
exit 1
fi

- name: golangci-lint (Shared)
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
working-directory: shared

- name: golangci-lint (Gateway)
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
working-directory: services/cce-gateway

- name: golangci-lint (Ingestor)
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
working-directory: services/cce-ingestor

- name: golangci-lint (Parser Worker)
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
working-directory: services/cce-parser-worker

- name: golangci-lint (Analyzer)
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
working-directory: services/cce-analyzer

- name: golangci-lint (Go Parser Plugin)
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
working-directory: plugins/go-parser

test:
name: Run Unit Tests
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache: true

- name: Install Buf
uses: bufbuild/buf-setup-action@v1

- name: Generate Protobuf Code
run: buf generate

- name: Run Workspace Tests
run: go test -v ./...

build-check:
name: Compile Binaries
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache: true

- name: Install Buf
uses: bufbuild/buf-setup-action@v1

- name: Generate Protobuf Code
run: buf generate

- name: Build Core Services
run: |
go build -o bin/cce-gateway ./services/cce-gateway/cmd/cce-gateway
go build -o bin/cce-ingestor ./services/cce-ingestor/cmd/cce-ingestor
go build -o bin/cce-parser-worker ./services/cce-parser-worker/cmd/cce-parser-worker
go build -o bin/cce-analyzer ./services/cce-analyzer/cmd/cce-analyzer

- name: Build Go Parser Plugin
run: |
go build -o bin/go-parser ./plugins/go-parser
48 changes: 26 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
# Binaries
bin/
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test
# Go Workspace files that are user-specific (if any)
# We do check in go.work for standard workspace collaboration, but some teams ignore it.
# We will keep go.work checked in, but ignore build folders.

# Code coverage profiles and other test artifacts
*.out
coverage.*
*.coverprofile
profile.cov
# Environments
.env
.env.local
.env.*.local

# Dependency directories (remove the comment below to include it)
# vendor/
# Dependency directories
vendor/

# Go workspace file
go.work
go.work.sum
# IDEs and Editors
.idea/
.vscode/
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# env file
.env
# Testing and Coverage
*.coverprofile
*.out
*.test

# Editor/IDE
# .idea/
# .vscode/
# OS Files
.DS_Store
Thumbs.db
39 changes: 39 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
run:
timeout: 5m
modules-download-mode: readonly

linters-settings:
govet:
enable-all: true
disable:
- fieldalignment
revive:
rules:
- name: exported
severity: warning
- name: package-comments
severity: warning
gosec:
severity: "low"
confidence: "low"

linters:
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- revive
- goimports
- gofmt
- gosec
- bodyclose
- misspell

issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
hooks:
- id: golangci-lint
entry: golangci-lint run --new-from-rev=HEAD~1

- repo: https://github.com/bufbuild/buf
rev: v1.32.0
hooks:
- id: buf-lint
name: buf lint
entry: buf lint
files: \.proto$
Loading
Loading