diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..56a183c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,127 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + go-services: + name: Build and test Go services + runs-on: ubuntu-latest + + strategy: + matrix: + service: + - cluster-agent + - control-plane/api-gateway + - control-plane/autoscaler-controller + - control-plane/cluster-manager + - control-plane/config-store + - control-plane/deployment-manager + - control-plane/function-manager + - control-plane/skypilot-bridge + - control-plane/smart-router + - control-plane/tenant-manager + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + + - name: Download dependencies + working-directory: ${{ matrix.service }} + run: go mod download + + - name: Build + working-directory: ${{ matrix.service }} + run: go build ./... + + - name: Test + working-directory: ${{ matrix.service }} + run: go test ./... + + python-skypilot-bridge: + name: Lint Python SkyPilot Bridge + runs-on: ubuntu-latest + + defaults: + run: + working-directory: control-plane/skypilot-bridge + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install ruff mypy pytest + + - name: Lint Python files + run: ruff check . + + - name: Type check Python files + run: mypy . || true + + - name: Run Python tests + run: | + if [ -d tests ]; then pytest; else echo "No Python tests found"; fi + + frontend: + name: Build React frontend + runs-on: ubuntu-latest + + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + run: npm ci + + - name: Build frontend + run: npm run build + + docker-builds: + name: Validate Docker builds + runs-on: ubuntu-latest + + strategy: + matrix: + service: + - cluster-agent + - control-plane/api-gateway + - control-plane/autoscaler-controller + - control-plane/cluster-manager + - control-plane/config-store + - control-plane/deployment-manager + - control-plane/function-manager + - control-plane/skypilot-bridge + - control-plane/smart-router + - control-plane/tenant-manager + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build Docker image + run: docker build -t detoserve-${{ strategy.job-index }} ${{ matrix.service }} \ No newline at end of file