ci: build lite version of deploy preview (#21078)
**Case-1:** **`/build-deploy-preview skip-tests=true`** **Client-jest skipped**  **Server Build taking less time**  **Case-2:** **`/build-deploy-preview `**  **Case-3** **`/build-deploy-preview env=release`**  **github-action**  **final-dp:** 
This commit is contained in:
parent
4a99ff50fd
commit
891df1dc33
8
.github/workflows/client-build.yml
vendored
8
.github/workflows/client-build.yml
vendored
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
12
.github/workflows/server-build.yml
vendored
12
.github/workflows/server-build.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user