From b520e43fb6ea3ccb787f7ff10b77dd2e2d412059 Mon Sep 17 00:00:00 2001 From: emidhun Date: Mon, 21 Apr 2025 14:12:11 +0530 Subject: [PATCH] Revert "test commit-2" This reverts commit ce19672625044b2071f4060ba391867c7e074a26. --- .github/workflows/cypress-appbuilder.yml | 88 ++++++++++++++++-------- 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/.github/workflows/cypress-appbuilder.yml b/.github/workflows/cypress-appbuilder.yml index 7ce862bb0e..28b68e1b97 100644 --- a/.github/workflows/cypress-appbuilder.yml +++ b/.github/workflows/cypress-appbuilder.yml @@ -8,7 +8,6 @@ on: env: PR_NUMBER: ${{ github.event.number }} BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - TOOLJET_HOST: http://localhost:8082 jobs: Cypress-App-Builder: @@ -33,34 +32,42 @@ jobs: }} steps: - # Step 1: Set up Git authentication for private submodules - - name: Set up Git Authentication for Private Submodules + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 18.18.2 + + - name: Set up Git authentication for private submodules run: | git config --global url."https://x-access-token:${{ secrets.CUSTOM_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" - # Step 2: Checkout the repository with submodules - - name: Checkout Repository with Submodules + - name: Checkout with Submodules uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.ref }} - submodules: recursive - # Step 3: Ensure correct branch for submodules (EE edition only) - - name: Checkout Correct Branch for Submodules (EE Edition) + - name: Checking out the correct branch for submodules EE if: matrix.edition == 'ee' run: | git submodule update --init --recursive git submodule foreach --recursive ' git checkout ${{ env.BRANCH_NAME }} 2>/dev/null || git checkout main' - # Step 4: Set up Node.js - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 18.18.2 - # Step 5: Install dependencies and build - - name: Install and Build Dependencies + - name: Set up Docker + uses: docker-practice/actions-setup-docker@master + + - name: Run PosgtreSQL Database Docker Container + run: | + sudo docker network create tooljet + sudo docker run -d --name postgres --network tooljet -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_PORT=5432 -d postgres:13 + + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Install and build dependencies run: | npm cache clean --force npm install @@ -68,10 +75,10 @@ jobs: npm install --prefix frontend npm run build:plugins - # Step 6: Set up environment variables - - name: Set up Environment Variables + - name: Set up environment variables run: | - echo "TOOLJET_HOST=${{ env.TOOLJET_HOST }}" >> .env + echo "TOOLJET_EDITION=${{ matrix.edition == 'ee' && 'EE' || 'CE' }}" >> .env + echo "TOOLJET_HOST=http://localhost:8082" >> .env echo "LOCKBOX_MASTER_KEY=cd97331a419c09387bef49787f7da8d2a81d30733f0de6bed23ad8356d2068b2" >> .env echo "SECRET_KEY_BASE=7073b9a35a15dd20914ae17e36a693093f25b74b96517a5fec461fc901c51e011cd142c731bee48c5081ec8bac321c1f259ef097ef2a16f25df17a3798c03426" >> .env echo "PG_DB=tooljet_development" >> .env @@ -80,24 +87,49 @@ jobs: echo "PG_PASS=postgres" >> .env echo "PG_PORT=5432" >> .env echo "ENABLE_TOOLJET_DB=true" >> .env + echo "TOOLJET_DB=tooljet" >> .env + echo "TOOLJET_DB_USER=postgres" >> .env + echo "TOOLJET_DB_HOST=localhost" >> .env + echo "TOOLJET_DB_PASS=postgres" >> .env echo "PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj" >> .env + echo "PGRST_HOST=localhost:3001" >> .env + echo "TOOLJET_DB_STATEMENT_TIMEOUT=60000" >> .env + echo "TOOLJET_DB_RECONFIG=true" >> .env - # Step 7: Set up database - - name: Set up Database + - name: Set up database run: | npm run --prefix server db:create npm run --prefix server db:reset - # Step 8: Wait for the server to be ready - - name: Wait for Server + - name: sleep 5 + run: sleep 5 + + - name: Run PostgREST Docker Container + run: | + sudo docker run -d --name postgrest --network tooljet -p 3001:3000 \ + -e PGRST_DB_URI="postgres://postgres:postgres@postgres:5432/tooljet" -e PGRST_DB_ANON_ROLE="postgres" -e PGRST_JWT_SECRET="r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj" -e PGRST_DB_PRE_CONFIG=postgrest.pre_config \ + postgrest/postgrest:v12.2.0 + + - name: Run plugins compilation in watch mode + run: cd plugins && npm start & + + - name: Run the server + run: cd server && npm run start:dev & + + - name: Run the client + run: cd frontend && npm start & + + - name: Wait for the server to be ready run: | timeout 1500 bash -c ' - until curl --silent --fail ${{ env.TOOLJET_HOST }}; do + until curl --silent --fail http://localhost:8082; do sleep 5 done' - # Step 9: Create Cypress environment file - - name: Create Cypress Environment File + - name: docker logs + run: sudo docker logs postgrest + + - name: Create Cypress environment file id: create-json uses: jsdaniell/create-json@1.1.2 with: @@ -105,15 +137,13 @@ jobs: json: ${{ secrets.CYPRESS_SECRETS }} dir: "./cypress-tests" - # Step 10: Run Cypress Tests - - name: Run Cypress Tests + - name: App builder uses: cypress-io/github-action@v6 with: working-directory: ./cypress-tests - config: "baseUrl=${{ env.TOOLJET_HOST }}" + config: "baseUrl=http://localhost:8082" config-file: cypress-app-builder.config.js - # Step 11: Capture Screenshots - name: Capture Screenshots uses: actions/upload-artifact@v4 if: always()