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
44 changes: 44 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Git
.git
.gitignore

# CI/CD
.github

# Documentation
*.md
!README.md

# Build artifacts
bin/
dist/
build/
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test artifacts
*.test
*.out
coverage.out
coverage.html

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Go workspace
go.work
go.work.sum

# Taskfile
Taskfile.yml
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
22 changes: 22 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "go",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"changelog-sections": [
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "revert", "section": "Reverts" },
{ "type": "docs", "section": "Documentation" },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
]
}
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

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

jobs:
lint:
name: Lint
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.24'

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest

test:
name: Test
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.24

- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./...

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
fail_ci_if_error: false

build:
name: Build
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.24'

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

- name: Build Docker image
run: docker build -t smallflow:latest .
52 changes: 52 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release Please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Run release-please
uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: go
package-name: smallflow

- name: Checkout code
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v4

- name: Set up Go
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-go@v5
with:
go-version: '1.24'

- name: Build binaries
if: ${{ steps.release.outputs.release_created }}
run: |
GOOS=linux GOARCH=amd64 go build -o smallflow-linux-amd64 ./cmd/smallflow
GOOS=linux GOARCH=arm64 go build -o smallflow-linux-arm64 ./cmd/smallflow
GOOS=darwin GOARCH=amd64 go build -o smallflow-darwin-amd64 ./cmd/smallflow
GOOS=darwin GOARCH=arm64 go build -o smallflow-darwin-arm64 ./cmd/smallflow
GOOS=windows GOARCH=amd64 go build -o smallflow-windows-amd64.exe ./cmd/smallflow

- name: Upload Release Artifacts
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.release.outputs.tag_name }} \
smallflow-linux-amd64 \
smallflow-linux-arm64 \
smallflow-darwin-amd64 \
smallflow-darwin-arm64 \
smallflow-windows-amd64.exe
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool
*.out

# Dependency directories
vendor/

# Go workspace file
go.work

# Build artifacts
/bin/
/dist/
/build/

# IDE specific files
.idea/
.vscode/
*.swp
*.swo
*~

# OS specific files
.DS_Store
Thumbs.db
31 changes: 31 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- gofmt
- goimports
- misspell
- unconvert
- unparam
- whitespace

linters-settings:
errcheck:
check-type-assertions: true
check-blank: true

govet:
check-shadowing: true

run:
timeout: 5m
tests: true

issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Build stage
FROM golang:1.24-alpine AS builder

# Install build dependencies
RUN apk add --no-cache git make ca-certificates

# Set working directory
WORKDIR /app

# Copy go mod files
COPY go.mod go.sum* ./

# Download dependencies
RUN go mod download

# Copy source code
COPY . .

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -trimpath -o /bin/smallflow ./cmd/smallflow

# Final stage
FROM alpine:3.20

# Install runtime dependencies
RUN apk --no-cache add ca-certificates tzdata

# Create non-root user
RUN addgroup -g 1000 smallflow && \
adduser -D -u 1000 -G smallflow smallflow

# Set working directory
WORKDIR /home/smallflow

# Copy binary from builder
COPY --from=builder /bin/smallflow /usr/local/bin/smallflow

# Change ownership
RUN chown -R smallflow:smallflow /home/smallflow

# Switch to non-root user
USER smallflow

# Run the application
ENTRYPOINT ["smallflow"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# smallflow
Build, run, and observe workflows without the overhead
Build, run, and observe workflows without the overhead!

SmallFlow is a lightweight, workflow orchestration engine written in Go.
Designed for simplicity, auditability, and extensibility, SmallFlow helps you build, run, and observe workflows without the overhead of heavyweight platforms.

71 changes: 71 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: '3'

vars:
BINARY_NAME: smallflow
MAIN_PATH: ./cmd/smallflow

tasks:
default:
desc: Show available tasks
cmds:
- task --list

build:
desc: Build the binary
cmds:
- go build -o bin/{{.BINARY_NAME}} {{.MAIN_PATH}}
sources:
- "**/*.go"
generates:
- bin/{{.BINARY_NAME}}

run:
desc: Run the application
cmds:
- task: build
- ./bin/{{.BINARY_NAME}}

test:
desc: Run tests
cmds:
- go test -v -race -coverprofile=coverage.out ./...

test-coverage:
desc: Run tests with coverage report
cmds:
- go test -v -race -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html

lint:
desc: Run linter
cmds:
- golangci-lint run ./...

fmt:
desc: Format code
cmds:
- go fmt ./...

vet:
desc: Run go vet
cmds:
- go vet ./...

tidy:
desc: Tidy go modules
cmds:
- go mod tidy

clean:
desc: Clean build artifacts
cmds:
- rm -rf bin/
- rm -f coverage.out coverage.html

check:
desc: Run all checks (fmt, vet, lint, test)
cmds:
- task: fmt
- task: vet
- task: lint
- task: test
7 changes: 7 additions & 0 deletions cmd/smallflow/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Build, run, and observe workflows without the overhead!")
}
8 changes: 8 additions & 0 deletions compose.debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
smallflow:
image: smallflow
build:
context: .
dockerfile: ./Dockerfile
ports:
- 3000:3000
Loading