Skip to content

Commit 0db6d1a

Browse files
Merge pull request #4 from DylanDevelops/ravel/distribution-prototype
feat: Very Basic CI/CD Pipeline
2 parents efed7fe + dfbd55a commit 0db6d1a

7 files changed

Lines changed: 278 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
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.21'
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v6
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
runs-on: ${{ matrix.os }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.21'
23+
24+
- name: Build
25+
run: go build -v ./...
26+
27+
- name: Test basic commands
28+
run: |
29+
go build -o tmpo${{ matrix.os == 'windows-latest' && '.exe' || '' }} .
30+
./tmpo${{ matrix.os == 'windows-latest' && '.exe' || '' }} --version
31+
./tmpo${{ matrix.os == 'windows-latest' && '.exe' || '' }} --help

.goreleaser.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
# macOS (both Intel and Apple Silicon)
9+
- id: macos
10+
goos: [darwin]
11+
goarch: [amd64, arm64]
12+
binary: tmpo
13+
ldflags:
14+
- -s -w
15+
- -X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
16+
- -X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
17+
- -X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
18+
19+
# Linux
20+
- id: linux
21+
goos: [linux]
22+
goarch: [amd64, arm64]
23+
env:
24+
- CGO_ENABLED=0
25+
binary: tmpo
26+
ldflags:
27+
- -s -w
28+
- -X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
29+
- -X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
30+
- -X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
31+
32+
# Windows
33+
- id: windows
34+
goos: [windows]
35+
goarch: [amd64, arm64]
36+
env:
37+
- CGO_ENABLED=0
38+
binary: tmpo
39+
ldflags:
40+
- -s -w
41+
- -X github.com/DylanDevelops/tmpo/cmd.Version={{.Version}}
42+
- -X github.com/DylanDevelops/tmpo/cmd.Commit={{.Commit}}
43+
- -X github.com/DylanDevelops/tmpo/cmd.Date={{.Date}}
44+
45+
archives:
46+
- id: windows-zip
47+
builds: [windows]
48+
name_template: >-
49+
{{ .ProjectName }}_
50+
{{- .Version }}_
51+
{{- title .Os }}_
52+
{{- if eq .Arch "amd64" }}x86_64
53+
{{- else if eq .Arch "386" }}i386
54+
{{- else }}{{ .Arch }}{{ end }}
55+
format: zip
56+
files:
57+
- README.md
58+
- LICENSE
59+
60+
- id: unix-targz
61+
builds: [macos, linux]
62+
name_template: >-
63+
{{ .ProjectName }}_
64+
{{- .Version }}_
65+
{{- title .Os }}_
66+
{{- if eq .Arch "amd64" }}x86_64
67+
{{- else if eq .Arch "386" }}i386
68+
{{- else }}{{ .Arch }}{{ end }}
69+
format: tar.gz
70+
files:
71+
- README.md
72+
- LICENSE
73+
74+
checksum:
75+
name_template: 'checksums.txt'
76+
algorithm: sha256
77+
78+
snapshot:
79+
version_template: "{{ incpatch .Version }}-next"
80+
81+
changelog:
82+
use: github-native
83+
sort: asc
84+
groups:
85+
- title: ✨ Features
86+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
87+
order: 0
88+
- title: 🐛 Bug Fixes
89+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
90+
order: 1
91+
- title: 🚀 Performance Improvements
92+
regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$'
93+
order: 2
94+
- title: 🔨 Refactoring
95+
regexp: '^.*?refactor(\([[:word:]]+\))??!?:.+$'
96+
order: 3
97+
- title: 📚 Documentation
98+
regexp: '^.*?docs?(\([[:word:]]+\))??!?:.+$'
99+
order: 4
100+
- title: 🔧 Build & Dependencies
101+
regexp: '^.*?(build|ci)(\([[:word:]]+\))??!?:.+$'
102+
order: 5
103+
- title: 🧹 Maintenance
104+
regexp: '^.*?chore(\([[:word:]]+\))??!?:.+$'
105+
order: 6
106+
- title: 📦 Other Changes
107+
order: 999
108+
filters:
109+
exclude:
110+
- '^test:'
111+
- '^ci:'
112+
- Merge pull request
113+
- Merge remote-tracking branch
114+
- Merge branch
115+
- go mod tidy
116+
117+
release:
118+
github:
119+
owner: DylanDevelops
120+
name: tmpo
121+
draft: true # Turn to false when first release is ready
122+
prerelease: auto
123+
name_template: "tmpo {{.Version}}"
124+
125+
# Homebrew
126+
brews:
127+
- name: tmpo
128+
repository:
129+
owner: DylanDevelops
130+
name: tmpo
131+
commit_author:
132+
name: goreleaserbot
133+
email: bot@goreleaser.com
134+
homepage: "https://github.com/DylanDevelops/tmpo"
135+
description: "Minimal CLI time tracker for developers"
136+
license: "MIT"
137+
skip_upload: true # Turn to false when first release is ready
138+
install: |
139+
bin.install "tmpo"
140+
test: |
141+
system "#{bin}/tmpo", "--version"

cmd/root.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
package cmd
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/spf13/cobra"
78
)
89

10+
var (
11+
Version = "dev"
12+
Commit = "none"
13+
Date = "unknown"
14+
)
15+
916
var rootCmd = &cobra.Command{
1017
Use: "tmpo",
1118
Short: "Minimal CLI time tracker for developers",
1219
Long: `tmpo - Set the tmpo
1320
1421
A minimal, developer-friendly time tracking tool that lives in your terminal.
1522
Track time effortlessly with automatic project detection and simple commands.`,
23+
Version: Version,
1624
}
1725

1826
func Execute() {
@@ -23,5 +31,8 @@ func Execute() {
2331
}
2432

2533
func init() {
26-
rootCmd.Version = "0.1.0"
34+
rootCmd.SetVersionTemplate(fmt.Sprintf(
35+
"tmpo version %s\ncommit: %s\nbuilt: %s\n",
36+
Version, Commit, Date,
37+
))
2738
}

go.mod

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ module github.com/DylanDevelops/tmpo
33
go 1.25.5
44

55
require (
6-
github.com/mattn/go-sqlite3 v1.14.32
76
github.com/spf13/cobra v1.10.2
87
go.yaml.in/yaml/v3 v3.0.4
8+
modernc.org/sqlite v1.40.1
99
)
1010

1111
require (
12+
github.com/dustin/go-humanize v1.0.1 // indirect
13+
github.com/google/uuid v1.6.0 // indirect
1214
github.com/inconshreveable/mousetrap v1.1.0 // indirect
15+
github.com/mattn/go-isatty v0.0.20 // indirect
16+
github.com/ncruces/go-strftime v0.1.9 // indirect
17+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
1318
github.com/spf13/pflag v1.0.10 // indirect
19+
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
20+
golang.org/x/sys v0.36.0 // indirect
21+
modernc.org/libc v1.66.10 // indirect
22+
modernc.org/mathutil v1.7.1 // indirect
23+
modernc.org/memory v1.11.0 // indirect
1424
)

go.sum

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
2+
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
3+
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
4+
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
5+
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
6+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
7+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
28
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
39
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4-
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
5-
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
10+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
11+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
12+
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
13+
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
14+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
15+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
616
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
717
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
818
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
@@ -11,5 +21,42 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
1121
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
1222
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
1323
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
24+
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
25+
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
26+
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
27+
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
28+
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
29+
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
30+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
31+
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
32+
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
33+
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
34+
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
1435
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1536
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
37+
modernc.org/cc/v4 v4.26.5 h1:xM3bX7Mve6G8K8b+T11ReenJOT+BmVqQj0FY5T4+5Y4=
38+
modernc.org/cc/v4 v4.26.5/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
39+
modernc.org/ccgo/v4 v4.28.1 h1:wPKYn5EC/mYTqBO373jKjvX2n+3+aK7+sICCv4Fjy1A=
40+
modernc.org/ccgo/v4 v4.28.1/go.mod h1:uD+4RnfrVgE6ec9NGguUNdhqzNIeeomeXf6CL0GTE5Q=
41+
modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA=
42+
modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
43+
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
44+
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
45+
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
46+
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
47+
modernc.org/libc v1.66.10 h1:yZkb3YeLx4oynyR+iUsXsybsX4Ubx7MQlSYEw4yj59A=
48+
modernc.org/libc v1.66.10/go.mod h1:8vGSEwvoUoltr4dlywvHqjtAqHBaw0j1jI7iFBTAr2I=
49+
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
50+
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
51+
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
52+
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
53+
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
54+
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
55+
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
56+
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
57+
modernc.org/sqlite v1.40.1 h1:VfuXcxcUWWKRBuP8+BR9L7VnmusMgBNNnBYGEe9w/iY=
58+
modernc.org/sqlite v1.40.1/go.mod h1:9fjQZ0mB1LLP0GYrp39oOJXx/I2sxEnZtzCmEQIKvGE=
59+
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
60+
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
61+
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
62+
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=

internal/storage/db.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"path/filepath"
88
"time"
99

10-
_ "github.com/mattn/go-sqlite3"
10+
_ "modernc.org/sqlite"
1111
)
1212

1313
// Database is a thin wrapper around an *sql.DB connection pool.
@@ -53,7 +53,7 @@ func Initialize() (*Database, error) {
5353
}
5454

5555
dbPath := filepath.Join(tmpoDir, "tmpo.db")
56-
db, err := sql.Open("sqlite3", dbPath)
56+
db, err := sql.Open("sqlite", dbPath)
5757

5858
if err != nil {
5959
return nil, fmt.Errorf("failed to open database: %w", err)

0 commit comments

Comments
 (0)