-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (68 loc) · 2.06 KB
/
Copy pathci.yml
File metadata and controls
72 lines (68 loc) · 2.06 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Lint
if: matrix.os == 'ubuntu-latest'
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
- name: Test with coverage
run: go test -race -covermode=atomic -coverprofile=coverage.out ./cmd/... ./internal/...
- name: Enforce coverage threshold
if: matrix.os == 'ubuntu-latest'
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep '^total:' | awk '{print $3}' | sed 's/%//')
if [ -z "$COVERAGE" ]; then
echo "❌ Could not extract coverage total — coverage.out may be empty"
exit 1
fi
echo "Coverage: ${COVERAGE}%"
if awk "BEGIN {exit ($COVERAGE >= 70)}"; then
echo "❌ Coverage ${COVERAGE}% is below 70% threshold"
exit 1
fi
echo "✅ Coverage ${COVERAGE}% meets threshold"
integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build binary
run: go build -o /tmp/devlog .
- name: Run integration tests
run: go test -tags=integration -race -timeout=2m -v ./tests/integration/...
env:
DEVLOG_TEST_BINARY: /tmp/devlog
regression:
name: Regression Tests
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build binary
run: go build -o /tmp/devlog .
- name: Run regression tests
run: go test -tags=regression -timeout=5m -v ./tests/regression/...
env:
DEVLOG_TEST_BINARY: /tmp/devlog