Skip to content

Commit 6cca42a

Browse files
committed
feat: run atoms e2e in CI with local v2
1 parent 4629e6e commit 6cca42a

File tree

3 files changed

+77
-6
lines changed

3 files changed

+77
-6
lines changed

.github/workflows/e2e-atoms.yml

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,74 @@ permissions:
77
contents: read
88

99
env:
10-
NODE_OPTIONS: --max-old-space-size=8096
10+
## api v2 env
11+
ALLOWED_HOSTNAMES: ${{ vars.CI_ALLOWED_HOSTNAMES }}
12+
API_KEY_PREFIX: ${{ secrets.CI_API_KEY_PREFIX }}
13+
API_PORT: ${{ vars.CI_API_V2_PORT }}
14+
CALCOM_LICENSE_KEY: ${{ secrets.CI_CALCOM_LICENSE_KEY }}
15+
DAILY_API_KEY: ${{ secrets.CI_DAILY_API_KEY }}
16+
DATABASE_READ_URL: ${{ secrets.CI_DATABASE_URL }}
17+
DATABASE_WRITE_URL: ${{ secrets.CI_DATABASE_URL }}
18+
GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }}
19+
IS_E2E: true
20+
NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }}
21+
NEXTAUTH_URL: ${{ secrets.CI_NEXTAUTH_URL }}
22+
REDIS_URL: "redis://localhost:6379"
23+
LINGO_DOT_DEV_API_KEY: ${{ secrets.CI_LINGO_DOT_DEV_API_KEY }}
24+
STRIPE_PRIVATE_KEY: ${{ secrets.CI_STRIPE_PRIVATE_KEY }}
25+
STRIPE_API_KEY: ${{ secrets.CI_STRIPE_PRIVATE_KEY }}
26+
STRIPE_CLIENT_ID: ${{ secrets.CI_STRIPE_CLIENT_ID }}
27+
STRIPE_WEBHOOK_SECRET: ${{ secrets.CI_STRIPE_WEBHOOK_SECRET }}
28+
SLOTS_CACHE_TTL: ${{ secrets.CI_SLOTS_CACHE_TTL }}
29+
30+
## atoms e2e examples app env
1131
ATOMS_E2E_OAUTH_CLIENT_ID: ${{ secrets.ATOMS_E2E_OAUTH_CLIENT_ID }}
1232
ATOMS_E2E_OAUTH_CLIENT_SECRET: ${{ secrets.ATOMS_E2E_OAUTH_CLIENT_SECRET }}
1333
ATOMS_E2E_API_URL: ${{ secrets.ATOMS_E2E_API_URL }}
1434
ATOMS_E2E_ORG_ID: ${{ secrets.ATOMS_E2E_ORG_ID }}
1535
ATOMS_E2E_OAUTH_CLIENT_ID_BOOKER_EMBED: ${{ secrets.ATOMS_E2E_OAUTH_CLIENT_ID_BOOKER_EMBED }}
1636
ATOMS_E2E_APPLE_ID: ${{ secrets.ATOMS_E2E_APPLE_ID }}
1737
ATOMS_E2E_APPLE_CONNECT_APP_SPECIFIC_PASSCODE: ${{ secrets.ATOMS_E2E_APPLE_CONNECT_APP_SPECIFIC_PASSCODE }}
38+
39+
## env variables needed for both api v2 and examples app
1840
DATABASE_DIRECT_URL: ${{ secrets.CI_DATABASE_URL }}
1941
DATABASE_URL: ${{ secrets.CI_DATABASE_URL }}
42+
NODE_OPTIONS: --max-old-space-size=29000
2043

2144
jobs:
2245
e2e-atoms:
2346
timeout-minutes: 15
2447
name: E2E Atoms
25-
runs-on: buildjet-4vcpu-ubuntu-2204
48+
runs-on: buildjet-16vcpu-ubuntu-2204
49+
services:
50+
postgres:
51+
image: postgres:13
52+
credentials:
53+
username: ${{ secrets.DOCKERHUB_USERNAME }}
54+
password: ${{ secrets.DOCKERHUB_TOKEN }}
55+
env:
56+
POSTGRES_USER: postgres
57+
POSTGRES_PASSWORD: postgres
58+
POSTGRES_DB: calendso
59+
options: >-
60+
--health-cmd pg_isready
61+
--health-interval 10s
62+
--health-timeout 5s
63+
--health-retries 5
64+
ports:
65+
- 5432:5432
66+
redis:
67+
image: redis:latest
68+
credentials:
69+
username: ${{ secrets.DOCKERHUB_USERNAME }}
70+
password: ${{ secrets.DOCKERHUB_TOKEN }}
71+
ports:
72+
- 6379:6379
73+
options: >-
74+
--health-cmd "redis-cli ping"
75+
--health-interval 10s
76+
--health-timeout 5s
77+
--health-retries 5
2678
steps:
2779
- uses: docker/login-action@v3
2880
with:
@@ -31,10 +83,28 @@ jobs:
3183
- uses: actions/checkout@v4
3284
- uses: ./.github/actions/dangerous-git-checkout
3385
- uses: ./.github/actions/yarn-install
86+
- uses: ./.github/actions/cache-db
3487
- uses: ./.github/actions/yarn-playwright-install
88+
- name: Start API v2
89+
working-directory: apps/api/v2
90+
run: |
91+
yarn dev:no-docker &
92+
API_PID=$!
93+
echo "API_PID=$API_PID" >> $GITHUB_ENV
94+
95+
# Wait for API to be ready
96+
echo "Waiting for API v2 to be ready on port ${{ vars.CI_API_V2_PORT }}..."
97+
timeout 60 bash -c 'until curl -f http://localhost:${{ vars.CI_API_V2_PORT }}/health > /dev/null 2>&1; do sleep 2; done'
98+
echo "API v2 is ready!"
3599
- name: Run E2E Atoms Tests
36100
working-directory: packages/platform/examples/base
37101
run: yarn test:e2e
102+
- name: Stop API v2
103+
if: always()
104+
run: |
105+
if [ ! -z "$API_PID" ]; then
106+
kill $API_PID || true
107+
fi
38108
- name: Upload Test Results
39109
uses: actions/upload-artifact@v4
40110
if: always()

apps/api/v2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"_dev:build:watch:enums": "yarn workspace @calcom/platform-enums build:watch",
1717
"_dev:build:watch:utils": "yarn workspace @calcom/platform-utils build:watch",
1818
"_dev:build:watch:types": "yarn workspace @calcom/platform-types build:watch",
19-
"dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-enums build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build",
19+
"dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-enums build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build && yarn workspace @calcom/platform-libraries build",
2020
"dev": "yarn dev:build && ts-node scripts/docker-start.ts && yarn copy-swagger-module && yarn start --watch",
2121
"dev:no-docker": "yarn dev:build && yarn copy-swagger-module && yarn start --watch",
2222
"start:debug": "nest start --debug --watch",

packages/prisma/schema.prisma

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,9 +1885,10 @@ model PlatformOAuthClient {
18851885
bookingRedirectUri String?
18861886
bookingCancelRedirectUri String?
18871887
bookingRescheduleRedirectUri String?
1888-
areEmailsEnabled Boolean @default(false)
1889-
areDefaultEventTypesEnabled Boolean @default(true)
1890-
areCalendarEventsEnabled Boolean @default(true)
1888+
1889+
areEmailsEnabled Boolean @default(false)
1890+
areDefaultEventTypesEnabled Boolean @default(true)
1891+
areCalendarEventsEnabled Boolean @default(true)
18911892
18921893
createdAt DateTime @default(now())
18931894
}

0 commit comments

Comments
 (0)