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

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Download dependencies
run: go mod download

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Build binaries
run: |
GOOS=linux GOARCH=amd64 go build -o flatrun-agent-linux-amd64 ./cmd/agent
GOOS=linux GOARCH=arm64 go build -o flatrun-agent-linux-arm64 ./cmd/agent

- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
flatrun-agent-linux-amd64
flatrun-agent-linux-arm64
generate_release_notes: true
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help build run test clean deps
.PHONY: help build run test clean deps lint lint-install fmt vet

BINARY_NAME=flatrun-agent
VERSION?=dev
Expand All @@ -9,11 +9,15 @@ LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME) -X
help:
@echo "FlatRun Agent - Build commands"
@echo ""
@echo "make deps - Install dependencies"
@echo "make build - Build binary"
@echo "make run - Run in development mode"
@echo "make test - Run tests"
@echo "make clean - Clean build artifacts"
@echo "make deps - Install dependencies"
@echo "make build - Build binary"
@echo "make run - Run in development mode"
@echo "make test - Run tests"
@echo "make lint - Run golangci-lint"
@echo "make lint-install - Install golangci-lint"
@echo "make fmt - Format code with gofmt"
@echo "make vet - Run go vet"
@echo "make clean - Clean build artifacts"

deps:
go mod download
Expand All @@ -28,6 +32,21 @@ run: deps
test:
go test -v ./...

lint:
@command -v golangci-lint > /dev/null 2>&1 && golangci-lint run ./... || \
(test -x "$$(go env GOPATH)/bin/golangci-lint" && "$$(go env GOPATH)/bin/golangci-lint" run ./... || \
(echo "golangci-lint not found. Run 'make lint-install' first." && exit 1))

lint-install:
@echo "Installing golangci-lint..."
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

fmt:
go fmt ./...

vet:
go vet ./...

clean:
rm -f $(BINARY_NAME)
go clean
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
github.com/fsnotify/fsnotify v1.7.0
github.com/gin-gonic/gin v1.9.1
github.com/golang-jwt/jwt/v5 v5.3.0
gopkg.in/yaml.v3 v3.0.1
)

Expand All @@ -17,7 +18,6 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
Expand Down
Loading
Loading