diff --git a/.github/workflows/client-build.yml b/.github/workflows/client-build.yml index de3aacd582..ea01f2c9ad 100644 --- a/.github/workflows/client-build.yml +++ b/.github/workflows/client-build.yml @@ -9,6 +9,10 @@ on: description: "This is the PR number in case the workflow is being called in a pull request" required: false type: number + skip-tests: + description: "This is a boolean value in case the workflow is being called in build deploy-preview" + required: false + type: string pull_request: branches: [release, master] @@ -63,7 +67,7 @@ jobs: run: | PGPASSWORD='${{secrets.APPSMITH_PERFORMANCE_DB_PASSWORD}}' psql -h '${{secrets.APPSMITH_PERFORMANCE_DB_HOST}}' \ -U aforce_admin -d perf-infra -c \ - "INSERT INTO public.run_meta (repo, gh_run_id, gh_run_attempt, is_active) + "INSERT INTO public.run_meta (repo, gh_run_id, gh_run_attempt, is_active) VALUES ('${{github.repository}}', '${{github.run_id}}', '${{github.run_attempt}}', FALSE)" # In case this is second attempt try restoring status of the prior attempt from cache @@ -117,7 +121,7 @@ jobs: # Run the Jest tests only if the workflow has been invoked in a PR and the previous re-run has failed - name: Run the jest tests - if: steps.run_result.outputs.run_result != 'success' && inputs.pr != 0 + if: steps.run_result.outputs.run_result != 'success' && inputs.pr != 0 && inputs.skip-tests != 'true' run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} yarn run test:unit # We burn React environment & the Segment analytics key into the build itself. diff --git a/.github/workflows/on-demand-build-docker-image-deploy-preview.yml b/.github/workflows/on-demand-build-docker-image-deploy-preview.yml index 2cc745b430..b3f3fe5671 100644 --- a/.github/workflows/on-demand-build-docker-image-deploy-preview.yml +++ b/.github/workflows/on-demand-build-docker-image-deploy-preview.yml @@ -17,35 +17,74 @@ jobs: body: | Deploying Your Preview: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>. Workflow: `${{ github.workflow }}`. + skip-tests: `${{ github.event.client_payload.slash_command.args.named.skip-tests }}`. + env: `${{ github.event.client_payload.slash_command.args.named.env }}`. PR: ${{ github.event.client_payload.pull_request.number }}. server-build: + if: github.event.client_payload.slash_command.args.named.env != 'release' name: server-build uses: ./.github/workflows/server-build.yml secrets: inherit with: pr: ${{ github.event.client_payload.pull_request.number }} + skip-tests: ${{ github.event.client_payload.slash_command.args.named.skip-tests }} client-build: name: client-build + if: github.event.client_payload.slash_command.args.named.env != 'release' uses: ./.github/workflows/client-build.yml secrets: inherit with: pr: ${{ github.event.client_payload.pull_request.number }} + skip-tests: ${{ github.event.client_payload.slash_command.args.named.skip-tests }} rts-build: name: rts-build + if: github.event.client_payload.slash_command.args.named.env != 'release' uses: ./.github/workflows/rts-build.yml secrets: inherit with: pr: ${{ github.event.client_payload.pull_request.number }} + vercel-build: + if: github.event.client_payload.slash_command.args.named.env == 'release' + name: vercel-local-build + runs-on: ubuntu-latest + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + + steps: + - name: Checkout PR + uses: actions/checkout@v3 + with: + ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge" + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Use Node.js 16.14.0 + if: steps.run_result.outputs.run_result != 'success' + uses: actions/setup-node@v3 + with: + node-version: "16.14.0" + cache: "yarn" + cache-dependency-path: "app/client/yarn.lock" + + - name: Pull Vercel Environment Information + run: vercel pull --yes --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Project Artifacts + run: vercel build --yes --token=${{ secrets.VERCEL_TOKEN }} + + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} + push-image: needs: [client-build, rts-build, server-build] runs-on: ubuntu-latest - - if: success() - + if: success() && github.event.client_payload.slash_command.args.named.env != 'release' steps: - name: Set up Depot CLI @@ -106,7 +145,7 @@ jobs: run: working-directory: "." - if: success() + if: success() && github.event.client_payload.slash_command.args.named.env != 'release' steps: - name: Checkout PR diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 919926c58a..948f3c6fe5 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -10,6 +10,12 @@ on: description: "This is the PR number in case the workflow is being called in a pull request" required: false type: number + skip-tests: + description: "This is a boolean value in case the workflow is being called in build deploy-preview" + required: false + type: string + default: "false" + pull_request: branches: [release, master] @@ -134,11 +140,15 @@ jobs: APPSMITH_IS_SELF_HOSTED: false APPSMITH_ENVFILE_PATH: /tmp/dummy.env run: | + if [[ "${{ inputs.skip-tests }}" == "true" ]] + then + args=-DskipTests + fi mvn --batch-mode versions:set \ -DnewVersion=${{ steps.vars.outputs.version }} \ -DgenerateBackupPoms=false \ -DprocessAllModules=true - ./build.sh + ./build.sh $args # Restore the previous built bundle if present. If not push the newly built into the cache - name: Restore the previous bundle