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
6
.github/workflows/client-build.yml
vendored
6
.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"
|
description: "This is the PR number in case the workflow is being called in a pull request"
|
||||||
required: false
|
required: false
|
||||||
type: number
|
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:
|
pull_request:
|
||||||
branches: [release, master]
|
branches: [release, master]
|
||||||
|
|
@ -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
|
# 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
|
- 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
|
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.
|
# We burn React environment & the Segment analytics key into the build itself.
|
||||||
|
|
|
||||||
|
|
@ -17,35 +17,74 @@ jobs:
|
||||||
body: |
|
body: |
|
||||||
Deploying Your Preview: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
|
Deploying Your Preview: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
|
||||||
Workflow: `${{ github.workflow }}`.
|
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 }}.
|
PR: ${{ github.event.client_payload.pull_request.number }}.
|
||||||
|
|
||||||
server-build:
|
server-build:
|
||||||
|
if: github.event.client_payload.slash_command.args.named.env != 'release'
|
||||||
name: server-build
|
name: server-build
|
||||||
uses: ./.github/workflows/server-build.yml
|
uses: ./.github/workflows/server-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
pr: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
skip-tests: ${{ github.event.client_payload.slash_command.args.named.skip-tests }}
|
||||||
|
|
||||||
client-build:
|
client-build:
|
||||||
name: client-build
|
name: client-build
|
||||||
|
if: github.event.client_payload.slash_command.args.named.env != 'release'
|
||||||
uses: ./.github/workflows/client-build.yml
|
uses: ./.github/workflows/client-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
pr: ${{ github.event.client_payload.pull_request.number }}
|
||||||
|
skip-tests: ${{ github.event.client_payload.slash_command.args.named.skip-tests }}
|
||||||
|
|
||||||
rts-build:
|
rts-build:
|
||||||
name: rts-build
|
name: rts-build
|
||||||
|
if: github.event.client_payload.slash_command.args.named.env != 'release'
|
||||||
uses: ./.github/workflows/rts-build.yml
|
uses: ./.github/workflows/rts-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
pr: ${{ github.event.client_payload.pull_request.number }}
|
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:
|
push-image:
|
||||||
needs: [client-build, rts-build, server-build]
|
needs: [client-build, rts-build, server-build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: success() && github.event.client_payload.slash_command.args.named.env != 'release'
|
||||||
if: success()
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Set up Depot CLI
|
- name: Set up Depot CLI
|
||||||
|
|
@ -106,7 +145,7 @@ jobs:
|
||||||
run:
|
run:
|
||||||
working-directory: "."
|
working-directory: "."
|
||||||
|
|
||||||
if: success()
|
if: success() && github.event.client_payload.slash_command.args.named.env != 'release'
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout PR
|
- 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"
|
description: "This is the PR number in case the workflow is being called in a pull request"
|
||||||
required: false
|
required: false
|
||||||
type: number
|
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:
|
pull_request:
|
||||||
branches: [release, master]
|
branches: [release, master]
|
||||||
|
|
@ -134,11 +140,15 @@ jobs:
|
||||||
APPSMITH_IS_SELF_HOSTED: false
|
APPSMITH_IS_SELF_HOSTED: false
|
||||||
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
|
||||||
run: |
|
run: |
|
||||||
|
if [[ "${{ inputs.skip-tests }}" == "true" ]]
|
||||||
|
then
|
||||||
|
args=-DskipTests
|
||||||
|
fi
|
||||||
mvn --batch-mode versions:set \
|
mvn --batch-mode versions:set \
|
||||||
-DnewVersion=${{ steps.vars.outputs.version }} \
|
-DnewVersion=${{ steps.vars.outputs.version }} \
|
||||||
-DgenerateBackupPoms=false \
|
-DgenerateBackupPoms=false \
|
||||||
-DprocessAllModules=true
|
-DprocessAllModules=true
|
||||||
./build.sh
|
./build.sh $args
|
||||||
|
|
||||||
# Restore the previous built bundle if present. If not push the newly built into the cache
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
||||||
- name: Restore the previous bundle
|
- name: Restore the previous bundle
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user