Skip to content

Commit

Permalink
Merge branch 'release' into feat/eslint-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushpahwa committed Nov 6, 2024
2 parents 676353b + 0288f5b commit fafd81e
Show file tree
Hide file tree
Showing 1,215 changed files with 26,406 additions and 18,587 deletions.
5 changes: 3 additions & 2 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
tone_instructions: 'You must talk like teacher.'
tone_instructions: 'You are an expert code reviewer in Java, TypeScript, JavaScript, and NodeJS. You work in an enterprise software developer team, providing concise and clear code review advice.You only elaborate or provide detailed explanations when requested.'
reviews:
profile: "chill"
request_changes_workflow: false
Expand All @@ -12,6 +12,7 @@ reviews:
auto_review:
enabled: true
drafts: false
base_branches: ["pg", "release"]
path_instructions:
- path: "app/client/cypress/**/**.*"
instructions: |
Expand All @@ -34,4 +35,4 @@ reviews:
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
chat:
auto_reply: true
auto_reply: true
15 changes: 15 additions & 0 deletions .github/workflows/ad-hoc-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
required: false
type: string
default: ad-hoc
pg_tag:
description: Postgres tag to use for image
required: false
type: string
default: pg

jobs:
server-build:
Expand Down Expand Up @@ -90,6 +95,16 @@ jobs:
scripts/generate_info_json.sh
fi
- name: Place server artifacts-es
run: |
run: |
if [[ -f scripts/prepare_server_artifacts.sh ]]; then
PG_TAG=${{ inputs.pg_tag }} scripts/prepare_server_artifacts.sh
else
echo "No script found to prepare server artifacts"
exit 1
fi
- name: Set up Depot CLI
uses: depot/setup-action@v1

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-test-custom-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
working-directory: "."
run: |
sudo /etc/init.d/ssh stop ;
sudo systemctl disable --now ssh.socket
mkdir -p ~/git-server/keys
ted_tag="${{inputs.ted_tag}}"
docker run --name test-event-driver -d -p 22:22 -p 5001:5001 -p 3306:3306 \
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci-test-limited-with-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,18 @@ jobs:
- name: Set Commit Message
env:
EVENT_COMMITS: ${{ toJson(github.event.commits[0].message) }}
COMMIT_INFO_AUTHOR: ${{ github.event.commits[0].author.name }}
run: |
if [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'workflow_dispatch' ]]; then
if [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=$COMMIT_INFO_MESSAGE" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=Workflow run on PR# ${{ inputs.pr }}" >> $GITHUB_ENV
else
if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by ${{ env.COMMIT_INFO_AUTHOR }}" >> $GITHUB_ENV
if [[ "$EVENT_COMMITS" == "null" ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by $COMMIT_INFO_AUTHOR" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV
COMMIT_FIRST_LINE=$(echo "$EVENT_COMMITS" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')
echo "COMMIT_INFO_MESSAGE=$COMMIT_FIRST_LINE" >> $GITHUB_ENV
fi
fi
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,18 @@ jobs:
- name: Set Commit Message
env:
EVENT_COMMITS: ${{ toJson(github.event.commits[0].message) }}
COMMIT_INFO_AUTHOR: ${{ github.event.commits[0].author.name }}
run: |
if [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'workflow_dispatch' ]]; then
if [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=$COMMIT_INFO_MESSAGE" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=Workflow run on PR# ${{ inputs.pr }}" >> $GITHUB_ENV
else
if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by ${{ env.COMMIT_INFO_AUTHOR }}" >> $GITHUB_ENV
if [[ "$EVENT_COMMITS" == "null" ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by $COMMIT_INFO_AUTHOR" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV
COMMIT_FIRST_LINE=$(echo "$EVENT_COMMITS" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')
echo "COMMIT_INFO_MESSAGE=$COMMIT_FIRST_LINE" >> $GITHUB_ENV
fi
fi
Expand Down
146 changes: 116 additions & 30 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ on:
type: string
default: "false"

workflow_dispatch:
inputs:
pr:
description: "PR number for the workflow"
required: false
type: number
skip-tests:
description: "Skip tests flag"
required: false
type: string
default: "false"
branch:
description: "Branch for the build"
required: false
type: string
is-pg-build:
description: "Flag for PG build"
required: false
type: string
default: "false"

# Change the working directory for all the jobs in this workflow
defaults:
run:
Expand Down Expand Up @@ -178,39 +199,104 @@ jobs:
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
APPSMITH_VERBOSE_LOGGING_ENABLED: false
run: |
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi
args=()
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
fi
if ! mvn test "${args[@]}"; then
echo "Generating failed test list:"
failed_tests_file="$PWD/failed-server-tests.txt"
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi
args=()
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
fi
# Run tests and capture logs
mvn test "${args[@]}" | tee mvn_test.log
# Check for "BUILD FAILURE" in the mvn_test.log
if grep -q "BUILD FAILURE" mvn_test.log; then
test_result="failed"
else
test_result="passed"
fi
echo "test_result variable value: ${test_result}"
# Prepare output file for failed tests and ensure a fresh file is created
OUTPUT_FILE="failed-server-tests.txt"
rm -f "$OUTPUT_FILE"
touch "$OUTPUT_FILE"
failed_modules=()
skipped_modules=()
# Process mvn_test.log for FAILURE and SKIPPED statuses
while IFS= read -r line; do
if [[ $line == *"FAILURE"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
failed_modules+=("$module_name")
elif [[ $line == *"SKIPPED"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
skipped_modules+=("$module_name")
fi
done < mvn_test.log
echo "Failed Modules: ${failed_modules[*]}"
echo "Skipped Modules: ${skipped_modules[*]}"
# Handle older approach for reading failed tests from XML files
failed_tests_from_xml="$PWD/failed-tests-from-xml.txt"
gawk -F\" '/<testcase / {cur_test = $4 "#" $2} /<(failure|error) / {print cur_test}' $(find . -type f -name 'TEST-*.xml') \
| sort -u \
| tee "$failed_tests_file"
echo "Saved to $failed_tests_file"
if [[ -s $failed_tests_file ]]; then
content="$(
echo "## Failed server tests"
echo
sed 's/^/- /' "$failed_tests_file"
)"
echo "$content" >> "$GITHUB_STEP_SUMMARY"
# Add a comment to the PR with the list of failed tests.
curl --silent --show-error \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
> /dev/null
| tee "$failed_tests_from_xml"
# Filter out failed modules and add only relevant tests to the final failed list
for module in "${failed_modules[@]}"; do
grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml"
done
# Include all skipped module test files in the final list
for module in "${skipped_modules[@]}"; do
module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u)
for module_directory in $module_directories; do
test_classes=$(find "$module_directory" -type f -name "*Test.java" | sed 's|.*/src/test/java/||; s|\.java$||; s|/|.|g')
for class_name in $test_classes; do
if [[ ${#class_name} -le 240 ]] && ! grep -Fxq "$class_name#" "$OUTPUT_FILE"; then
echo "${class_name}#" >> "$OUTPUT_FILE"
fi
done
done
done
# Combine the XML file test cases and skipped module test files into the final output file
cat "$failed_tests_from_xml" >> "$OUTPUT_FILE"
# Print the final output
cat "$OUTPUT_FILE"
if [[ -s $OUTPUT_FILE ]]; then
content="$(
echo "## Failed server tests"
echo
sed 's/^/- /' "$OUTPUT_FILE"
)"
echo "$content" >> "$GITHUB_STEP_SUMMARY"
# Post a comment to the PR
curl --silent --show-error \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
> /dev/null
fi
exit 1
fi
# Fail the script if tests did not pass
if [[ "$test_result" == "failed" ]]; then
echo "Tests failed, exiting with status 1."
exit 1
fi
# Set status = failedtest
- name: Set fail if there are test failures
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/test-vulnerabilities-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Vulnerability Data Script with Parameters and Update PR

on:
workflow_dispatch:
inputs:
image_name:
description: 'Docker image name to scan'
required: true
default: 'appsmith/appsmith-ce:release'

jobs:
run-and-update-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Install pg
run: npm install pg

# Run Scout vulnerability data script
- name: Run Scout vulnerability data script
if: always()
env:
DB_HOST: ${{ secrets.CYPRESS_DB_HOST }}
DB_NAME: ${{ secrets.CYPRESS_DB_NAME }}
DB_USER: ${{ secrets.CYPRESS_DB_USER }}
DB_PWD: ${{ secrets.CYPRESS_DB_PWD }}
run: |
chmod +x scripts/scout_vulnerabilities_data.sh
./scripts/scout_vulnerabilities_data.sh \
"${{ inputs.image_name }}" \
"${{ github.event.pull_request.number }}" \
"${{ github.event.pull_request.html_url }}" \
"${{ github.run_id }}"
- name: Run Trivy vulnerability data script
if: always()
env:
DB_HOST: ${{ secrets.CYPRESS_DB_HOST }}
DB_NAME: ${{ secrets.CYPRESS_DB_NAME }}
DB_USER: ${{ secrets.CYPRESS_DB_USER }}
DB_PWD: ${{ secrets.CYPRESS_DB_PWD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
chmod +x scripts/trivy_vulnerabilities_data.sh
./scripts/trivy_vulnerabilities_data.sh \
"${{ inputs.image_name }}" \
"${{ github.event.pull_request.number }}" \
"${{ github.event.pull_request.html_url }}" \
"${{ github.run_id }}"
2 changes: 2 additions & 0 deletions app/client/.eslintrc.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
],
"plugins": [
"react",
"eslint-plugin-react-compiler",
"@typescript-eslint",
"prettier",
"sort-destructure-keys",
Expand Down Expand Up @@ -41,6 +42,7 @@
"project": "./tsconfig.json"
},
"rules": {
"react-compiler/react-compiler": "warn",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" },
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/e2e/GSheet/AllAccess_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ let appName = "gsheet-app";
let spreadSheetName = "test-sheet";
describe.skip(
"GSheet-Functional Tests With All Access",
{ tags: ["@tag.Datasource", "@tag.GSheet"] },
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
},
function () {
before("Setup app and spreadsheet", function () {
//Add a new app and an add new spreadsheet query
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ let appName = "gsheet-app";
let spreadSheetName = "test-sheet";
describe.skip(
"GSheet Miscellaneous Tests",
{ tags: ["@tag.Datasource", "@tag.GSheet"] },
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
},
function () {
const columnHeaders = [
"uniq_id",
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/e2e/GSheet/ReadNWrite_Access_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import {

describe.skip(
"GSheet-Functional Tests With Read/Write Access",
{ tags: ["@tag.Datasource", "@tag.GSheet"] },
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
},
function () {
const workspaceName = "gsheet apps";
const dataSourceName = {
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import {

describe.skip(
"GSheet-Functional Tests With Read Access",
{ tags: ["@tag.Datasource", "@tag.GSheet"] },
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
},
function () {
const workspaceName = "gsheet apps";
const dataSourceName = {
Expand Down
Loading

0 comments on commit fafd81e

Please sign in to comment.