test: Add comprehensive backend unit tests (Issue #7) #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint-backend: | |
| name: Lint Go Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Run go vet | |
| run: cd server && go vet ./... | |
| - name: Run go fmt | |
| run: | | |
| cd server | |
| if [ -n "$(gofmt -l .)" ]; then | |
| echo "Go code is not formatted:" | |
| gofmt -d . | |
| exit 1 | |
| fi | |
| test-backend: | |
| name: Test Go Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Download dependencies | |
| run: cd server && go mod download | |
| - name: Run tests | |
| run: cd server && go test -v -race -coverprofile=coverage.txt ./... | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./server/coverage.txt | |
| flags: backend | |
| lint-frontend: | |
| name: Lint Frontend Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: cd webapp && npm ci | |
| - name: Run ESLint | |
| run: cd webapp && npm run lint | |
| test-frontend: | |
| name: Test Frontend Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: cd webapp && npm ci | |
| - name: Run tests | |
| run: cd webapp && npm test | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./webapp/coverage/lcov.info | |
| flags: frontend | |
| build: | |
| name: Build Plugin | |
| runs-on: ubuntu-latest | |
| needs: [lint-backend, test-backend, lint-frontend, test-frontend] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install frontend dependencies | |
| run: cd webapp && npm ci | |
| - name: Build plugin | |
| run: make build | |
| - name: Create bundle | |
| run: make bundle | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: plugin-bundle | |
| path: dist/com.appsome.claudecode.tar.gz |