Skip to content

feat: Enhance UI with new components and chart integration #278

feat: Enhance UI with new components and chart integration

feat: Enhance UI with new components and chart integration #278

Workflow file for this run

name: Unit Tests
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
jobs:
test:
name: Unit Tests
runs-on: ${{ matrix.os }}
env:
GO111MODULE: "on"
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.21", "1.22", "1.23.10"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/AppData/Local/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install frontend dependencies
run: cd frontend && npm ci
- name: Build frontend
run: cd frontend && npm run build
- name: Run unit tests (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: go test -v -race -timeout 5m '-coverprofile=coverage.out' -covermode=atomic '-run=^Test[^E]' ./...
- name: Run unit tests (Unix)
if: matrix.os != 'windows-latest'
run: go test -v -race -coverprofile=coverage.out -run "^Test[^E]" ./...
- name: Generate coverage report (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: go tool cover '-html=coverage.out' -o coverage.html
- name: Generate coverage report (Unix)
if: matrix.os != 'windows-latest'
run: go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.23.10'
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Upload coverage artifacts
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.23.10'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.out
coverage.html
lint:
name: Lint
runs-on: ubuntu-latest
env:
GO111MODULE: "on"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23.10"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install frontend dependencies
run: cd frontend && npm ci
- name: Build frontend
run: cd frontend && npm run build
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
build:
name: Build
runs-on: ${{ matrix.os }}
env:
GO111MODULE: "on"
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23.10"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install frontend dependencies
run: cd frontend && npm ci
- name: Build frontend
run: cd frontend && npm run build
- name: Build (Windows)
if: matrix.os == 'windows-latest'
run: go build -v -o mcpproxy.exe ./cmd/mcpproxy
- name: Build (Unix)
if: matrix.os != 'windows-latest'
run: go build -v ./cmd/mcpproxy
- name: Build for different architectures (Linux only)
if: matrix.os == 'ubuntu-latest'
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o mcpproxy-linux-amd64 ./cmd/mcpproxy
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o mcpproxy-linux-arm64 ./cmd/mcpproxy
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o mcpproxy-darwin-amd64 ./cmd/mcpproxy || echo "macOS amd64 cross-compilation may fail (expected)"
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o mcpproxy-darwin-arm64 ./cmd/mcpproxy || echo "macOS arm64 cross-compilation may fail (expected)"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o mcpproxy-windows-amd64.exe ./cmd/mcpproxy
- name: Upload build artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: binaries
path: mcpproxy-*