chore: separation of client build steps (#24506)
## Description Separation to different steps of running lint, prettier, and jest unit tests #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [x] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag Co-authored-by: Valera Melnikov <melnikov.vv@greendatasoft.ru>
This commit is contained in:
parent
afc42efb78
commit
f25eb88754
20
.github/workflows/client-build.yml
vendored
20
.github/workflows/client-build.yml
vendored
|
|
@ -1,4 +1,4 @@
|
|||
name: Appsmith Client Build Workflow
|
||||
name: Client Build
|
||||
|
||||
on:
|
||||
# This line enables manual triggering of this workflow.
|
||||
|
|
@ -111,15 +111,8 @@ jobs:
|
|||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Run Eslint
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn run lint:ci
|
||||
|
||||
- name: Run Prettier
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn run prettier:ci
|
||||
|
||||
- name: Run type import check
|
||||
# Type checking before starting the build
|
||||
- name: Run type check
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn run check-types
|
||||
|
||||
|
|
@ -142,11 +135,6 @@ jobs:
|
|||
echo "next_version = $next_version"
|
||||
echo version=$next_version-SNAPSHOT >> $GITHUB_OUTPUT
|
||||
|
||||
# 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.skip-tests != 'true'
|
||||
run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} yarn run test:unit:ci
|
||||
|
||||
# We burn React environment & the Segment analytics key into the build itself.
|
||||
# This is to ensure that we don't need to configure it in each installation
|
||||
- name: Create the bundle
|
||||
|
|
@ -163,7 +151,7 @@ jobs:
|
|||
REACT_APP_VERSION_RELEASE_DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ') \
|
||||
REACT_APP_VERSION_EDITION="Community" \
|
||||
yarn build
|
||||
|
||||
|
||||
# Saving the cache to use it in subsequent runs
|
||||
- name: Save Yarn cache
|
||||
uses: actions/cache/save@v3
|
||||
|
|
|
|||
120
.github/workflows/client-lint.yml
vendored
Normal file
120
.github/workflows/client-lint.yml
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
name: Client Lint
|
||||
|
||||
on:
|
||||
# This line enables manual triggering of this workflow.
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
pr:
|
||||
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]
|
||||
paths:
|
||||
- "app/client/**"
|
||||
- "!app/client/cypress/manual_TestSuite/**"
|
||||
|
||||
# Change the working directory for all the jobs in this workflow
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app/client
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
# Only run this workflow for internally triggered events
|
||||
if: |
|
||||
github.event.pull_request.head.repo.full_name == github.repository ||
|
||||
github.event_name == 'push' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'repository_dispatch'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app/client
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
# The checkout steps MUST happen first because the default directory is set according to the code base.
|
||||
# GitHub Action expects all future commands to be executed in the code directory. Hence, we need to check out
|
||||
# the code before doing anything else.
|
||||
|
||||
# Check out merge commit with the base branch in case this workflow is invoked via pull request
|
||||
- name: Checkout the merged commit from PR and base branch
|
||||
if: inputs.pr != 0
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: refs/pull/${{ inputs.pr }}/merge
|
||||
|
||||
# Checkout the code in the current branch in case the workflow is called because of a branch push event
|
||||
- name: Checkout the head commit of the branch
|
||||
if: inputs.pr == 0
|
||||
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# In case this is second attempt try restoring status of the prior attempt from cache
|
||||
- name: Restore the previous run result
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/run_result
|
||||
key: ${{ github.run_id }}-${{ github.job }}-client
|
||||
|
||||
# Fetch prior run result
|
||||
- name: Get the previous run result
|
||||
id: run_result
|
||||
run: cat ~/run_result 2>/dev/null || echo 'default'
|
||||
|
||||
# In case of prior failure run the job
|
||||
- if: steps.run_result.outputs.run_result != 'success'
|
||||
run: echo "I'm alive!" && exit 0
|
||||
|
||||
- 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"
|
||||
|
||||
# actions/setup-node@v3 doesn’t work properly with Yarn 3
|
||||
# when the project lives in a subdirectory: https://github.com/actions/setup-node/issues/488
|
||||
# Restoring the cache manually instead
|
||||
- name: Restore Yarn cache
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: app/client/.yarn/cache
|
||||
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
|
||||
restore-keys: |
|
||||
v1-yarn3-
|
||||
|
||||
# Install all the dependencies
|
||||
- name: Install dependencies
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn install --immutable
|
||||
|
||||
# Run the Lint for client and packages
|
||||
- name: Run lint
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn run lint:ci
|
||||
|
||||
# Saving the cache to use it in subsequent runs
|
||||
- name: Save Yarn cache
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: app/client/.yarn/cache
|
||||
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
|
||||
restore-keys: |
|
||||
v1-yarn3-
|
||||
|
||||
# Set status = success
|
||||
- name: Save the status of the run
|
||||
run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result
|
||||
120
.github/workflows/client-prettier.yml
vendored
Normal file
120
.github/workflows/client-prettier.yml
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
name: Client Prettier
|
||||
|
||||
on:
|
||||
# This line enables manual triggering of this workflow.
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
pr:
|
||||
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]
|
||||
paths:
|
||||
- "app/client/**"
|
||||
- "!app/client/cypress/manual_TestSuite/**"
|
||||
|
||||
# Change the working directory for all the jobs in this workflow
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app/client
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
# Only run this workflow for internally triggered events
|
||||
if: |
|
||||
github.event.pull_request.head.repo.full_name == github.repository ||
|
||||
github.event_name == 'push' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'repository_dispatch'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app/client
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
# The checkout steps MUST happen first because the default directory is set according to the code base.
|
||||
# GitHub Action expects all future commands to be executed in the code directory. Hence, we need to check out
|
||||
# the code before doing anything else.
|
||||
|
||||
# Check out merge commit with the base branch in case this workflow is invoked via pull request
|
||||
- name: Checkout the merged commit from PR and base branch
|
||||
if: inputs.pr != 0
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: refs/pull/${{ inputs.pr }}/merge
|
||||
|
||||
# Checkout the code in the current branch in case the workflow is called because of a branch push event
|
||||
- name: Checkout the head commit of the branch
|
||||
if: inputs.pr == 0
|
||||
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# In case this is second attempt try restoring status of the prior attempt from cache
|
||||
- name: Restore the previous run result
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/run_result
|
||||
key: ${{ github.run_id }}-${{ github.job }}-client
|
||||
|
||||
# Fetch prior run result
|
||||
- name: Get the previous run result
|
||||
id: run_result
|
||||
run: cat ~/run_result 2>/dev/null || echo 'default'
|
||||
|
||||
# In case of prior failure run the job
|
||||
- if: steps.run_result.outputs.run_result != 'success'
|
||||
run: echo "I'm alive!" && exit 0
|
||||
|
||||
- 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"
|
||||
|
||||
# actions/setup-node@v3 doesn’t work properly with Yarn 3
|
||||
# when the project lives in a subdirectory: https://github.com/actions/setup-node/issues/488
|
||||
# Restoring the cache manually instead
|
||||
- name: Restore Yarn cache
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: app/client/.yarn/cache
|
||||
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
|
||||
restore-keys: |
|
||||
v1-yarn3-
|
||||
|
||||
# Install all the dependencies
|
||||
- name: Install dependencies
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn install --immutable
|
||||
|
||||
# Run the Prettier for client and packages
|
||||
- name: Run Prettier
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn run prettier:ci
|
||||
|
||||
# Saving the cache to use it in subsequent runs
|
||||
- name: Save Yarn cache
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: app/client/.yarn/cache
|
||||
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
|
||||
restore-keys: |
|
||||
v1-yarn3-
|
||||
|
||||
# Set status = success
|
||||
- name: Save the status of the run
|
||||
run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result
|
||||
120
.github/workflows/client-unit-tests.yml
vendored
Normal file
120
.github/workflows/client-unit-tests.yml
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
name: Client Unit Tests
|
||||
|
||||
on:
|
||||
# This line enables manual triggering of this workflow.
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
pr:
|
||||
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]
|
||||
paths:
|
||||
- "app/client/**"
|
||||
- "!app/client/cypress/manual_TestSuite/**"
|
||||
|
||||
# Change the working directory for all the jobs in this workflow
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app/client
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
# Only run this workflow for internally triggered events
|
||||
if: |
|
||||
github.event.pull_request.head.repo.full_name == github.repository ||
|
||||
github.event_name == 'push' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'repository_dispatch'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app/client
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
# The checkout steps MUST happen first because the default directory is set according to the code base.
|
||||
# GitHub Action expects all future commands to be executed in the code directory. Hence, we need to check out
|
||||
# the code before doing anything else.
|
||||
|
||||
# Check out merge commit with the base branch in case this workflow is invoked via pull request
|
||||
- name: Checkout the merged commit from PR and base branch
|
||||
if: inputs.pr != 0
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: refs/pull/${{ inputs.pr }}/merge
|
||||
|
||||
# Checkout the code in the current branch in case the workflow is called because of a branch push event
|
||||
- name: Checkout the head commit of the branch
|
||||
if: inputs.pr == 0
|
||||
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# In case this is second attempt try restoring status of the prior attempt from cache
|
||||
- name: Restore the previous run result
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/run_result
|
||||
key: ${{ github.run_id }}-${{ github.job }}-client
|
||||
|
||||
# Fetch prior run result
|
||||
- name: Get the previous run result
|
||||
id: run_result
|
||||
run: cat ~/run_result 2>/dev/null || echo 'default'
|
||||
|
||||
# In case of prior failure run the job
|
||||
- if: steps.run_result.outputs.run_result != 'success'
|
||||
run: echo "I'm alive!" && exit 0
|
||||
|
||||
- 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"
|
||||
|
||||
# actions/setup-node@v3 doesn’t work properly with Yarn 3
|
||||
# when the project lives in a subdirectory: https://github.com/actions/setup-node/issues/488
|
||||
# Restoring the cache manually instead
|
||||
- name: Restore Yarn cache
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: app/client/.yarn/cache
|
||||
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
|
||||
restore-keys: |
|
||||
v1-yarn3-
|
||||
|
||||
# Install all the dependencies
|
||||
- name: Install dependencies
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn install --immutable
|
||||
|
||||
# Run the Unit tests for client and packages
|
||||
- name: Run the jest tests
|
||||
if: steps.run_result.outputs.run_result != 'success'
|
||||
run: yarn run test:unit:ci
|
||||
|
||||
# Saving the cache to use it in subsequent runs
|
||||
- name: Save Yarn cache
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: app/client/.yarn/cache
|
||||
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
|
||||
restore-keys: |
|
||||
v1-yarn3-
|
||||
|
||||
# Set status = success
|
||||
- name: Save the status of the run
|
||||
run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result
|
||||
|
|
@ -18,8 +18,6 @@ fi
|
|||
# build cra app
|
||||
export REACT_APP_SENTRY_RELEASE=$GIT_SHA
|
||||
export REACT_APP_CLIENT_LOG_LEVEL=ERROR
|
||||
# Disable ESLint – we have a separate CI step to run it
|
||||
export DISABLE_ESLINT_PLUGIN=true
|
||||
craco --max-old-space-size=7168 build --config craco.build.config.js
|
||||
|
||||
if [ "$GITHUB_REPOSITORY" == "appsmithorg/appsmith-ee" ]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user