diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 281fe50e56..c343290a97 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,25 +48,11 @@ jobs: e2e-test: name: E2E tests - runs-on: ubuntu-latest needs: [lint, build] - timeout-minutes: 10 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ env.node_version }} - - name: Restore node_modules from cache - uses: actions/cache@v3 - env: - cache-name: node-modules-yarn - cache-fingerprint: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }} - with: - path: node_modules - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} - - run: yarn playwright install - - name: Run tests - run: yarn e2e + uses: ./.github/workflows/yarn-e2e.yml + secrets: + node_version: ${{ secrets.NODE_VERSION }} + analyze: runs-on: ubuntu-latest needs: build diff --git a/.github/workflows/yarn-e2e.yml b/.github/workflows/yarn-e2e.yml new file mode 100644 index 0000000000..4a29e88764 --- /dev/null +++ b/.github/workflows/yarn-e2e.yml @@ -0,0 +1,93 @@ +name: Yarn E2E + +on: + workflow_call: + secrets: + node_version: + required: true + +concurrency: + group: yarn-e2e-${{ github.sha }} + +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: 79GVSsl2tJR6x8IZkL0yfWs1XVxDu965 + 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 + # EMAIL_FROM: e2e@cal.com + # EMAIL_SERVER_HOST: ${{ secrets.CI_EMAIL_SERVER_HOST }} + # EMAIL_SERVER_PORT: ${{ secrets.CI_EMAIL_SERVER_PORT }} + # EMAIL_SERVER_USER: ${{ secrets.CI_EMAIL_SERVER_USER }} + # EMAIL_SERVER_PASSWORD: ${{ secrets.CI_EMAIL_SERVER_PASSWORD }} + # MS_GRAPH_CLIENT_ID: xxx + # MS_GRAPH_CLIENT_SECRET: xxx + # ZOOM_CLIENT_ID: xxx + # ZOOM_CLIENT_SECRET: xxx + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ secrets.TURBO_TEAM }} +jobs: + e2e-test: + services: + postgres: + image: postgres:12.1 + env: + POSTGRES_USER: postgres + POSTGRES_DB: calendso + ports: + - 5432:5432 + name: E2E tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ env.node_version }} + - name: Restore node_modules from cache + uses: actions/cache@v3 + env: + cache-name: node-modules-yarn + cache-fingerprint: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }} + with: + path: node_modules + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} + - run: yarn playwright install + - name: Cache production build + id: prod-build-cache + uses: actions/cache@v3 + env: + cache-name: prod-build + key-1: ${{ secrets.NODE_VERSION }}-${{ hashFiles('yarn.lock') }} + key-2: ${{ hashFiles('apps/web/next.config.js') }} + with: + path: | + apps/web/.next + 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 }}- + - name: Run tests + run: yarn e2e diff --git a/.github/workflows/yarn-install.yml b/.github/workflows/yarn-install.yml index f01ca72297..5d42bdaf22 100644 --- a/.github/workflows/yarn-install.yml +++ b/.github/workflows/yarn-install.yml @@ -7,28 +7,23 @@ on: required: true jobs: - setup: - name: Yarn install & cache + e2e-test: + name: E2E tests runs-on: ubuntu-latest - concurrency: - group: yarn-install-${{ github.sha }} timeout-minutes: 10 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: ${{ secrets.NODE_VERSION }} - # node_module cache helps to avoid 1 minute copying from yarn cache on every job run - - name: node_modules cache - id: node-modules-cache + node-version: ${{ env.node_version }} + - name: Restore node_modules from cache uses: actions/cache@v3 env: cache-name: node-modules-yarn - cache-key: ${{ secrets.NODE_VERSION }}-${{ hashFiles('yarn.lock') }} + cache-fingerprint: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }} with: path: node_modules - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }} - restore-keys: ${{ runner.os }}-${{ env.cache-name }}- - - name: Yarn install - if: steps.node-modules-cache.outputs.cache-hit != 'true' - run: yarn install --prefer-offline --frozen-lockfile + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} + - run: yarn playwright install + - name: Run tests + run: yarn e2e