Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true

- name: Download dependencies
run: go mod download

- name: Run unit tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./internal/...

- name: Run integration tests
run: go test -v -race -run "^Test.*Integration$|^TestToken|^TestMCPTools|^TestError|^TestConcurrent" .

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
flags: unittests
name: codecov-umbrella
continue-on-error: true

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
continue-on-error: true

build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true

- name: Build
run: go build -v .

- name: Verify build artifacts
run: |
if [ ! -f "./last9-mcp-server" ]; then
echo "Build artifact not found"
exit 1
fi
./last9-mcp-server --version || echo "Version check completed"
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,25 @@ Configure Windsurf to use the MCP server:

For local development and testing, you can run the MCP server in HTTP mode which makes it easier to debug requests and responses.

### Running Tests Locally

```bash
# Run all tests with verbose output
go test -v ./...

# Run integration tests only
go test -v -run "^Test.*Integration$|^TestToken|^TestMCPTools|^TestError|^TestConcurrent" .

# Run with race detection
go test -v -race ./...

# Run with coverage
go test -v -coverprofile=coverage.txt ./...
go tool cover -html=coverage.txt # View coverage in browser
```

**Note**: Integration tests use mock servers and don't require real credentials.

### Running in HTTP Mode

Set the `HTTP_MODE` environment variable to enable HTTP server mode:
Expand Down
Loading
Loading