Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: faster e2e #2767

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
69 changes: 59 additions & 10 deletions .github/workflows/test-pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ env:
POSTGRES_DB: keepdb
# To test if imports are working properly
EE_ENABLED: true
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain # More concise build output
AUTH_TYPE: NO_AUTH
API_URL: http://keep-backend:8080
POSTHOG_DISABLED: true
SENTRY_DISABLED: true
DATABASE_CONNECTION_STRING: mysql+pymysql://root:keep@keep-database:3306/keep
SECRET_MANAGER_DIRECTORY: /app

jobs:
tests-e2e:
Expand Down Expand Up @@ -52,30 +60,71 @@ jobs:

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies using poetry
run: poetry install --no-interaction --no-root --with dev

- name: Get Playwright version from poetry.lock
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(grep "playwright" poetry.lock -A 5 | grep "version" | head -n 1 | cut -d'"' -f2)
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT

- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ steps.playwright-version.outputs.version }}

- name: Install playwright
run: poetry run playwright install
- name: Install Playwright and dependencies
run: |
if [ "${{ steps.playwright-cache.outputs.cache-hit }}" != "true" ]; then
poetry run playwright install chromium webkit --with-deps
else
poetry run playwright install-deps
fi

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up Keep environment
- name: Cache Docker build layers
uses: actions/cache@v4
id: docker-cache
with:
path: .buildx-cache
key: buildx-cache-${{ hashFiles('./docker/Dockerfile.*') }}
restore-keys: buildx-cache-

- name: Build keep-frontend image
run: |
docker buildx build \
--progress=plain \
--cache-from=type=local,src=.buildx-cache \
--cache-to=type=local,dest=.buildx-cache,mode=max \
-t keep-frontend:latest \
-f ./docker/Dockerfile.ui \
./keep-ui

- name: Build keep-backend image
run: |
docker buildx build \
--progress=plain \
--cache-from=type=local,src=.buildx-cache \
--cache-to=type=local,dest=.buildx-cache,mode=max \
-t keep-backend:latest \
-f ./docker/Dockerfile.api \
.

- name: Start services
run: |
DOCKER_BUILDKIT=1 docker compose \
--project-directory . \
-f tests/e2e_tests/docker-compose-e2e-${{ matrix.db_type }}.yml up -d
docker compose --project-directory . -f tests/e2e_tests/docker-compose-e2e-${{ matrix.db_type }}.yml up -d

- name: Wait for database to be ready
- name: Wait for services to be ready
run: |
# Add commands to wait for the database to be ready
if [ "${{ matrix.db_type }}" == "mysql" ]; then
Expand Down
4 changes: 1 addition & 3 deletions docker/Dockerfile.ui
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


FROM node:18-alpine AS base
FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
Expand Down
8 changes: 8 additions & 0 deletions keep-ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
.next
.vercel
.env.*
.venv/
.vscode/
.github/
.pytest_cache
1 change: 0 additions & 1 deletion keep-ui/app/(keep)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export const metadata = {
title: "Keep",
description: "The open-source AIOps and alert management platform.",
};

export default ProvidersPage;
Loading