-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjustfile
More file actions
174 lines (149 loc) · 5.47 KB
/
justfile
File metadata and controls
174 lines (149 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Jivetalking - Just Commands
# Import presenter integration tests if testdata/justfile exists (not in git)
import? 'testdata/justfile'
# List commands
default:
@just --list
# Check ffmpeg-statigo submodule is present
_check-submodule:
#!/usr/bin/env bash
if [ ! -f "third_party/ffmpeg-statigo/go.mod" ]; then
echo "Error: ffmpeg-statigo submodule not initialised. Run 'just setup' first."
exit 1
fi
if [ ! -f "third_party/ffmpeg-statigo/lib/$(go env GOOS)_$(go env GOARCH)/libffmpeg.a" ]; then
echo "Error: ffmpeg-statigo library not downloaded. Run 'just setup' first."
exit 1
fi
# Get latest stable ffmpeg-statigo release tag from GitHub
_get-latest-tag:
#!/usr/bin/env bash
if command -v jq &> /dev/null; then
curl -s https://api.github.com/repos/linuxmatters/ffmpeg-statigo/releases | \
jq -r '[.[] | select(.prerelease == false and .draft == false and (.tag_name | startswith("v")))][0].tag_name'
else
curl -s https://api.github.com/repos/linuxmatters/ffmpeg-statigo/releases | \
grep -B5 '"prerelease": false' | grep '"tag_name"' | grep -v 'lib-' | head -1 | cut -d'"' -f4
fi
# Setup or update ffmpeg-statigo submodule and library
setup:
#!/usr/bin/env bash
set -e
echo "Configuring git for submodule-friendly pulls..."
git config pull.ff only
git config submodule.recurse true
TAG=$(just _get-latest-tag)
if [ -z "$TAG" ] || [ "$TAG" = "null" ]; then
echo "Error: Could not fetch latest release tag"
exit 1
fi
if [ ! -f "third_party/ffmpeg-statigo/go.mod" ]; then
echo "Initialising ffmpeg-statigo submodule..."
git submodule update --init --recursive
fi
cd third_party/ffmpeg-statigo
git fetch --tags
CURRENT=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ "$CURRENT" = "$TAG" ]; then
echo "ffmpeg-statigo already at latest version ($TAG)"
cd ../..
else
if [ -n "$CURRENT" ]; then
echo "Updating ffmpeg-statigo from $CURRENT to $TAG..."
else
echo "Setting up ffmpeg-statigo $TAG..."
fi
git checkout "$TAG"
cd ../..
rm -f third_party/ffmpeg-statigo/lib/*/libffmpeg.a
git add third_party/ffmpeg-statigo
fi
echo "Checking ffmpeg-statigo libraries..."
cd third_party/ffmpeg-statigo && go run ./cmd/download-lib
cd ../..
if git diff --cached --quiet third_party/ffmpeg-statigo; then
echo "Setup complete!"
else
echo ""
echo "Setup complete! Submodule updated to $TAG"
echo "Don't forget to commit: git commit -m 'chore: update ffmpeg-statigo to $TAG'"
fi
# Build jivetalking
build: _check-submodule
#!/usr/bin/env bash
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
echo "Building jivetalking version: $VERSION"
CGO_ENABLED=1 go build -ldflags="-X main.version=$VERSION" -o jivetalking ./cmd/jivetalking
# Clean build artifacts
clean:
@rm -fv jivetalking 2>/dev/null || true
@rm -fv testdata/LMP-*-processed.* 2>/dev/null || true
@rm -fv testdata/LMP-*-stashed.* 2>/dev/null || true
@rm -fv testdata/*.png 2>/dev/null || true
@rm -fv testdata/*.txt 2>/dev/null || true
# Run tests
test: _check-submodule
go test ./...
# Install jivetalking to ~/.local/bin
install: build
@mkdir -p ~/.local/bin 2>/dev/null || true
@mv ./jivetalking ~/.local/bin/jivetalking
@echo "Installed jivetalking to ~/.local/bin/jivetalking"
@echo "Make sure ~/.local/bin is in your PATH"
# Make a VHS tape recording
vhs: build
@vhs ./jivetalking.tape
# Show current version (from git tags or "dev" if no tags)
version:
@git describe --tags --always --dirty 2>/dev/null || echo "dev"
# List recent releases
releases:
@git tag --sort=-creatordate | head -10
# Show what would be in the next release changelog
changelog:
#!/usr/bin/env bash
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LATEST_TAG" ]; then
echo "Changes since $LATEST_TAG:"
git log $LATEST_TAG..HEAD --pretty=format:"* %s (%h)"
else
echo "No previous tags found. All commits:"
git log --pretty=format:"* %s (%h)"
fi
# Create a new release tag (requires VERSION=x.y.z)
release VERSION:
#!/usr/bin/env bash
set -e
# Validate version format
if ! echo "{{VERSION}}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Error: VERSION must be in format x.y.z (e.g., 0.1.0)"
exit 1
fi
# Check for uncommitted changes
if ! git diff-index --quiet HEAD --; then
echo "Error: Working directory has uncommitted changes"
exit 1
fi
# Check if tag already exists
if git rev-parse "{{VERSION}}" >/dev/null 2>&1; then
echo "Error: Tag {{VERSION}} already exists"
exit 1
fi
echo "Creating release {{VERSION}}..."
git tag -a "{{VERSION}}" -m "Release {{VERSION}}"
echo "✓ Tag {{VERSION}} created"
echo ""
echo "To publish the release:"
echo " git push origin {{VERSION}}"
echo ""
echo "This will trigger the GitHub Actions release workflow which will:"
echo " - Build binaries for all platforms"
echo " - Generate changelog from commits"
echo " - Create GitHub release with downloadable assets"
# Run linters
lint: _check-submodule
@go vet ./...
@gocyclo -top 20 -avg -ignore '_test\.go$' .
@ineffassign ./...
@golangci-lint run
@actionlint