|
4 | 4 | branches: |
5 | 5 | - main |
6 | 6 | pull_request: |
7 | | - pull_request_target: |
8 | 7 | workflow_dispatch: |
9 | 8 |
|
10 | 9 | jobs: |
11 | 10 | test: |
12 | 11 | runs-on: ubuntu-latest |
13 | 12 | steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - - uses: actions/setup-go@v5 |
16 | | - with: |
17 | | - go-version-file: 'go.mod' |
18 | | - - run: go test ./... -race |
19 | | - |
20 | | - coverage: |
21 | | - runs-on: ubuntu-latest |
22 | | - if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' || (github.event_name == 'push' && github.ref == 'refs/heads/main') |
23 | | - permissions: |
24 | | - contents: read |
25 | | - pull-requests: write |
26 | | - steps: |
27 | | - - uses: actions/checkout@v4 |
28 | | - with: |
29 | | - ref: ${{ github.event.pull_request.head.sha }} |
30 | | - - uses: actions/setup-go@v5 |
31 | | - with: |
32 | | - go-version-file: 'go.mod' |
33 | | - - name: Run tests with coverage |
34 | | - run: | |
35 | | - go test -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v '/examples/' | grep -v '/testdata' | grep -v '/mcptest' | grep -v '/server/internal/gen') |
36 | | - - name: Upload coverage artifact |
37 | | - uses: actions/upload-artifact@v4 |
38 | | - with: |
39 | | - name: code-coverage |
40 | | - path: coverage.txt |
41 | | - retention-days: 30 |
42 | | - - name: Generate coverage report |
43 | | - |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - uses: actions/setup-go@v5 |
| 15 | + with: |
| 16 | + go-version-file: "go.mod" |
| 17 | + - run: go test ./... -race |
44 | 18 |
|
45 | 19 | verify-codegen: |
46 | 20 | runs-on: ubuntu-latest |
47 | 21 | steps: |
48 | | - - uses: actions/checkout@v4 |
49 | | - - uses: actions/setup-go@v5 |
50 | | - with: |
51 | | - go-version-file: 'go.mod' |
52 | | - - name: Run code generation |
53 | | - run: go generate ./... |
54 | | - - name: Check for uncommitted changes |
55 | | - run: | |
56 | | - if [[ -n $(git status --porcelain) ]]; then |
57 | | - echo "Error: Generated code is not up to date. Please run 'go generate ./...' and commit the changes." |
58 | | - git status |
59 | | - git diff |
60 | | - exit 1 |
61 | | - fi |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - uses: actions/setup-go@v5 |
| 24 | + with: |
| 25 | + go-version-file: "go.mod" |
| 26 | + - name: Run code generation |
| 27 | + run: go generate ./... |
| 28 | + - name: Check for uncommitted changes |
| 29 | + run: | |
| 30 | + if [[ -n $(git status --porcelain) ]]; then |
| 31 | + echo "Error: Generated code is not up to date. Please run 'go generate ./...' and commit the changes." |
| 32 | + git status |
| 33 | + git diff |
| 34 | + exit 1 |
| 35 | + fi |
0 commit comments