Skip to content

Building

  • Go 1.24 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
go build -o cs-routeros-bouncer ./cmd/cs-routeros-bouncer

With version information:

Terminal window
go build -ldflags "-X main.version=1.3.0 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-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.

WorkflowTriggerPurpose
test.ymlPush, PRRun tests and linting
release.ymlTag pushBuild binaries, Docker images, create GitHub release
docker.ymlPush to mainBuild and push Docker image to GHCR
  1. Update version in code

  2. Create and push a git tag

    Terminal window
    git tag v1.3.0
    git push origin v1.3.0
  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