test: add e2e tests with localstack for all scanners, and make summarization stuff work #57
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: [master, dev] | |
| pull_request: | |
| paths: | |
| - backend/** | |
| - frontend/** | |
| - .github/** | |
| jobs: | |
| commitlint: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install commitlint | |
| run: | | |
| npm install -g @commitlint/cli @commitlint/config-conventional | |
| - name: Validate PR commits | |
| run: | | |
| npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
| go-checks: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || | |
| contains(github.event.head_commit.modified, 'backend/api/') || | |
| contains(github.event.head_commit.modified, 'backend/worker/') || | |
| contains(github.event.head_commit.modified, '.github/') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| service: | |
| - name: api | |
| path: backend/api | |
| cmd: server | |
| - name: worker | |
| path: backend/worker | |
| cmd: worker | |
| env: | |
| GOLANGCI_LINT_CACHE: ~/.cache/golangci-lint | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.24" | |
| cache: true | |
| cache-dependency-path: | | |
| backend/api/go.sum | |
| backend/worker/go.sum | |
| - name: Cache golangci-lint | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/golangci-lint | |
| key: ${{ runner.os }}-golangci-${{ matrix.service.name }} | |
| - name: Go mod tidy (verify) | |
| run: | | |
| cd ${{ matrix.service.path }} | |
| go mod tidy | |
| git diff --exit-code | |
| - name: Go lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.6 | |
| working-directory: ${{ matrix.service.path }} | |
| args: --timeout=5m | |
| - name: Go build | |
| run: | | |
| cd ${{ matrix.service.path }} | |
| go build ./cmd/${{ matrix.service.cmd }} | |
| - name: Go tests | |
| run: | | |
| cd ${{ matrix.service.path }} | |
| go test -race -parallel=4 ./... | |
| - name: Security scan | |
| run: | | |
| go install github.com/securego/gosec/v2/cmd/gosec@latest | |
| cd ${{ matrix.service.path }} | |
| gosec -exclude=G115,G103 -severity=HIGH ./... | |
| python-checks: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || | |
| contains(github.event.head_commit.modified, 'backend/ai/') || | |
| contains(github.event.head_commit.modified, '.github/') | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Cache uv | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/uv | |
| key: ${{ runner.os }}-uv-${{ hashFiles('backend/ai/pyproject.toml', 'backend/ai/uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv- | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Python lint + type check | |
| run: | | |
| cd backend/ai | |
| uv venv | |
| uv pip install fastapi uvicorn mypy ruff bandit pytest | |
| uv run ruff check app/ | |
| export MYPYPATH=. && uv run mypy app/routers/health.py | |
| - name: Python tests | |
| run: | | |
| cd backend/ai | |
| PYTHONPATH=. uv run pytest tests/ | |
| - name: Security scan (Python) | |
| run: | | |
| cd backend/ai | |
| uv run bandit -r app/ | |
| frontend-checks: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || | |
| contains(github.event.head_commit.modified, 'frontend/') || | |
| contains(github.event.head_commit.modified, '.github/') | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Frontend lint and format | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run lint | |
| npm run format:check | |
| - name: Frontend tests | |
| run: | | |
| cd frontend | |
| npm run test | |
| - name: Security scan (Frontend) | |
| run: | | |
| cd frontend | |
| npm audit --omit=dev || true | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || | |
| contains(github.event.head_commit.modified, 'backend/') || | |
| contains(github.event.head_commit.modified, 'frontend/') || | |
| contains(github.event.head_commit.modified, 'infra/docker-compose.yml') | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Build Docker images | |
| run: | | |
| docker compose -f infra/docker-compose.yml build |