Skip to content

Add MCP server support to THOP #10

Add MCP server support to THOP

Add MCP server support to THOP #10

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-go:
name: Test Go
runs-on: ubuntu-latest
defaults:
run:
working-directory: thop-go
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: thop-go/go.sum
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./...
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: thop-go/coverage.out
flags: go
fail_ci_if_error: false
integration-test-go:
name: Integration Test Go
runs-on: ubuntu-latest
defaults:
run:
working-directory: thop-go
services:
sshd:
image: lscr.io/linuxserver/openssh-server:latest
env:
PUID: 1000
PGID: 1000
PASSWORD_ACCESS: "true"
USER_NAME: testuser
USER_PASSWORD: testpass123
ports:
- 2222:2222
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: thop-go/go.sum
- name: Wait for SSH to be ready
run: |
for i in {1..30}; do
if nc -z localhost 2222; then
echo "SSH is ready"
break
fi
echo "Waiting for SSH..."
sleep 2
done
- name: Run integration tests
env:
THOP_INTEGRATION_TESTS: "1"
run: go test -v -tags=integration ./internal/session/...
build-go:
name: Build Go
runs-on: ubuntu-latest
needs: test-go
defaults:
run:
working-directory: thop-go
strategy:
matrix:
goos: [linux, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: thop-go/go.sum
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -ldflags="-s -w" -o thop-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/thop
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: thop-${{ matrix.goos }}-${{ matrix.goarch }}
path: thop-go/thop-${{ matrix.goos }}-${{ matrix.goarch }}
lint-go:
name: Lint Go
runs-on: ubuntu-latest
defaults:
run:
working-directory: thop-go
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: thop-go/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
working-directory: thop-go
args: --timeout=5m