cli + tui to publish to leaflet (wip) & manage tasks, notes & watch/read lists 馃崈
charm leaflet readability golang
29
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 191 lines 6.0 kB view raw
1version: '3' 2 3vars: 4 BINARY_NAME: noteleaf 5 BUILD_DIR: ./tmp 6 CMD_DIR: ./cmd 7 COVERAGE_FILE: coverage.out 8 COVERAGE_HTML: coverage.html 9 VERSION_PKG: github.com/stormlightlabs/noteleaf/internal/version 10 11 # Git version detection 12 GIT_COMMIT: 13 sh: git rev-parse --short HEAD 2>/dev/null || echo "none" 14 GIT_TAG: 15 sh: git describe --tags --exact-match 2>/dev/null || echo "" 16 GIT_DESCRIBE: 17 sh: git describe --tags --always --dirty 2>/dev/null || echo "dev" 18 BUILD_DATE: 19 sh: date -u +"%Y-%m-%dT%H:%M:%SZ" 20 21tasks: 22 default: 23 desc: Show available tasks 24 silent: true 25 cmds: 26 - task --list 27 28 test: 29 desc: Run all tests 30 cmds: 31 - go test ./... 32 33 coverage: 34 desc: Generate HTML coverage report 35 cmds: 36 - go test -coverprofile={{.COVERAGE_FILE}} ./... 37 - go tool cover -html={{.COVERAGE_FILE}} -o {{.COVERAGE_HTML}} 38 - echo "Coverage report generated at {{.COVERAGE_HTML}}" 39 40 cov: 41 desc: Show coverage in terminal 42 cmds: 43 - go test -coverprofile={{.COVERAGE_FILE}} ./... 44 - go tool cover -func={{.COVERAGE_FILE}} 45 46 build: 47 desc: Build binary (simple build without version injection) 48 cmds: 49 - mkdir -p {{.BUILD_DIR}} 50 - go build -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}} 51 - echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}}" 52 53 build:dev: 54 desc: Build binary with dev version (includes git commit hash and dev tools) 55 vars: 56 VERSION: "{{.GIT_DESCRIBE}}" 57 LDFLAGS: "-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Commit={{.GIT_COMMIT}} -X {{.VERSION_PKG}}.BuildDate={{.BUILD_DATE}}" 58 cmds: 59 - mkdir -p {{.BUILD_DIR}} 60 - go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}} 61 - 'echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}} (version: {{.VERSION}})"' 62 63 build:rc: 64 desc: Build release candidate binary (requires git tag with -rc suffix, excludes dev tools) 65 vars: 66 VERSION: "{{.GIT_TAG}}" 67 LDFLAGS: "-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Commit={{.GIT_COMMIT}} -X {{.VERSION_PKG}}.BuildDate={{.BUILD_DATE}}" 68 preconditions: 69 - sh: '[ -n "{{.GIT_TAG}}" ]' 70 msg: "No git tag found. Create a tag with 'git tag v1.0.0-rc1' first." 71 - sh: 'echo "{{.GIT_TAG}}" | grep -q "\-rc"' 72 msg: "Git tag must contain '-rc' for release candidate builds (e.g., v1.0.0-rc1)" 73 cmds: 74 - mkdir -p {{.BUILD_DIR}} 75 - go build -tags prod -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}} 76 - 'echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}} (version: {{.VERSION}})"' 77 78 build:prod: 79 desc: Build production binary (requires clean semver git tag, excludes dev tools) 80 vars: 81 VERSION: "{{.GIT_TAG}}" 82 LDFLAGS: "-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Commit={{.GIT_COMMIT}} -X {{.VERSION_PKG}}.BuildDate={{.BUILD_DATE}}" 83 preconditions: 84 - sh: '[ -n "{{.GIT_TAG}}" ]' 85 msg: "No git tag found. Create a tag with 'git tag v1.0.0' first." 86 - sh: 'echo "{{.GIT_TAG}}" | grep -qE "^v?[0-9]+\.[0-9]+\.[0-9]+$"' 87 msg: "Git tag must be a clean semver version (e.g., v1.0.0 or 1.0.0) without prerelease suffix" 88 - sh: '[ -z "$(git status --porcelain)" ]' 89 msg: "Working directory must be clean (no uncommitted changes) for production builds" 90 cmds: 91 - mkdir -p {{.BUILD_DIR}} 92 - go build -tags prod -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_DIR}} 93 - 'echo "Built {{.BUILD_DIR}}/{{.BINARY_NAME}} (version: {{.VERSION}})"' 94 95 clean: 96 desc: Remove build artifacts and coverage files 97 cmds: 98 - rm -f {{.COVERAGE_FILE}} {{.COVERAGE_HTML}} 99 - rm -rf {{.BUILD_DIR}} 100 - echo "Cleaned build artifacts" 101 102 lint: 103 desc: Run linters (go vet and go fmt) 104 cmds: 105 - go vet ./... 106 - go fmt ./... 107 108 check: 109 desc: Run linters and coverage tests 110 cmds: 111 - task: lint 112 - task: cov 113 114 deps: 115 desc: Download and tidy dependencies 116 cmds: 117 - go mod download 118 - go mod tidy 119 120 run: 121 desc: Build and run the application 122 deps: [build] 123 cmds: 124 - '{{.BUILD_DIR}}/{{.BINARY_NAME}}' 125 126 status: 127 desc: Show Go version, module info, and dependencies 128 silent: true 129 cmds: 130 - echo "=== Go Version ===" 131 - go version 132 - echo "" 133 - echo "=== Module Info ===" 134 - go list -m 135 - echo "" 136 - echo "=== Dependencies ===" 137 - go list -m all 138 139 dev: 140 desc: Full development workflow (clean, lint, test, build) 141 cmds: 142 - task: clean 143 - task: lint 144 - task: test 145 - task: build 146 147 docs:generate: 148 desc: Generate documentation in all formats 149 cmds: 150 - go run tools/docgen.go -output website/docs/manual -format docusaurus 151 - go run tools/docgen.go -output docs/manual -format man 152 - echo "Documentation generated" 153 154 docs:man: 155 desc: Generate man pages 156 cmds: 157 - mkdir -p docs/manual 158 - go run tools/docgen.go -output docs/manual -format man 159 - echo "Man pages generated in docs/manual" 160 161 docs:serve: 162 desc: Start docusaurus development server 163 dir: website 164 cmds: 165 - npm run start 166 167 version:show: 168 desc: Display current version information 169 silent: true 170 cmds: 171 - echo "Version info:" 172 - 'echo " Git tag: {{.GIT_TAG}}"' 173 - 'echo " Git commit: {{.GIT_COMMIT}}"' 174 - 'echo " Git describe: {{.GIT_DESCRIBE}}"' 175 - 'echo " Build date: {{.BUILD_DATE}}"' 176 177 version:validate: 178 desc: Validate git tag format for releases 179 cmds: 180 - | 181 if [ -z "{{.GIT_TAG}}" ]; then 182 echo "No git tag found" 183 exit 1 184 fi 185 if echo "{{.GIT_TAG}}" | grep -qE "^v?[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$"; then 186 echo "Valid version tag: {{.GIT_TAG}}" 187 else 188 echo "Invalid version tag: {{.GIT_TAG}}" 189 echo "Expected format: v1.0.0 or v1.0.0-rc1" 190 exit 1 191 fi