Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/pr-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
shell: bash
outputs:
tags: ${{ steps.parseTags.outputs.tags }}
its: ${{ steps.parseTags.outputs.its }}
Comment thread
nidhi-nair marked this conversation as resolved.
spec: ${{ steps.parseTags.outputs.spec }}
matrix: ${{ steps.checkAll.outputs.matrix }}
steps:
Expand Down Expand Up @@ -133,3 +134,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' }}
Comment thread
nidhi-nair marked this conversation as resolved.
Outdated
32 changes: 22 additions & 10 deletions .github/workflows/scripts/test-tag-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,37 @@ module.exports = function ({core, context, github}) {
}

core.setOutput("tags", parseResult.tags ?? "");
core.setOutput("its", parseResult.its ?? "");
core.setOutput("spec", parseResult.spec ?? "");
}

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?.[3];
if (itsMatch) {
response = { ...response, its: 'true' };
}
Comment thread
nidhi-nair marked this conversation as resolved.
return response;
}

// "/test" code-fence matcher.
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -362,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
Expand Down
2 changes: 1 addition & 1 deletion app/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This is the server-side repository for the Appsmith framework.
<br><br>
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).