Skip to content

Commit 58e6352

Browse files
author
Carlos Bolanos
committed
first commit basic where/and/or queries
0 parents  commit 58e6352

22 files changed

+2291
-0
lines changed

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
name: Run Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.23'
22+
23+
- name: Cache Go modules
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- name: Download dependencies
32+
run: go mod download
33+
34+
- name: Run unit tests
35+
run: make test-unit
36+
37+
- name: Run integration tests
38+
run: make test-integration
39+
40+
- name: Generate coverage report
41+
run: |
42+
cd tests/unit
43+
go test -coverprofile=coverage.out -coverpkg=github.com/bolanosdev/query-builder .
44+
go tool cover -func=coverage.out
45+
46+
- name: Check coverage threshold
47+
run: |
48+
cd tests/unit
49+
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
50+
echo "Coverage: ${COVERAGE}%"
51+
if (( $(echo "$COVERAGE < 85.0" | bc -l) )); then
52+
echo "Coverage is below 85%"
53+
exit 1
54+
fi

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go build
12+
bin/
13+
dist/
14+
15+
# Go workspace file
16+
go.work
17+
18+
# IDE
19+
.idea/
20+
.vscode/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS
26+
.DS_Store

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: test test-unit test-integration test-verbose test-coverage clean
2+
3+
test: test-unit test-integration
4+
5+
test-unit:
6+
@echo "Running unit tests..."
7+
@go test -v ./tests/unit/
8+
9+
test-integration:
10+
@echo "Running integration tests..."
11+
@go test -v ./tests/integration/
12+
13+
test-verbose:
14+
@echo "Running all tests with verbose output..."
15+
@go test -v ./tests/...
16+
17+
test-coverage:
18+
@echo "Running tests with coverage..."
19+
@go test -cover ./tests/...
20+
21+
clean:
22+
@echo "Cleaning test cache..."
23+
@go clean -testcache

0 commit comments

Comments
 (0)