From 9b65433e9ed8d780965a49cc7fdb38599d1f424e Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Tue, 24 Dec 2024 19:14:23 +0530 Subject: [PATCH 01/17] chore: Added capability of running ITs on maven --- .../git/templates/contexts/GitContext.java | 1 + .../git/GitServerInitializerExtension.java | 14 ++--- app/server/pom.xml | 62 +++++++++++++++++++ 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java b/app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java index e383a0eadb92..a3b6a31f1eaa 100644 --- a/app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java +++ b/app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java @@ -25,6 +25,7 @@ public GitContext( ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class)); contextStore.put(ArtifactExchangeJson.class, artifactExchangeJsonType); contextStore.put("filePath", fileName); + contextStore.put("artifactType", artifactType); this.fileName = fileName; this.artifactExchangeJsonType = artifactExchangeJsonType; } diff --git a/app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java b/app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java index 9605c769562a..1e5a56fe4cae 100644 --- a/app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java +++ b/app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java @@ -1,12 +1,11 @@ package com.appsmith.server.git; import com.appsmith.git.configurations.GitServiceConfig; -import com.appsmith.server.applications.base.ApplicationService; +import com.appsmith.server.artifacts.base.ArtifactService; +import com.appsmith.server.constants.ArtifactType; import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.GitAuth; import com.appsmith.server.dtos.ArtifactExchangeJson; -import com.appsmith.server.git.common.CommonGitService; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; @@ -19,8 +18,6 @@ import org.springframework.web.reactive.function.client.WebClient; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.junit.jupiter.Container; -import org.testcontainers.junit.jupiter.Testcontainers; import reactor.core.publisher.Mono; import java.nio.file.Path; @@ -40,7 +37,7 @@ public class GitServerInitializerExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, AfterAllCallback { @Autowired - ApplicationService applicationService; + ArtifactService artifactService; @Autowired GitServiceConfig gitServiceConfig; @@ -59,8 +56,7 @@ public void beforeAll(ExtensionContext extensionContext) { @Override public void beforeEach(ExtensionContext extensionContext) { ExtensionContext.Store parentContextStore = extensionContext.getParent().get().getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class)); - Class aClass = parentContextStore.get(ArtifactExchangeJson.class, Class.class); - String filePath = parentContextStore.get("filePath", String.class); + ArtifactType artifactType = parentContextStore.get("artifactType", ArtifactType.class); ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class)); String artifactId = contextStore.get(FieldName.ARTIFACT_ID, String.class); @@ -68,7 +64,7 @@ public void beforeEach(ExtensionContext extensionContext) { // TODO : Move this to artifact service to enable packages // Generate RSA public key for the given artifact - Mono gitAuthMono = applicationService.createOrUpdateSshKeyPair(artifactId, "RSA"); + Mono gitAuthMono = artifactService.createOrUpdateSshKeyPair(artifactType, artifactId, "RSA"); String tedGitApiPath = "http://" + gitContainer.getHost() + ":" + gitContainer.getMappedPort(4200) + "/api/v1/git/"; diff --git a/app/server/pom.xml b/app/server/pom.xml index 814ba6851871..31ecd38c587d 100644 --- a/app/server/pom.xml +++ b/app/server/pom.xml @@ -43,6 +43,9 @@ 3.5.1 true + ${skipTests} + false + ${skipTests} 2.0 true @@ -74,6 +77,30 @@ maven-dependency-plugin 3.4.0 + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-test-source + + add-test-source + + generate-test-sources + + + src/test/java + + src/test/it + + src/test/utils + + + + + + org.apache.maven.plugins maven-surefire-plugin @@ -84,6 +111,41 @@ --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED + src/test/java + ${skipUTs} + + + + org.junit.jupiter + junit-jupiter-engine + 5.6.2 + + + org.junit.platform + junit-platform-commons + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0-M5 + + true + + -ea + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.time=ALL-UNNAMED + --add-opens java.base/java.util=ALL-UNNAMED + + ../dist/plugins + + + src/test/it + ${skipITs} + From 292b79dbab0ae5c5511f6721cdbc121a74041d3e Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Tue, 24 Dec 2024 19:47:31 +0530 Subject: [PATCH 02/17] ci: Add capability to trigger ITs using ok-to-test --- .github/workflows/pr-automation.yml | 9 ++++++ .github/workflows/scripts/test-tag-parser.js | 31 +++++++++++++------- .github/workflows/server-build.yml | 29 ++++++++++++++---- 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index 622274e97451..ee553de8a4ff 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -133,3 +133,12 @@ jobs: spec: ${{ needs.parse-tags.outputs.spec}} matrix: ${{ needs.parse-tags.outputs.matrix}} is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} + + perform-it: + needs: [ parse-tags ] + if: success() && needs.parse-tags.outputs.its == 'true' + uses: ./.github/workflows/server-build.yml + secrets: inherit + with: + its: 'true' + is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} diff --git a/.github/workflows/scripts/test-tag-parser.js b/.github/workflows/scripts/test-tag-parser.js index 2ba8708f810d..23bf85ae72e1 100644 --- a/.github/workflows/scripts/test-tag-parser.js +++ b/.github/workflows/scripts/test-tag-parser.js @@ -28,18 +28,29 @@ function parseTags(body) { const allTags = require(process.env.GITHUB_WORKSPACE + "/app/client/cypress/tags.js").Tag; // "/ok-to-test" matcher. Takes precedence over the "/test" matcher. - const strictMatch = body.match(/^\/ok-to-test tags="(.+?)"/m)?.[1]; - if (strictMatch) { - if (strictMatch === "@tag.All") { - return { tags: strictMatch }; - } - const parts = strictMatch.split(/\s*,\s*/); - for (const part of parts) { - if (!allTags.includes(part)) { - throw new Error("Unknown tag: " + part); + const okToTestPattern = body.match(/^(\/ok-to-test) tags="(.+?)"( it=true)?/m); + + if (okToTestPattern?.[1]) { + var response = {}; + const tagsMatch = okToTestPattern?.[2]; + if (tagsMatch) { + if (tagsMatch === "@tag.All") { + response = { tags: tagsMatch }; + } else { + const parts = tagsMatch.split(/\s*,\s*/); + for (const part of parts) { + if (!allTags.includes(part)) { + throw new Error("Unknown tag: " + part); + } + } + response = { tags: tagsMatch }; } } - return { tags: strictMatch }; + const itsMatch = okToTestPattern?.[2]; + if (itsMatch) { + response = { ...response, its: 'true' }; + } + return response; } // "/test" code-fence matcher. diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index df1c1334ccab..933e86ef0673 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -5,20 +5,25 @@ on: workflow_call: inputs: pr: - description: "This is the PR number in case the workflow is being called in a pull request" + description: "PR number for the workflow" required: false type: number skip-tests: - description: "This is a boolean value in case the workflow is being called in build deploy-preview" + description: "Skip tests flag" + required: false + type: string + default: "false" + its: + description: "Whether we want to run integration tests" required: false type: string default: "false" branch: - description: "This is the branch to be used for the build." + description: "Branch for the build" required: false type: string is-pg-build: - description: "This is a boolean value in case the workflow is being called for a PG build" + description: "Flag for PG build" required: false type: string default: "false" @@ -34,6 +39,11 @@ on: required: false type: string default: "false" + its: + description: "Whether we want to run integration tests" + required: false + type: string + default: "false" branch: description: "Branch for the build" required: false @@ -210,13 +220,22 @@ jobs: fi args=() + + # Check if this run is requesting for unit tests or integration tests + # As of today, we don't expect both to get triggered in the same workflow + if [[ "${{ inputs.its }}" == "true" ]]; then + args+=("-DskipUTs=true") + else + args+=("-DskipITs=true") + fi + 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 + mvn verify "${args[@]}" | tee mvn_test.log # Check for "BUILD FAILURE" in the mvn_test.log if grep -q "BUILD FAILURE" mvn_test.log; then From 0a38fcfafe56b1bf750c648d532c90f98bce4c75 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 13:00:47 +0530 Subject: [PATCH 03/17] Added log --- .github/workflows/scripts/test-tag-parser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/scripts/test-tag-parser.js b/.github/workflows/scripts/test-tag-parser.js index 23bf85ae72e1..9822446aba94 100644 --- a/.github/workflows/scripts/test-tag-parser.js +++ b/.github/workflows/scripts/test-tag-parser.js @@ -27,6 +27,8 @@ module.exports = function ({core, context, github}) { function parseTags(body) { const allTags = require(process.env.GITHUB_WORKSPACE + "/app/client/cypress/tags.js").Tag; + console.log("Body is: ", body); + // "/ok-to-test" matcher. Takes precedence over the "/test" matcher. const okToTestPattern = body.match(/^(\/ok-to-test) tags="(.+?)"( it=true)?/m); From cb3fd9c51118296ec5b7dade3042aa06ef196b73 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 15:04:21 +0530 Subject: [PATCH 04/17] removed log --- .github/workflows/pr-automation.yml | 1 + .github/workflows/scripts/test-tag-parser.js | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index ee553de8a4ff..fe00968ba093 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -71,6 +71,7 @@ jobs: shell: bash outputs: tags: ${{ steps.parseTags.outputs.tags }} + its: ${{ steps.parseTags.outputs.its }} spec: ${{ steps.parseTags.outputs.spec }} matrix: ${{ steps.checkAll.outputs.matrix }} steps: diff --git a/.github/workflows/scripts/test-tag-parser.js b/.github/workflows/scripts/test-tag-parser.js index 9822446aba94..7aefd3f11bbe 100644 --- a/.github/workflows/scripts/test-tag-parser.js +++ b/.github/workflows/scripts/test-tag-parser.js @@ -27,8 +27,6 @@ module.exports = function ({core, context, github}) { function parseTags(body) { const allTags = require(process.env.GITHUB_WORKSPACE + "/app/client/cypress/tags.js").Tag; - console.log("Body is: ", body); - // "/ok-to-test" matcher. Takes precedence over the "/test" matcher. const okToTestPattern = body.match(/^(\/ok-to-test) tags="(.+?)"( it=true)?/m); @@ -48,7 +46,7 @@ function parseTags(body) { response = { tags: tagsMatch }; } } - const itsMatch = okToTestPattern?.[2]; + const itsMatch = okToTestPattern?.[3]; if (itsMatch) { response = { ...response, its: 'true' }; } From 30e69a89aa2803e668a3a71265387d05ed909fe9 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 15:09:47 +0530 Subject: [PATCH 05/17] set its --- .github/workflows/scripts/test-tag-parser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scripts/test-tag-parser.js b/.github/workflows/scripts/test-tag-parser.js index 7aefd3f11bbe..f303f3a40f1c 100644 --- a/.github/workflows/scripts/test-tag-parser.js +++ b/.github/workflows/scripts/test-tag-parser.js @@ -21,6 +21,7 @@ module.exports = function ({core, context, github}) { } core.setOutput("tags", parseResult.tags ?? ""); + core.setOutput("its", parseResult.its ?? ""); core.setOutput("spec", parseResult.spec ?? ""); } From ac6178e64854aa69e3ae3ae928f3400ac7e543b7 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 15:22:57 +0530 Subject: [PATCH 06/17] Manual server change --- .github/workflows/server-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 933e86ef0673..6ab2d21645a6 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -381,6 +381,7 @@ jobs: # Upload the build artifact so that it can be used by the test & deploy job in the workflow - name: Upload server build bundle + if: inputs.its != 'true' uses: actions/upload-artifact@v4 with: name: server-build From 31a00dc4ffdcab4e84b68fd42cc5651009d78e21 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 16:26:02 +0530 Subject: [PATCH 07/17] Manual server change --- app/server/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/server/README.md b/app/server/README.md index 58eafff4dcb9..48a608bcd5d4 100644 --- a/app/server/README.md +++ b/app/server/README.md @@ -2,4 +2,4 @@ This is the server-side repository for the Appsmith framework.

-For details on setting up your development machine, please refer to this [Setup Guide](../../contributions/ServerSetup.md). +For details on setting up your development machine, please refer to this [setup Guide](../../contributions/ServerSetup.md). From 982bbd8f1c65b908cb863e188fc5593e9992804a Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 18:03:56 +0530 Subject: [PATCH 08/17] Manual server change --- .github/workflows/pr-automation.yml | 6 +- .github/workflows/server-build.yml | 12 +- .../workflows/server-integration-tests.yml | 110 ++++++++++++++++++ .../appsmith/server/git/GitBranchesIT.java | 2 + 4 files changed, 116 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/server-integration-tests.yml diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index fe00968ba093..5b53f577777b 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -136,10 +136,10 @@ jobs: is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} perform-it: - needs: [ parse-tags ] + needs: [ parse-tags, perform-test ] if: success() && needs.parse-tags.outputs.its == 'true' - uses: ./.github/workflows/server-build.yml + uses: ./.github/workflows/server-integration-tests.yml secrets: inherit with: - its: 'true' + pr: ${{ github.event.number }} is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 6ab2d21645a6..dbb5d7c22845 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -13,11 +13,6 @@ on: required: false type: string default: "false" - its: - description: "Whether we want to run integration tests" - required: false - type: string - default: "false" branch: description: "Branch for the build" required: false @@ -39,11 +34,6 @@ on: required: false type: string default: "false" - its: - description: "Whether we want to run integration tests" - required: false - type: string - default: "false" branch: description: "Branch for the build" required: false @@ -235,7 +225,7 @@ jobs: fi # Run tests and capture logs - mvn verify "${args[@]}" | tee mvn_test.log + 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 diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml new file mode 100644 index 000000000000..41f7fa55b0ad --- /dev/null +++ b/.github/workflows/server-integration-tests.yml @@ -0,0 +1,110 @@ +name: Server Integrations Tests Workflow + +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 + is-pg-build: + description: "Flag for PG build" + required: false + type: string + default: "false" + +jobs: + run-tests: + runs-on: ubuntu-latest + if: | + github.event.pull_request.head.repo.full_name == github.repository || + github.event_name == 'workflow_dispatch' + defaults: + run: + shell: bash + + steps: + # Check out merge commit + - name: Fork based /ok-to-test checkout + if: inputs.pr != 0 + uses: actions/checkout@v4 + with: + 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@v4 + + # Setup Java + - name: Set up JDK 17 + if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "17" + + - name: Conditionally start PostgreSQL + if: | + inputs.is-pg-build == 'true' && inputs.skip-tests != 'true' + run: | + docker run --name appsmith-pg -p 5432:5432 -d -e POSTGRES_PASSWORD=password postgres:alpine postgres -N 1500 + + - name: Download the server build artifact + uses: actions/download-artifact@v4 + with: + name: server-build + path: app/server/dist/ + + - name: Un-tar the server folder + run: | + tar -xvf app/server/dist/server.jar -C app/server/dist/ + echo "Cleaning up the server tar files" + rm app/server/dist/server.jar + + - name: Download the rts build artifact + uses: actions/download-artifact@v4 + with: + name: rts-dist + path: app/client/packages/rts/dist + + - name: Un-tar the rts folder + run: | + tar -xvf app/client/packages/rts/dist/rts-dist.tar -C app/client/packages/rts/ + echo "Cleaning up the rts tar files" + rm app/client/packages/rts/dist/rts-dist.tar + + - name: Run rts using the untarred files + run: | + node --require source-map-support/register app/client/packages/rts/dist/bundle/server.js + + - name: Run only integration tests on server + env: + ACTIVE_PROFILE: test + APPSMITH_CLOUD_SERVICES_BASE_URL: "https://release-cs.appsmith.com" + APPSMITH_CLOUD_SERVICES_TEMPLATE_UPLOAD_AUTH: ${{ secrets.APPSMITH_CLOUD_SERVICES_TEMPLATE_UPLOAD_AUTH }} + APPSMITH_REDIS_URL: "redis://127.0.0.1:6379" + APPSMITH_ENCRYPTION_PASSWORD: "password" + APPSMITH_ENCRYPTION_SALT: "salt" + 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 + + # Run tests and capture logs + mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log + + diff --git a/app/server/appsmith-server/src/test/it/com/appsmith/server/git/GitBranchesIT.java b/app/server/appsmith-server/src/test/it/com/appsmith/server/git/GitBranchesIT.java index 02607420a8f6..a20345d049d4 100644 --- a/app/server/appsmith-server/src/test/it/com/appsmith/server/git/GitBranchesIT.java +++ b/app/server/appsmith-server/src/test/it/com/appsmith/server/git/GitBranchesIT.java @@ -212,6 +212,8 @@ void test(GitContext gitContext, ExtensionContext extensionContext) throws IOExc assertThat(autoCommitResponseDTO).isNotNull(); AutoCommitResponseDTO.AutoCommitResponse autoCommitProgress = autoCommitResponseDTO.getAutoCommitResponse(); + // This check requires RTS to be running on your local since client side changes come in from there + // Please make sure to run RTS before triggering this test assertThat(autoCommitProgress).isEqualTo(AutoCommitResponseDTO.AutoCommitResponse.PUBLISHED); // Wait for auto-commit to complete From f5eef46f72e05f2938111aa7e7645d3b415681af Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 18:08:53 +0530 Subject: [PATCH 09/17] Manual server change --- .github/workflows/pr-automation.yml | 10 +--------- .github/workflows/pr-cypress.yml | 13 +++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index 5b53f577777b..41d3f8d5e0f5 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -130,16 +130,8 @@ jobs: uses: ./.github/workflows/pr-cypress.yml secrets: inherit with: + its: ${{ needs.parse-tags.outputs.its}} tags: ${{ needs.parse-tags.outputs.tags}} spec: ${{ needs.parse-tags.outputs.spec}} matrix: ${{ needs.parse-tags.outputs.matrix}} is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} - - perform-it: - needs: [ parse-tags, perform-test ] - if: success() && needs.parse-tags.outputs.its == 'true' - uses: ./.github/workflows/server-integration-tests.yml - secrets: inherit - with: - pr: ${{ github.event.number }} - is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} diff --git a/.github/workflows/pr-cypress.yml b/.github/workflows/pr-cypress.yml index 186ca9a63116..05456176ebfa 100644 --- a/.github/workflows/pr-cypress.yml +++ b/.github/workflows/pr-cypress.yml @@ -3,6 +3,10 @@ name: Cypress test suite on: workflow_call: inputs: + its: + required: false + type: string + default: "false" tags: required: true type: string @@ -45,6 +49,15 @@ jobs: with: pr: ${{ github.event.number }} + server-it: + needs: [ server-build, rts-build ] + if: success() && inputs.its == 'true' + uses: ./.github/workflows/server-integration-tests.yml + secrets: inherit + with: + pr: ${{ github.event.number }} + is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} + build-docker-image: needs: [client-build, server-build, rts-build] # Only run if the build step is successful From 1a4cec05ae3f1f2d02e9618a6eaa5db9b80bb59d Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 18:29:11 +0530 Subject: [PATCH 10/17] Manual server change --- .github/workflows/pr-cypress.yml | 2 +- .github/workflows/server-integration-tests.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-cypress.yml b/.github/workflows/pr-cypress.yml index 05456176ebfa..f525f54516bc 100644 --- a/.github/workflows/pr-cypress.yml +++ b/.github/workflows/pr-cypress.yml @@ -82,7 +82,7 @@ jobs: matrix: ${{ inputs.matrix }} ci-test-result: - needs: [ci-test] + needs: [ci-test, server-it] # Only run if the ci-test with matrices step is successful if: always() runs-on: ubuntu-latest diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index 41f7fa55b0ad..32b21413d479 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -60,9 +60,10 @@ jobs: - name: Un-tar the server folder run: | - tar -xvf app/server/dist/server.jar -C app/server/dist/ + ls app/server/dist/ + tar -xvf app/server/dist/server-build.zip -C app/server/dist/ echo "Cleaning up the server tar files" - rm app/server/dist/server.jar + rm app/server/dist/server-build.jar - name: Download the rts build artifact uses: actions/download-artifact@v4 From 960682dc502d04e1ec224c992d93c03d68520418 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 19:00:25 +0530 Subject: [PATCH 11/17] Manual server change --- .github/workflows/server-integration-tests.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index 32b21413d479..ac96130c2e35 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -57,13 +57,6 @@ jobs: with: name: server-build path: app/server/dist/ - - - name: Un-tar the server folder - run: | - ls app/server/dist/ - tar -xvf app/server/dist/server-build.zip -C app/server/dist/ - echo "Cleaning up the server tar files" - rm app/server/dist/server-build.jar - name: Download the rts build artifact uses: actions/download-artifact@v4 From 4aa2f3aaf14cde6aba29bd62aa9b5fc67dd43a78 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 19:12:52 +0530 Subject: [PATCH 12/17] Manual server change --- .github/workflows/server-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index ac96130c2e35..7dec842bf15e 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -72,7 +72,7 @@ jobs: - name: Run rts using the untarred files run: | - node --require source-map-support/register app/client/packages/rts/dist/bundle/server.js + node app/client/packages/rts/dist/bundle/server.js - name: Run only integration tests on server env: From 01526e920005f1fb44b94278cc325a880e9291ca Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 19:26:44 +0530 Subject: [PATCH 13/17] Manual server change --- .github/workflows/server-integration-tests.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index 7dec842bf15e..0041feb9ad7e 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -40,7 +40,6 @@ jobs: # Setup Java - name: Set up JDK 17 - if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') uses: actions/setup-java@v4 with: distribution: "temurin" @@ -48,7 +47,7 @@ jobs: - name: Conditionally start PostgreSQL if: | - inputs.is-pg-build == 'true' && inputs.skip-tests != 'true' + inputs.is-pg-build == 'true' run: | docker run --name appsmith-pg -p 5432:5432 -d -e POSTGRES_PASSWORD=password postgres:alpine postgres -N 1500 @@ -72,7 +71,7 @@ jobs: - name: Run rts using the untarred files run: | - node app/client/packages/rts/dist/bundle/server.js + nohup -- node app/client/packages/rts/dist/bundle/server.js - name: Run only integration tests on server env: @@ -93,11 +92,6 @@ jobs: 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 verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log From 9df624e678514be4a0f24ff1548faac9e7052cf8 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 19:38:27 +0530 Subject: [PATCH 14/17] Manual server change --- .github/workflows/server-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index 0041feb9ad7e..6dea9871a99d 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -71,7 +71,7 @@ jobs: - name: Run rts using the untarred files run: | - nohup -- node app/client/packages/rts/dist/bundle/server.js + nohup -- node app/client/packages/rts/dist/bundle/server.js & - name: Run only integration tests on server env: From ab5e80326d109bd6fba06d156357a0f12608102d Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 19:45:13 +0530 Subject: [PATCH 15/17] Manual server change --- .github/workflows/server-integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index 6dea9871a99d..6e06f96bc9b5 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -93,6 +93,7 @@ jobs: args=() # Run tests and capture logs + cd app/server mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log From 0ac5005e40c5bef26fdc94f18cb3dba1dbfc83b1 Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 19:59:36 +0530 Subject: [PATCH 16/17] Manual server change --- .github/workflows/server-integration-tests.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/server-integration-tests.yml b/.github/workflows/server-integration-tests.yml index 6e06f96bc9b5..a4c4836ba238 100644 --- a/.github/workflows/server-integration-tests.yml +++ b/.github/workflows/server-integration-tests.yml @@ -17,13 +17,22 @@ on: jobs: run-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-8-cores if: | github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch' defaults: run: shell: bash + # Service containers to run with this job. Required for running tests + services: + # Label used to access the service container + redis: + # Docker Hub image for Redis + image: redis + ports: + # Opens tcp port 6379 on the host and service container + - 6379:6379 steps: # Check out merge commit From 28ec34d9b20246ce54b7deab8e9fa8e136bbd7ff Mon Sep 17 00:00:00 2001 From: Nidhi Nair Date: Mon, 30 Dec 2024 20:28:58 +0530 Subject: [PATCH 17/17] Manual server change --- .github/workflows/server-build.yml | 9 --------- app/server/README.md | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index dbb5d7c22845..55691d6a049e 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -210,14 +210,6 @@ jobs: fi args=() - - # Check if this run is requesting for unit tests or integration tests - # As of today, we don't expect both to get triggered in the same workflow - if [[ "${{ inputs.its }}" == "true" ]]; then - args+=("-DskipUTs=true") - else - args+=("-DskipITs=true") - fi if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then failed_tests="${{ steps.failed_tests.outputs.tests }}" @@ -371,7 +363,6 @@ jobs: # Upload the build artifact so that it can be used by the test & deploy job in the workflow - name: Upload server build bundle - if: inputs.its != 'true' uses: actions/upload-artifact@v4 with: name: server-build diff --git a/app/server/README.md b/app/server/README.md index 48a608bcd5d4..58eafff4dcb9 100644 --- a/app/server/README.md +++ b/app/server/README.md @@ -2,4 +2,4 @@ This is the server-side repository for the Appsmith framework.

-For details on setting up your development machine, please refer to this [setup Guide](../../contributions/ServerSetup.md). +For details on setting up your development machine, please refer to this [Setup Guide](../../contributions/ServerSetup.md).