ci: build lite version of deploy preview (#21078)

**Case-1:**

**`/build-deploy-preview skip-tests=true`**

**Client-jest skipped**
![Screenshot 2023-03-01 at 3 40 04
PM](https://user-images.githubusercontent.com/15846947/222109174-74749203-eafa-4694-ac5f-f5713942d07b.png)
**Server Build taking less time**
![Screenshot 2023-03-01 at 3 40 46
PM](https://user-images.githubusercontent.com/15846947/222109336-6771357f-6acf-4e5f-a428-ae73d057bf44.png)

**Case-2:**

**`/build-deploy-preview `**
![Screenshot 2023-03-02 at 11 54 37
AM](https://user-images.githubusercontent.com/15846947/222649676-f78f9f58-d918-4c74-961a-a5405481ab4c.png)


**Case-3**

**`/build-deploy-preview  env=release`**

![Screenshot 2023-03-07 at 8 05 38
PM](https://user-images.githubusercontent.com/15846947/223453763-35a0f5b5-b941-4349-80bc-a024deed5a08.png)

**github-action**
![Screenshot 2023-03-07 at 8 05 58
PM](https://user-images.githubusercontent.com/15846947/223453797-fad9b60e-f363-44b2-a7a0-2a954f1a4dac.png)

**final-dp:**

![Screenshot 2023-03-07 at 8 06 46
PM](https://user-images.githubusercontent.com/15846947/223454037-5725d6e5-18ff-4e9f-bd8d-3b181887ec75.png)
This commit is contained in:
Goutham Pratapa 2023-03-08 15:07:30 +05:30 committed by GitHub
parent 4a99ff50fd
commit 891df1dc33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 7 deletions

View File

@ -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.

View File

@ -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

View File

@ -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