Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
8d9a749
feat(publisher): integrate GitHub Client ID into device flow authenti…
sridharavinash May 25, 2025
8c18cb9
fix(publish): handle inline model corectly on publish
sridharavinash May 26, 2025
feff57f
feat(tests): add comprehensive tests for health and publish handlers
sridharavinash May 26, 2025
7c38a66
feat(tests): add integration tests for publish functionality and enha…
sridharavinash May 26, 2025
ec839b2
update tests and memory implementation to follow real DB implementati…
sridharavinash May 27, 2025
a5b0fad
feat(publish): set version as latest and add release date on publish
sridharavinash May 27, 2025
7354670
feat(tests): add unit tests for servers and servers detail handlers
sridharavinash May 27, 2025
9045eb0
refactor(tests): remove redundant TestServersDetailHandler integratio…
sridharavinash May 27, 2025
3f7e3a6
Merge branch 'main' into tests
sridharavinash May 27, 2025
c3b7ae7
feat(ci): add CI pipeline with linting, building, and testing jobs
sridharavinash May 27, 2025
26a8299
fix(tests): update server IDs to use real-ish uuids
sridharavinash May 27, 2025
9ad970f
Fixed linter errors and fixed tests
sridharavinash May 27, 2025
fc92f07
feat(script): add usage instructions and server startup methods to te…
sridharavinash May 27, 2025
434311a
feat(script): update publish test script
sridharavinash May 27, 2025
5faebbd
feat(publish): escape server name to prevent HTML injection attacks
sridharavinash May 28, 2025
bc5a5c3
go mod tidy
sridharavinash May 28, 2025
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
176 changes: 176 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: CI Pipeline

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

env:
GO_VERSION: '1.23.x'

jobs:
# Lint and Format Check
lint:
name: Lint and Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0

- name: Run golangci-lint
run: golangci-lint run --timeout=5m

- name: Check Go formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "The following files are not properly formatted:"
gofmt -s -l .
exit 1
fi

# Build check
build:
name: Build Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Build application
run: |
go build -v ./cmd/...

- name: Check for vulnerabilities
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

# Unit Tests
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

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

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-unit
fail_ci_if_error: false

# Integration Tests
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Run integration tests
run: |
chmod +x ./integrationtests/run_tests.sh
./integrationtests/run_tests.sh

- name: Run integration tests with coverage
run: |
go test -v -race -coverprofile=integration-coverage.out -covermode=atomic ./integrationtests/...

- name: Upload integration coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./integration-coverage.out
flags: integrationtests
name: codecov-integration
fail_ci_if_error: false

# Overall status check
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests]
if: always()
steps:
- name: Check test results
run: |
if [[ "${{ needs.unit-tests.result }}" == "success" && "${{ needs.integration-tests.result }}" == "success" ]]; then
echo "✅ All tests passed!"
exit 0
else
echo "❌ Some tests failed:"
echo " Unit tests: ${{ needs.unit-tests.result }}"
echo " Integration tests: ${{ needs.integration-tests.result }}"
exit 1
fi
74 changes: 74 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Integration Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest

strategy:
matrix:
go-version: ['1.23.x']

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
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Verify dependencies
run: go mod verify

- name: Set up test environment
run: |
# Create any necessary directories for test data
mkdir -p /tmp/test-data

- name: Run integration tests
run: |
# Run integration tests using the existing script
chmod +x ./integrationtests/run_tests.sh
./integrationtests/run_tests.sh

- name: Run integration tests with coverage
run: |
# Also run integration tests with Go test for coverage
go test -v -race -coverprofile=integration-coverage.out -covermode=atomic ./integrationtests/...

- name: Generate integration test coverage report
run: go tool cover -html=integration-coverage.out -o integration-coverage.html

- name: Upload integration coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./integration-coverage.out
flags: integrationtests
name: codecov-integration
fail_ci_if_error: false

- name: Upload integration coverage artifact
uses: actions/upload-artifact@v4
with:
name: integration-coverage-report
path: integration-coverage.html
63 changes: 63 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Unit Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest

strategy:
matrix:
go-version: ['1.23.x']

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
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Verify dependencies
run: go mod verify

- name: Run unit tests
run: |
# Run unit tests with coverage, excluding integration tests
go test -v -race -coverprofile=coverage.out -covermode=atomic ./internal/...

- name: Generate coverage report
run: go tool cover -html=coverage.out -o coverage.html

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.html
Loading
Loading