Skip to content

Commit 4d58b5e

Browse files
committed
Make it opensource.
0 parents  commit 4d58b5e

71 files changed

Lines changed: 11994 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [agnath18]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/goreleaser.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: GoReleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.22'
24+
cache: true
25+
26+
- name: Set Go version environment variable
27+
run: echo "GOVERSION=$(go version | awk '{print $3}')" >> $GITHUB_ENV
28+
29+
- name: Run GoReleaser
30+
uses: goreleaser/goreleaser-action@v5
31+
with:
32+
distribution: goreleaser
33+
version: latest
34+
args: release --clean
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Production CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.22'
23+
cache: true
24+
25+
- name: Get dependencies
26+
run: go mod download
27+
28+
- name: Run tests
29+
run: go test -v ./...
30+
31+
build:
32+
name: Build
33+
runs-on: ubuntu-latest
34+
needs: test
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: '1.22'
45+
cache: true
46+
47+
- name: Get dependencies
48+
run: go mod download
49+
50+
- name: Build
51+
run: |
52+
mkdir -p build
53+
VERSION=$(grep -oP 'Version = "\K[^"]+' pkg/version/version.go)
54+
BUILD_DATE=$(date +%Y-%m-%d)
55+
GIT_COMMIT=$(git rev-parse --short HEAD)
56+
GO_VERSION=$(go version | awk '{print $3}')
57+
LDFLAGS="-X github.com/agnath18/lumo/pkg/version.Version=${VERSION} -X github.com/agnath18/lumo/pkg/version.BuildDate=${BUILD_DATE} -X github.com/agnath18/lumo/pkg/version.GitCommit=${GIT_COMMIT} -X github.com/agnath18/lumo/pkg/version.GoVersion=${GO_VERSION}"
58+
go build -ldflags "${LDFLAGS}" -o build/lumo cmd/lumo/main.go
59+
60+
- name: Upload build artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: lumo-linux-amd64
64+
path: build/lumo
65+
retention-days: 7
66+
67+
validate-release:
68+
name: Validate Release Process
69+
runs-on: ubuntu-latest
70+
needs: test
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 0
76+
77+
- name: Set up Go
78+
uses: actions/setup-go@v5
79+
with:
80+
go-version: '1.22'
81+
cache: true
82+
83+
- name: Set Go version environment variable
84+
run: echo "GOVERSION=$(go version | awk '{print $3}')" >> $GITHUB_ENV
85+
86+
- name: Run GoReleaser (Dry Run)
87+
uses: goreleaser/goreleaser-action@v5
88+
with:
89+
distribution: goreleaser
90+
version: latest
91+
args: release --snapshot --clean --skip=publish
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
project_name: lumo
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
ignore:
18+
- goos: windows
19+
goarch: arm64
20+
main: ./cmd/lumo/main.go
21+
ldflags:
22+
- -s -w
23+
- -X github.com/agnath18/lumo/pkg/version.Version={{.Version}}
24+
- -X github.com/agnath18/lumo/pkg/version.BuildDate={{.Date}}
25+
- -X github.com/agnath18/lumo/pkg/version.GitCommit={{.ShortCommit}}
26+
- -X github.com/agnath18/lumo/pkg/version.GoVersion={{.Env.GOVERSION}}
27+
binary: lumo
28+
29+
archives:
30+
- format: tar.gz
31+
name_template: >-
32+
{{ .ProjectName }}_
33+
{{- .Version }}_
34+
{{- .Os }}_
35+
{{- .Arch }}
36+
format_overrides:
37+
- goos: windows
38+
format: zip
39+
files:
40+
- README.md
41+
- LICENSE
42+
- docs/*
43+
44+
nfpms:
45+
- package_name: lumo
46+
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}"
47+
vendor: agnath18K
48+
homepage: https://github.com/agnath18K/lumo
49+
maintainer: agnath18K <agnath18@gmail.com>
50+
description: AI-powered CLI assistant
51+
license: MIT
52+
formats:
53+
- deb
54+
dependencies:
55+
- libc6
56+
contents:
57+
- src: README.md
58+
dst: /usr/share/doc/lumo/README.md
59+
section: utils
60+
priority: optional
61+
62+
checksum:
63+
name_template: 'checksums.txt'
64+
65+
snapshot:
66+
name_template: "{{ incpatch .Version }}-next"
67+
68+
changelog:
69+
sort: asc
70+
filters:
71+
exclude:
72+
- '^docs:'
73+
- '^test:'
74+
- '^ci:'
75+
- Merge pull request
76+
- Merge branch

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 agnath18
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Lumo Makefile
2+
3+
# Variables
4+
BINARY_NAME=lumo
5+
BUILD_DIR=build
6+
VERSION=$(shell grep -oP 'Version = "\K[^"]+' pkg/version/version.go)
7+
BUILD_DATE=$(shell date +%Y-%m-%d)
8+
GIT_COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
9+
GO_VERSION=$(shell go version | awk '{print $$3}')
10+
LDFLAGS=-ldflags "-X github.com/agnath18/lumo/pkg/version.Version=${VERSION} -X github.com/agnath18/lumo/pkg/version.BuildDate=${BUILD_DATE} -X github.com/agnath18/lumo/pkg/version.GitCommit=${GIT_COMMIT} -X github.com/agnath18/lumo/pkg/version.GoVersion=${GO_VERSION}"
11+
DEB_PACKAGE=${BUILD_DIR}/lumo_${VERSION}_amd64.deb
12+
13+
# Default target
14+
.PHONY: all
15+
all: build
16+
17+
# Build the binary
18+
.PHONY: build
19+
build:
20+
@echo "Building Lumo v${VERSION}..."
21+
@mkdir -p ${BUILD_DIR}
22+
@go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME} cmd/lumo/main.go
23+
@echo "Build complete: ${BUILD_DIR}/${BINARY_NAME}"
24+
25+
# Install the binary
26+
.PHONY: install
27+
install: build
28+
@echo "Installing Lumo to /usr/bin/${BINARY_NAME}..."
29+
@sudo cp ${BUILD_DIR}/${BINARY_NAME} /usr/bin/${BINARY_NAME}
30+
@echo "Installation complete"
31+
32+
# Run tests
33+
.PHONY: test
34+
test:
35+
@echo "Running tests..."
36+
@go test ./...
37+
38+
# Clean build artifacts
39+
.PHONY: clean
40+
clean:
41+
@echo "Cleaning..."
42+
@rm -rf ${BUILD_DIR}
43+
@echo "Clean complete"
44+
45+
# Clean Debian package files
46+
.PHONY: clean-deb
47+
clean-deb:
48+
@echo "Cleaning Debian package files..."
49+
@rm -rf debian
50+
@rm -f *.deb
51+
@rm -f ${BUILD_DIR}/*.deb
52+
@echo "Debian package files cleaned"
53+
54+
# Show version
55+
.PHONY: version
56+
version:
57+
@echo "Lumo v${VERSION}"
58+
@echo "Build date: ${BUILD_DATE}"
59+
@echo "Git commit: ${GIT_COMMIT}"
60+
@echo "Go version: ${GO_VERSION}"
61+
62+
# Build Debian package
63+
.PHONY: deb
64+
deb: build
65+
@echo "Building Debian package..."
66+
@./scripts/generate_control.sh
67+
@mkdir -p debian/usr/bin debian/usr/share/doc/lumo
68+
@cp ${BUILD_DIR}/${BINARY_NAME} debian/usr/bin/
69+
@cp README.md debian/usr/share/doc/lumo/
70+
@chmod 755 debian/usr/bin/${BINARY_NAME}
71+
@find debian -type d -exec chmod 755 {} \;
72+
@mkdir -p ${BUILD_DIR}
73+
@dpkg-deb --build debian ${DEB_PACKAGE}
74+
@echo "Debian package built: ${DEB_PACKAGE}"
75+
76+
# Help
77+
.PHONY: help
78+
help:
79+
@echo "Lumo Makefile"
80+
@echo ""
81+
@echo "Targets:"
82+
@echo " all - Build the binary (default)"
83+
@echo " build - Build the binary in the ${BUILD_DIR} directory"
84+
@echo " install - Install the binary to /usr/bin"
85+
@echo " test - Run tests"
86+
@echo " clean - Clean build artifacts from ${BUILD_DIR}"
87+
@echo " deb - Build a Debian package (.deb)"
88+
@echo " clean-deb - Clean Debian package files"
89+
@echo " version - Show version information"
90+
@echo " help - Show this help"

0 commit comments

Comments
 (0)