Skip to content

Commit e0a81da

Browse files
authored
Merge pull request #17 from m0n0x41d/dev
Release: 4.1.0
2 parents b5b715c + 637fc01 commit e0a81da

Some content is hidden

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

54 files changed

+6462
-1075
lines changed

.githooks/pre-commit

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Running pre-commit checks..."
5+
6+
# Check if we have Go files staged
7+
STAGED_GO_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$' || true)
8+
9+
if [ -n "$STAGED_GO_FILES" ]; then
10+
echo "Checking Go files..."
11+
12+
# Format check
13+
echo " → gofmt"
14+
UNFORMATTED=$(gofmt -l $STAGED_GO_FILES 2>/dev/null || true)
15+
if [ -n "$UNFORMATTED" ]; then
16+
echo "ERROR: The following files need formatting (run 'gofmt -w'):"
17+
echo "$UNFORMATTED"
18+
exit 1
19+
fi
20+
21+
# Build check
22+
echo " → go build"
23+
(cd src/mcp && go build -o /dev/null .) || {
24+
echo "ERROR: Build failed"
25+
exit 1
26+
}
27+
28+
# Test check
29+
echo " → go test"
30+
(cd src/mcp && go test ./... -short) || {
31+
echo "ERROR: Tests failed"
32+
exit 1
33+
}
34+
35+
# Lint check (if golangci-lint is installed)
36+
if command -v golangci-lint &> /dev/null; then
37+
echo " → golangci-lint"
38+
(cd src/mcp && golangci-lint run --config .golangci.yml) || {
39+
echo "ERROR: Linting failed"
40+
exit 1
41+
}
42+
fi
43+
fi
44+
45+
# Check if command files changed
46+
STAGED_CMD_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '^src/commands/' || true)
47+
48+
if [ -n "$STAGED_CMD_FILES" ]; then
49+
echo "Checking command files sync..."
50+
./build.sh
51+
if ! git diff --exit-code dist/ > /dev/null 2>&1; then
52+
echo "ERROR: dist/ out of sync. Run ./build.sh and stage the changes."
53+
exit 1
54+
fi
55+
fi
56+
57+
echo "All checks passed!"

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main, dev]
6+
push:
7+
branches: [main, dev]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
test:
15+
name: Test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '1.23'
25+
cache-dependency-path: src/mcp/go.sum
26+
27+
- name: Run tests
28+
run: |
29+
cd src/mcp
30+
go test -v -race -coverprofile=coverage.out ./...
31+
32+
- name: Upload coverage
33+
uses: codecov/codecov-action@v4
34+
with:
35+
file: src/mcp/coverage.out
36+
fail_ci_if_error: false
37+
continue-on-error: true
38+
39+
lint:
40+
name: Lint
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v5
48+
with:
49+
go-version: '1.23'
50+
cache-dependency-path: src/mcp/go.sum
51+
52+
- name: Run golangci-lint
53+
uses: golangci/golangci-lint-action@v7
54+
with:
55+
version: v2.1.6
56+
working-directory: src/mcp
57+
args: --timeout=5m
58+
59+
build:
60+
name: Build
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Set up Go
67+
uses: actions/setup-go@v5
68+
with:
69+
go-version: '1.23'
70+
cache-dependency-path: src/mcp/go.sum
71+
72+
- name: Build binary
73+
run: |
74+
cd src/mcp
75+
go build -o quint-code .

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ jobs:
3535
- name: Build MCP binary
3636
run: |
3737
cd src/mcp
38-
go build -o "../../dist/quint-code" -trimpath
38+
VERSION=${GITHUB_REF_NAME#v}
39+
COMMIT=${GITHUB_SHA::8}
40+
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
41+
LDFLAGS="-s -w -X quint-mcp/cmd.Version=${VERSION} -X quint-mcp/cmd.Commit=${COMMIT} -X quint-mcp/cmd.BuildDate=${DATE}"
42+
go build -o "../../dist/quint-code" -trimpath -ldflags "${LDFLAGS}"
3943
4044
- name: Create release package
4145
run: |

.pre-commit-config.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
args: ['--maxkb=500']
10+
- id: check-merge-conflict
11+
- id: detect-private-key
12+
13+
- repo: https://github.com/dnephin/pre-commit-golang
14+
rev: v0.5.1
15+
hooks:
16+
- id: go-fmt
17+
args: ['-w']
18+
files: \.go$
19+
- id: go-imports
20+
args: ['-w']
21+
files: \.go$
22+
23+
- repo: https://github.com/golangci/golangci-lint
24+
rev: v1.62.2
25+
hooks:
26+
- id: golangci-lint
27+
entry: golangci-lint run --fix
28+
args: ['--config', 'src/mcp/.golangci.yml']
29+
files: ^src/mcp/
30+
31+
- repo: local
32+
hooks:
33+
- id: go-test
34+
name: go test
35+
entry: bash -c 'cd src/mcp && go test ./...'
36+
language: system
37+
files: \.go$
38+
pass_filenames: false
39+
40+
- id: go-build
41+
name: go build
42+
entry: bash -c 'cd src/mcp && go build -o /dev/null .'
43+
language: system
44+
files: \.go$
45+
pass_filenames: false
46+
47+
- id: check-dist-sync
48+
name: check dist/ in sync
49+
entry: bash -c './build.sh && git diff --exit-code dist/'
50+
language: system
51+
files: ^src/commands/
52+
pass_filenames: false

0 commit comments

Comments
 (0)