Skip to content

Building

  • Go 1.26.3 or later
  • Docker (for Docker image builds)
  • golangci-lint (for linting)
Terminal window
# Clone the repository
git clone https://github.com/jmrplens/cs-routeros-bouncer.git
cd cs-routeros-bouncer
# Build
CGO_ENABLED=0 go build -o cs-routeros-bouncer ./cmd/cs-routeros-bouncer

With version information:

Terminal window
CGO_ENABLED=0 go build -ldflags "-X github.com/jmrplens/cs-routeros-bouncer/internal/config.Version=1.4.4 -X github.com/jmrplens/cs-routeros-bouncer/internal/config.Commit=$(git rev-parse --short HEAD) -X github.com/jmrplens/cs-routeros-bouncer/internal/config.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X github.com/crowdsecurity/go-cs-lib/version.Version=1.4.4" \
-o cs-routeros-bouncer ./cmd/cs-routeros-bouncer
Terminal window
# Run all tests
go test ./...
# With verbose output
go test -v ./...
# With coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

Run a specific package:

Terminal window
go test -v ./internal/config/...
go test -v ./internal/routeros/...
go test -v ./internal/metrics/...
Terminal window
# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run linter
golangci-lint run
# Run with auto-fix
golangci-lint run --fix
# Go vet
go vet ./...

The project uses .golangci.yml for linter configuration.

| Workflow | Trigger | Purpose | | ------------- | ------------------------ | ---------------------------------------------------- | | ci.yml | Push, PR | Run linting, tests, docs analysis, and build checks | | docs.yml | Docs changes, manual run | Build and deploy the Astro documentation site | | release.yml | Tag push | Build binaries, Docker images, create GitHub release |

  1. Update version in code

  2. Create and push a git tag

    Terminal window
    git tag v1.4.4
    git push origin v1.4.4
  3. GitHub Actions automatically:

    • Builds binaries for linux/amd64, linux/arm64, linux/arm/v7
    • Builds and pushes Docker images (multi-arch)
    • Creates a GitHub release with binaries attached
  1. Create a feature branch

    Terminal window
    git checkout -b feat/my-feature
  2. Make changes and test

    Terminal window
    go test ./...
    golangci-lint run
  3. Commit with a conventional message

    Terminal window
    git commit -m "feat: add new feature"
  4. Push and create PR