feat: Added custom hex colors for testing workflow (#27568)

## Description

Added workflow to check if there is any custom colors or hex codes is
being used. This workflow will be checking for the anomalies in the
entire file that has been changed by the developer.

#### PR fixes following issue(s)
Fixes https://github.com/appsmithorg/appsmith/issues/27839

#### Type of change
- New feature (non-breaking change which adds functionality)

## 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
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

---------

Co-authored-by: Saroj <saroj@appsmith.com>
This commit is contained in:
albinAppsmith 2023-10-10 17:16:17 +05:30 committed by GitHub
parent 7a3792ed97
commit 65178eaf7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,11 @@ on:
description: "This is the branch to be used for the build."
required: false
type: string
ads-compliant-check:
description: "This is a boolean value in case the workflow is being called in build deploy-preview"
required: false
type: string
default: "true"
# Change the working directory for all the jobs in this workflow
@ -93,7 +98,7 @@ jobs:
done
echo "non_ts_files=${non_ts_files[@]}" >> $GITHUB_OUTPUT
echo "non_ts_files_count=${#non_ts_files[@]}" >> $GITHUB_OUTPUT
# Comment in PR if test files are not written in ts and fail the workflow
- name: Comment in PR if test files are not written in ts
if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0
@ -106,6 +111,46 @@ jobs:
<ol>${{ steps.check_files.outputs.non_ts_files }}</ol>
- if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0
run: exit 1
- name: Get all the added or changed files in client/src folder
if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release'
id: client_files
uses: umani/changed-files@v4.0.0
with:
repo-token: ${{ secrets.APPSMITH_CI_TEST_PAT }}
pattern: 'app/client/src/.*'
pr-number: ${{ inputs.pr }}
# Check all the newly added files are in ts
- name: ADS compliant check
if: inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release'
id: ads_check
run: |
comment_files=""
files=(${{steps.client_files.outputs.files_created}}${{steps.client_files.outputs.files_updated}})
for file in "${files[@]}"; do
while IFS= read -r line; do
if echo "$line" | grep -q -E '(color|Color).*#|border.*#|(color|Color).*"'; then
comment_files+=("$file")
break
fi
done < ${file#app/client/}
done
unique_files=$(echo "${comment_files[@]}" | sort -u | sed '/^[[:space:]]*$/d' | sed 's/ / <li>/g')
echo "ads_non_compliant_files=$unique_files" >> $GITHUB_OUTPUT
echo "ads_non_compliant_count=${#unique_files[@]}" >> $GITHUB_OUTPUT
# Comment in PR if test files are not written in ts and fail the workflow
- name: Comment in PR if test files are not written in ts
if: steps.ads_check.outputs.ads_non_compliant_count != 0 && inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ inputs.pr }}
body: |
<b> 🔴 Below files are not compliant with ADS. Please fix and re-trigger ok-to-test </b>
<ol>${{steps.ads_check.outputs.ads_non_compliant_files}}</ol>
- if: steps.ads_check.outputs.ads_non_compliant_count != 0 && inputs.ads-compliant-check == 'true' && inputs.pr != 0 && github.pull_request.base.ref == 'release'
run: exit 1
# Create a run record exactly at the time of merge to release to
# ensure we compare run details with code at this point