main
1name: Go
2
3on:
4 push:
5 branches: [ main ]
6 pull_request:
7 branches: [ main ]
8
9jobs:
10 test:
11 runs-on: ubuntu-latest
12 steps:
13 - uses: actions/checkout@v4
14
15 - name: Set up Go
16 uses: actions/setup-go@v4
17 with:
18 go-version: '1.21'
19
20 - name: Download dependencies
21 run: go mod download
22
23 - name: Run tests
24 run: go test -v ./...
25
26 - name: Run tests with race detector
27 run: go test -race -short ./...
28
29 - name: Run tests with coverage
30 run: go test -coverprofile=coverage.out ./...
31
32 - name: Upload coverage to Codecov
33 uses: codecov/codecov-action@v3
34 with:
35 file: ./coverage.out
36
37 build:
38 runs-on: ubuntu-latest
39 needs: test
40 steps:
41 - uses: actions/checkout@v4
42
43 - name: Set up Go
44 uses: actions/setup-go@v4
45 with:
46 go-version: '1.21'
47
48 - name: Build servers
49 run: make build
50
51 - name: Upload artifacts
52 uses: actions/upload-artifact@v3
53 with:
54 name: mcp-servers-linux
55 path: bin/
56
57 lint:
58 runs-on: ubuntu-latest
59 steps:
60 - uses: actions/checkout@v4
61
62 - name: Set up Go
63 uses: actions/setup-go@v4
64 with:
65 go-version: '1.21'
66
67 - name: golangci-lint
68 uses: golangci/golangci-lint-action@v3
69 with:
70 version: latest
71
72 release:
73 runs-on: ubuntu-latest
74 needs: [test, build, lint]
75 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
76 steps:
77 - uses: actions/checkout@v4
78
79 - name: Set up Go
80 uses: actions/setup-go@v4
81 with:
82 go-version: '1.21'
83
84 - name: Build release binaries
85 run: make release
86
87 - name: Upload release artifacts
88 uses: actions/upload-artifact@v3
89 with:
90 name: mcp-servers-release
91 path: bin/