Refactors Github Workflows (#7267)

* Testing

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update production-build.yml

* Tests

* Update production-build.yml

* Update pr.yml

* Update pr.yml

* Update nextjs-bundle-analysis.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update production-build.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* test

* Test

* Revert

* TEST

* Update production-build.yml

* Update production-build.yml

* DRY

* Fixes

* Update action.yml

* Update action.yml

* Fixes

* WIP

* Update action.yml

* Update action.yml

* Abstract playwright cache

* Update yarn-e2e.yml

* Adds type check

* Update pr.yml

* Tests

* Anotha one

* Update action.yml

* Update pr.yml

* Update action.yml

* Cleanup

* Update package.json

* Update yarn-e2e.yml

* Test

* Cleanup

* Update check-types.yml

* Update yarn-install.yml

* Update yarn-install.yml

* Update yarn-install.yml

* Fixes

* Fixes

* Update pr.yml

* Fixes

* Removed required checks

* WIP

* Adjustments

* Update action.yml

* Update pr.yml

* Comments out buildjet

* Caches DB

* Update lint.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Upgrades actions/checkout@v3

* Build fixes

* Update nextjs-bundle-analysis.yml

* Update nextjs-bundle-analysis.yml

* Update nextjs-bundle-analysis.yml

* Fixes?

* Inherit secrets

* Re-enables buildjet

* Adds missing build cache to e2e

* Revert "Re-enables buildjet"

This reverts commit badd655e1e.

* Fixes build env

* Revert "Revert "Re-enables buildjet""

This reverts commit a1d78e7c12.

* Update .github/actions/cache-db/action.yml

* Define CODEOWNERS file (#7245)

* Start defining CODEOWNERS file

* Update CODEOWNERS

---------

Co-authored-by: Omar López <zomars@me.com>

* improved brand colors on booking page (#7269)

---------

Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
Omar López 2023-02-21 17:10:39 -07:00 committed by GitHub
parent f5318c6be3
commit d26732c9dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 465 additions and 318 deletions

23
.github/actions/cache-build/action.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: Cache production build binaries
description: "Cache or restore if necessary"
env:
node_version: v16.x
runs:
using: "composite"
steps:
- name: Cache production build
uses: actions/cache@v3
env:
cache-name: prod-build
key-1: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }}
key-2: ${{ hashFiles('apps/web/next.config.js') }}
with:
path: |
apps/web/.next
node_modules/.cache/turbo
**/.turbo/**
**/dist/**
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-
${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-

34
.github/actions/cache-db/action.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Cache database between jobs
description: "Cache or restore if necessary"
inputs:
DATABASE_URL:
required: true
path:
required: false
default: "backups/backup.sql"
runs:
using: "composite"
steps:
- name: Cache database
id: cache-db
uses: actions/cache@v3
env:
cache-name: cache-db
with:
path: ${{ inputs.path }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.path }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ inputs.path }}-
- name: Postgres Dump Backup
if: steps.cache-db.outputs.cache-hit != 'true'
uses: tj-actions/pg-dump@v2.3
with:
database_url: ${{ inputs.DATABASE_URL }}
path: ${{ inputs.path }}
options: "-O"
- name: Postgres Backup Restore
if: steps.cache-db.outputs.cache-hit == 'true'
uses: tj-actions/pg-restore@v4.5
with:
database_url: ${{ inputs.DATABASE_URL }}
backup_file: ${{ inputs.path }}

View File

@ -0,0 +1,10 @@
name: Dangerous git Checkout
description: "Git Checkout from PR code so we can run checks from forks"
runs:
using: "composite"
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2

104
.github/actions/yarn-build/action.yml vendored Normal file
View File

@ -0,0 +1,104 @@
name: Production Build
description: "Creates a production build, caches it and restores if necessary"
inputs:
DATABASE_URL:
required: true
NEXT_PUBLIC_WEBAPP_URL:
required: true
NEXT_PUBLIC_WEBSITE_URL:
required: true
NEXTAUTH_SECRET:
required: true
GOOGLE_API_CREDENTIALS:
required: true
GOOGLE_LOGIN_ENABLED:
required: true
CRON_API_KEY:
required: false
CALENDSO_ENCRYPTION_KEY:
required: true
DAILY_API_KEY:
required: true
NEXT_PUBLIC_STRIPE_PUBLIC_KEY:
required: true
NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE:
required: true
NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE:
required: true
NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE:
required: true
NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE:
required: true
NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN:
required: true
STRIPE_PRIVATE_KEY:
required: true
STRIPE_CLIENT_ID:
required: true
STRIPE_WEBHOOK_SECRET:
required: true
STRIPE_PRO_PLAN_PRODUCT_ID:
required: true
STRIPE_PREMIUM_PLAN_PRODUCT_ID:
required: true
STRIPE_FREE_PLAN_PRODUCT_ID:
required: true
PAYMENT_FEE_PERCENTAGE:
required: true
PAYMENT_FEE_FIXED:
required: true
SAML_DATABASE_URL:
required: true
SAML_ADMINS:
required: true
NEXTAUTH_URL:
required: true
NEXT_PUBLIC_IS_E2E:
required: true
TURBO_TOKEN:
required: true
TURBO_TEAM:
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/cache-build
id: prod-build-cache
- name: Next.js production build
if: steps.prod-build-cache.outputs.cache-hit != 'true'
shell: bash
env:
DATABASE_URL: ${{ inputs.DATABASE_URL }}
NEXT_PUBLIC_WEBAPP_URL: ${{ inputs.NEXT_PUBLIC_WEBAPP_URL }}
NEXT_PUBLIC_WEBSITE_URL: ${{ inputs.NEXT_PUBLIC_WEBSITE_URL }}
NEXTAUTH_SECRET: ${{ inputs.NEXTAUTH_SECRET }}
GOOGLE_API_CREDENTIALS: ${{ inputs.GOOGLE_API_CREDENTIALS }}
GOOGLE_LOGIN_ENABLED: ${{ inputs.GOOGLE_LOGIN_ENABLED }}
CALENDSO_ENCRYPTION_KEY: ${{ inputs.CALENDSO_ENCRYPTION_KEY }}
DAILY_API_KEY: ${{ inputs.DAILY_API_KEY }}
NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${{ inputs.NEXT_PUBLIC_STRIPE_PUBLIC_KEY }}
NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE: ${{ inputs.NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE: ${{ inputs.NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE: ${{ inputs.NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE: ${{ inputs.NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE }}
NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN: ${{ inputs.NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN }}
STRIPE_PRIVATE_KEY: ${{ inputs.STRIPE_PRIVATE_KEY }}
STRIPE_CLIENT_ID: ${{ inputs.STRIPE_CLIENT_ID }}
STRIPE_WEBHOOK_SECRET: ${{ inputs.STRIPE_WEBHOOK_SECRET }}
STRIPE_PRO_PLAN_PRODUCT_ID: ${{ inputs.STRIPE_PRO_PLAN_PRODUCT_ID }}
STRIPE_PREMIUM_PLAN_PRODUCT_ID: ${{ inputs.STRIPE_PREMIUM_PLAN_PRODUCT_ID }}
STRIPE_FREE_PLAN_PRODUCT_ID: ${{ inputs.STRIPE_FREE_PLAN_PRODUCT_ID }}
PAYMENT_FEE_PERCENTAGE: ${{ inputs.PAYMENT_FEE_PERCENTAGE }}
PAYMENT_FEE_FIXED: ${{ inputs.PAYMENT_FEE_FIXED }}
SAML_DATABASE_URL: ${{ inputs.SAML_DATABASE_URL }}
SAML_ADMINS: ${{ inputs.SAML_ADMINS }}
NEXTAUTH_URL: ${{ inputs.NEXTAUTH_URL }}
NEXT_PUBLIC_IS_E2E: ${{ inputs.NEXT_PUBLIC_IS_E2E }}
TURBO_TOKEN: ${{ inputs.TURBO_TOKEN }}
TURBO_TEAM: ${{ inputs.TURBO_TEAM }}
run: |
yarn db-seed
yarn build

30
.github/actions/yarn-install/action.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Yarn install
description: "Install all NPM dependencies, caches them and restores if necessary"
env:
node_version: v16.x
runs:
using: "composite"
steps:
- name: Use Node ${{ env.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
cache: "yarn"
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v3
env:
cache-name: node-modules-yarn
cache-key: ${{ env.node_version }}-${{ hashFiles('yarn.lock', 'packages/prisma/schema.prisma') }}
with:
path: |
**/node_modules/**
packages/prisma/zod
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }}
restore-keys: ${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn install
shell: bash
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: |
yarn install --prefer-offline --frozen-lockfile
yarn prisma generate

View File

@ -0,0 +1,19 @@
name: Install playwright binaries
description: "Install playwright, cache and restore if necessary"
runs:
using: "composite"
steps:
- name: Cache playwright binaries
id: playwright-cache
uses: actions/cache@v2
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
${{ github.workspace }}/node_modules/playwright
key: cache-playwright-${{ hashFiles('**/yarn.lock') }}
restore-keys: cache-playwright-
- name: Yarn playwright install
shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install

View File

@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # So we can test on forks
fetch-depth: 0

View File

@ -1,34 +1,17 @@
name: Check types
on:
pull_request_target:
branches:
- main
paths:
- "**.tsx?"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
workflow_call:
env:
NODE_OPTIONS: "--max-old-space-size=8192"
jobs:
check-types:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install
- name: Use Node 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "yarn"
- name: Show info
run: node -e "console.log(require('v8').getHeapStatistics())"
- run: yarn --frozen-lockfile
- run: yarn type-check

View File

@ -9,14 +9,12 @@ concurrency:
cancel-in-progress: true
jobs:
required-checks:
uses: calcom/cal.com/.github/workflows/required-checks.yml@main
synchronize-with-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: crowdin action
uses: crowdin/github-action@1.4.9

View File

@ -7,7 +7,7 @@ jobs:
db-staging-snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Snaplet CLI
run: curl -sL https://app.snaplet.dev/get-cli/ | bash
- name: Restore Snapshot

View File

@ -1,29 +1,12 @@
name: E2E App-Store Apps
on:
push:
branches: [fixes/e2e-consolidation] # TODO: Remove this after merged in main
pull_request_target: # So we can test on forks
branches:
- main
paths-ignore:
- apps/api/**
- apps/console/**
- apps/docs/**
- apps/swagger/**
- apps/website/**
- apps/web/public/**
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
workflow_call:
jobs:
test:
e2e-app-store:
timeout-minutes: 20
name: E2E App-Store Apps
strategy:
matrix:
node: ["16.x"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
@ -65,32 +48,15 @@ jobs:
- 5432:5432
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }} # So we can test on forks
fetch-depth: 2
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- run: echo 'NODE_OPTIONS="--max_old_space_size=4096"' >> $GITHUB_ENV
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- uses: ./.github/actions/cache-db
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: Cache playwright binaries
uses: actions/cache@v2
id: playwright-cache
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
${{ github.workspace }}/node_modules/playwright
key: cache-playwright-${{ hashFiles('**/yarn.lock') }}
restore-keys: cache-playwright-
- run: yarn --frozen-lockfile
- name: Install playwright deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps
DATABASE_URL: ${{ env.DATABASE_URL }}
- uses: ./.github/actions/cache-build
- name: Run Tests
run: yarn test-e2e:app-store

View File

@ -1,21 +1,11 @@
name: E2E Embed tests and booking flow(for non-embed as well)
on:
pull_request_target: # So we can test on forks
branches:
- main
# Embed e2e - tests verify booking flow which is applicable to non-embed case also. So, don't ignore apps/web changes.
paths:
- apps/web/**
- packages/embeds/**
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
e2e-embed:
timeout-minutes: 20
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
NEXT_PUBLIC_WEBAPP_URL: http://localhost:3000
@ -61,35 +51,17 @@ jobs:
- 5432:5432
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }} # So we can test on forks
fetch-depth: 2
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- run: echo 'NODE_OPTIONS="--max_old_space_size=4096"' >> $GITHUB_ENV
- name: Use Node 16.x
uses: actions/setup-node@v3
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- uses: ./.github/actions/cache-db
with:
node-version: 16.x
cache: "yarn"
- name: Cache playwright binaries
uses: actions/cache@v2
id: playwright-cache
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
${{ github.workspace }}/node_modules/playwright
key: cache-playwright-${{ hashFiles('**/yarn.lock') }}
restore-keys: cache-playwright-
- run: yarn --frozen-lockfile
- name: Install playwright deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps
DATABASE_URL: ${{ env.DATABASE_URL }}
- uses: ./.github/actions/cache-build
- name: Run Tests
run: yarn turbo run embed-tests-update-snapshots:ci --scope=@calcom/embed-react --concurrency=1
- name: Upload embed-core results
if: ${{ always() }}
uses: actions/upload-artifact@v2

View File

@ -1,20 +1,10 @@
name: E2E test
on:
pull_request_target: # So we can test on forks
branches:
- main
paths:
- apps/web/**
- packages/**
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
e2e:
timeout-minutes: 20
runs-on: buildjet-4vcpu-ubuntu-2204
env:
DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
NEXT_PUBLIC_WEBAPP_URL: http://localhost:3000
@ -64,34 +54,16 @@ jobs:
- 5432:5432
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }} # So we can test on forks
fetch-depth: 2
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- run: echo 'NODE_OPTIONS="--max_old_space_size=4096"' >> $GITHUB_ENV
- name: Use Node 16.x
uses: actions/setup-node@v3
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- uses: ./.github/actions/cache-db
with:
node-version: 16.x
cache: "yarn"
- name: Cache playwright binaries
uses: actions/cache@v2
id: playwright-cache
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
${{ github.workspace }}/node_modules/playwright
key: cache-playwright-${{ hashFiles('**/yarn.lock') }}
restore-keys: cache-playwright-
- run: yarn --frozen-lockfile
- name: Install playwright deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps
DATABASE_URL: ${{ env.DATABASE_URL }}
- uses: ./.github/actions/cache-build
- run: yarn test-e2e
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v2

View File

@ -1,38 +1,14 @@
name: Lint
on:
pull_request_target:
branches:
- main
paths:
- "**.tsx?"
- "**.jsx?"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
workflow_call:
jobs:
lint:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Use Node 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "yarn"
- name: Install deps
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
- name: Test Code Linting
run: yarn lint
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install
- name: Save Code Linting Reports
run: yarn lint:report
continue-on-error: true

View File

@ -1,91 +1,21 @@
name: "Next.js Bundle Analysis"
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
# change this if your nextjs app does not live at the root of the repo
working-directory: ./apps/web/
workflow_call:
jobs:
analyze:
env:
DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
NEXT_PUBLIC_WEBAPP_URL: http://localhost:3000
NEXT_PUBLIC_WEBSITE_URL: http://localhost:3000
NEXTAUTH_SECRET: secret
GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }}
GOOGLE_LOGIN_ENABLED: true
CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }}
DAILY_API_KEY: ${{ secrets.CI_DAILY_API_KEY }}
NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PUBLIC_KEY }}
NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE: ${{ secrets.NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE }}
NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN: 1
STRIPE_PRIVATE_KEY: ${{ secrets.CI_STRIPE_PRIVATE_KEY }}
STRIPE_CLIENT_ID: ${{ secrets.CI_STRIPE_CLIENT_ID }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.CI_STRIPE_WEBHOOK_SECRET }}
STRIPE_PRO_PLAN_PRODUCT_ID: ${{ secrets.CI_STRIPE_PRO_PLAN_PRODUCT_ID }}
STRIPE_PREMIUM_PLAN_PRODUCT_ID: ${{ secrets.CI_STRIPE_PREMIUM_PLAN_PRODUCT_ID }}
STRIPE_FREE_PLAN_PRODUCT_ID: ${{ secrets.CI_STRIPE_FREE_PLAN_PRODUCT_ID }}
PAYMENT_FEE_PERCENTAGE: 0.005
PAYMENT_FEE_FIXED: 10
SAML_DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
SAML_ADMINS: pro@example.com
NEXTAUTH_URL: http://localhost:3000/api/auth
NEXT_PUBLIC_IS_E2E: 1
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
services:
postgres:
image: postgres:12.1
env:
POSTGRES_USER: postgres
POSTGRES_DB: calendso
ports:
- 5432:5432
runs-on: ubuntu-latest
steps:
- run: cd ${{ github.workspace }}
- uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "yarn"
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Restore next build
uses: actions/cache@v2
id: restore-build-cache
env:
cache-name: cache-next-build
with:
path: apps/web/.next/cache
# change this if you prefer a more strict cache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Build next.js app
# change this if your site requires a custom build command
run: cd ../.. && yarn db-seed && yarn build
# Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/cache-build
- name: Analyze bundle
run: npx -p nextjs-bundle-analysis report
run: |
cd apps/web
npx -p nextjs-bundle-analysis report
- name: Upload bundle
uses: actions/upload-artifact@v2
@ -116,12 +46,15 @@ jobs:
# entry in your package.json file.
- name: Compare with base branch bundle
if: success() && github.event.number
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
run: |
cd apps/web
ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
- name: Get comment body
id: get-comment-body
if: success() && github.event.number
run: |
cd apps/web
body=$(cat .next/analyze/__bundle_analysis_comment.txt)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"

88
.github/workflows/pr.yml vendored Normal file
View File

@ -0,0 +1,88 @@
name: PR Update
on:
push:
pull_request_target:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
app-store: ${{ steps.filter.outputs.app-store }}
embed: ${{ steps.filter.outputs.embed }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
app-store:
- 'apps/web/**'
- 'packages/app-store/**'
embed:
- 'apps/web/**'
- 'packages/embeds/**'
setup:
name: Yarn install & cache
uses: ./.github/workflows/yarn-install.yml
secrets: inherit
type-check:
name: Type check
needs: setup
uses: ./.github/workflows/check-types.yml
secrets: inherit
test:
name: Unit tests
needs: setup
uses: ./.github/workflows/test.yml
secrets: inherit
lint:
name: Linters
needs: setup
uses: ./.github/workflows/lint.yml
secrets: inherit
build:
name: Production build
needs: setup
uses: ./.github/workflows/production-build.yml
secrets: inherit
e2e:
name: E2E tests
needs: [lint, build]
uses: ./.github/workflows/e2e.yml
secrets: inherit
e2e-app-store:
name: E2E App Store tests
if: ${{ needs.changes.outputs.app-store == 'true' }}
needs: [changes, lint, build]
uses: ./.github/workflows/e2e-app-store.yml
secrets: inherit
e2e-embed:
name: E2E embeds tests
if: ${{ needs.changes.outputs.embed == 'true' }}
needs: [changes, lint, build]
uses: ./.github/workflows/e2e.yml
secrets: inherit
analyze:
needs: build
uses: ./.github/workflows/nextjs-bundle-analysis.yml
secrets: inherit

85
.github/workflows/production-build.yml vendored Normal file
View File

@ -0,0 +1,85 @@
name: Production Build
on:
workflow_call:
env:
DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
NEXT_PUBLIC_WEBAPP_URL: http://localhost:3000
NEXT_PUBLIC_WEBSITE_URL: http://localhost:3000
NEXTAUTH_SECRET: secret
GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }}
GOOGLE_LOGIN_ENABLED: true
# CRON_API_KEY: xxx
CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }}
DAILY_API_KEY: ${{ secrets.CI_DAILY_API_KEY }}
NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PUBLIC_KEY }}
NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE: ${{ secrets.NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE }}
NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN: 1
STRIPE_PRIVATE_KEY: ${{ secrets.CI_STRIPE_PRIVATE_KEY }}
STRIPE_CLIENT_ID: ${{ secrets.CI_STRIPE_CLIENT_ID }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.CI_STRIPE_WEBHOOK_SECRET }}
STRIPE_PRO_PLAN_PRODUCT_ID: ${{ secrets.CI_STRIPE_PRO_PLAN_PRODUCT_ID }}
STRIPE_PREMIUM_PLAN_PRODUCT_ID: ${{ secrets.CI_STRIPE_PREMIUM_PLAN_PRODUCT_ID }}
STRIPE_FREE_PLAN_PRODUCT_ID: ${{ secrets.CI_STRIPE_FREE_PLAN_PRODUCT_ID }}
PAYMENT_FEE_PERCENTAGE: 0.005
PAYMENT_FEE_FIXED: 10
SAML_DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
SAML_ADMINS: pro@example.com
NEXTAUTH_URL: http://localhost:3000/api/auth
NEXT_PUBLIC_IS_E2E: 1
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:12.1
env:
POSTGRES_USER: postgres
POSTGRES_DB: calendso
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-build
with:
# GitHub Composite actions cannot read secrets, we have to pass them in here
DATABASE_URL: ${{ env.DATABASE_URL }}
NEXT_PUBLIC_WEBAPP_URL: ${{ env.NEXT_PUBLIC_WEBAPP_URL }}
NEXT_PUBLIC_WEBSITE_URL: ${{ env.NEXT_PUBLIC_WEBSITE_URL }}
NEXTAUTH_SECRET: ${{ env.NEXTAUTH_SECRET }}
GOOGLE_API_CREDENTIALS: ${{ env.GOOGLE_API_CREDENTIALS }}
GOOGLE_LOGIN_ENABLED: ${{ env.GOOGLE_LOGIN_ENABLED }}
CALENDSO_ENCRYPTION_KEY: ${{ env.CALENDSO_ENCRYPTION_KEY }}
DAILY_API_KEY: ${{ env.DAILY_API_KEY }}
NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${{ env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY }}
NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE: ${{ env.NEXT_PUBLIC_STRIPE_FREE_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE: ${{ env.NEXT_PUBLIC_STRIPE_PRO_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE: ${{ env.NEXT_PUBLIC_STRIPE_PREMIUM_PLAN_PRICE }}
NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE: ${{ env.NEXT_PUBLIC_STRIPE_PREMIUM_NEW_PLAN_PRICE }}
NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN: ${{ env.NEXT_PUBLIC_IS_PREMIUM_NEW_PLAN }}
STRIPE_PRIVATE_KEY: ${{ env.STRIPE_PRIVATE_KEY }}
STRIPE_CLIENT_ID: ${{ env.STRIPE_CLIENT_ID }}
STRIPE_WEBHOOK_SECRET: ${{ env.STRIPE_WEBHOOK_SECRET }}
STRIPE_PRO_PLAN_PRODUCT_ID: ${{ env.STRIPE_PRO_PLAN_PRODUCT_ID }}
STRIPE_PREMIUM_PLAN_PRODUCT_ID: ${{ env.STRIPE_PREMIUM_PLAN_PRODUCT_ID }}
STRIPE_FREE_PLAN_PRODUCT_ID: ${{ env.STRIPE_FREE_PLAN_PRODUCT_ID }}
PAYMENT_FEE_PERCENTAGE: ${{ env.PAYMENT_FEE_PERCENTAGE }}
PAYMENT_FEE_FIXED: ${{ env.PAYMENT_FEE_FIXED }}
SAML_DATABASE_URL: ${{ env.SAML_DATABASE_URL }}
SAML_ADMINS: ${{ env.SAML_ADMINS }}
NEXTAUTH_URL: ${{ env.NEXTAUTH_URL }}
NEXT_PUBLIC_IS_E2E: ${{ env.NEXT_PUBLIC_IS_E2E }}
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
TURBO_TEAM: ${{ env.TURBO_TEAM }}
- uses: ./.github/actions/cache-db
with:
DATABASE_URL: ${{ env.DATABASE_URL }}

View File

@ -1,44 +0,0 @@
name: "Meta Workflow: Require Conditional Status Checks"
on:
pull_request:
branches:
- main
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
required-checks:
runs-on: ubuntu-latest
steps:
- name: Ensure All Conditional Checks Have Passed
uses: blend/require-conditional-status-checks@2022.02.04
with:
timeout: 15m
github-token: ${{ github.token }}
interval: 20s
# Question marks aren't working
# @see https://github.com/blend/require-conditional-status-checks/pull/11
checks-yaml: |
- job: lint
paths:
- /**/*.jsx
- /**/*.js
- /**/*.tsx
- /**/*.ts
- job: check-types
paths:
- /**/*.tsx
- /**/*.ts
- job: e2e
paths:
- /apps/web/**
- /packages/**
- job: e2e-embed
paths:
- /apps/web/**
- /packages/embeds/**
- job: test
paths:
- /apps/web/**
- /packages/**

View File

@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GH_ACCESS_TOKEN }}

View File

@ -1,33 +1,17 @@
name: Unit tests
on:
pull_request_target: # So we can test on forks
branches:
- main
paths:
- apps/web/**
- packages/**
workflow_call:
workflow_run:
workflows: [Crowdin Action]
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }} # So we can test on forks
fetch-depth: 2
# Should be an 8GB machine as per https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- run: echo 'NODE_OPTIONS="--max_old_space_size=6144"' >> $GITHUB_ENV
- name: Use Node 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "yarn"
- run: yarn --frozen-lockfile
- uses: ./.github/actions/yarn-install
# Should be an 8GB machine as per https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
- run: yarn test

14
.github/workflows/yarn-install.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Yarn install
on:
workflow_call:
jobs:
setup:
name: Yarn install & cache
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/dangerous-git-checkout
- uses: ./.github/actions/yarn-install

View File

@ -57,8 +57,8 @@
"tdd": "jest --watch",
"e2e": "NEXT_PUBLIC_IS_E2E=1 yarn playwright test --project=@calcom/web",
"e2e:app-store": "QUICK=true yarn playwright test --project=@calcom/app-store",
"test-e2e": "yarn db-seed && yarn build && yarn e2e",
"test-e2e:app-store": "yarn db-seed && yarn build && yarn e2e:app-store",
"test-e2e": "yarn db-seed && yarn e2e",
"test-e2e:app-store": "yarn db-seed && yarn e2e:app-store",
"test-playwright": "yarn playwright test --config=playwright.config.ts",
"test": "jest",
"type-check": "turbo run type-check",