-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (117 loc) · 3.18 KB
/
ci.yml
File metadata and controls
145 lines (117 loc) · 3.18 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
pull-requests: read
checks: write
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.26]
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Check formatting
if: runner.os != 'Windows'
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "The following files are not formatted:"
gofmt -s -l .
exit 1
fi
shell: bash
- name: Run go vet
run: go vet ./...
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=5m
- name: Install deadcode analyzer
run: go install golang.org/x/tools/cmd/deadcode@latest
- name: Check for dead code
run: deadcode -test ./...
- name: Run tests
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
files: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
build:
name: Build Artifacts
runs-on: ubuntu-latest
needs: test
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.26
cache: true
- name: Build CLI and MCP server
run: make build
- name: Test CLI binary execution
run: |
./git-pr-cli --version
./git-pr-cli --help
- name: Test MCP server binary execution
run: |
./git-pr-mcp --help || echo "MCP server started successfully"
- name: Cross-compile all platforms
run: make cross-compile
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: git-pr-binaries-${{ github.sha }}
path: bin/
retention-days: 7
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.26
cache: true
- name: Build binaries
run: make build
- name: Test configuration validation
run: |
# Test with sample config
cp config.sample config.yaml
./git-pr-cli validate --check-auth=false || echo "Config validation test completed"
- name: Test help commands
run: |
./git-pr-cli check --help
./git-pr-cli merge --help
./git-pr-cli setup --help
./git-pr-cli validate --help
./git-pr-cli stats --help
./git-pr-cli watch --help