Skip to content

Commit

Permalink
Merge branch 'release' into test/jsObjectsRegressionSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
“NandanAnantharamu” committed Dec 27, 2024
2 parents 2c6a2ee + 092445e commit ccaeaba
Show file tree
Hide file tree
Showing 587 changed files with 11,740 additions and 5,708 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/build-client-server-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
matrix_count: ${{steps.matrix.outputs.matrix_count}}
run_count: ${{ steps.countArgs.outputs.run_count }}
is-pg-build: ${{steps.args.outputs.is-pg-build}}
update_snapshot: ${{steps.args.outputs.update_snapshot}}
specs_to_run: ${{steps.args.outputs.specs_to_run}}
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v4
Expand All @@ -38,6 +40,22 @@ jobs:
runId=$((checkArg + 0))
echo "runId=$runId" >> $GITHUB_OUTPUT
fi
# Check for update_snapshot
checkArg=${{ github.event.client_payload.slash_command.args.named.update_snapshot }}
if [[ -z "$checkArg" ]]; then
echo "update_snapshot=false" >> $GITHUB_OUTPUT
else
echo "update_snapshot=$checkArg" >> $GITHUB_OUTPUT
fi
# Check for spec file
checkArg=${{ github.event.client_payload.slash_command.args.named.specs_to_run }}
if [[ -z "$checkArg" ]]; then
echo "specs_to_run='no_data'" >> $GITHUB_OUTPUT
else
echo "specs_to_run=$checkArg" >> $GITHUB_OUTPUT
fi
- name: Set run count
id: countArgs
Expand Down Expand Up @@ -97,7 +115,7 @@ jobs:
body: |
Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
[Cypress dashboard](https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail)
PR: #${{ fromJson(steps.args.outputs.pr) }}.
PR: #${{ fromJson(steps.args.outputs.pr) }} .
server-build:
name: server-build
Expand Down Expand Up @@ -149,6 +167,8 @@ jobs:
with:
pr: ${{fromJson(needs.file-check.outputs.pr)}}
run_count: ${{fromJson(needs.file-check.outputs.run_count)}}
update_snapshot: ${{fromJson(needs.file-check.outputs.update_snapshot)}}
specs_to_run: ${{needs.file-check.outputs.specs_to_run}}


ci-test-limited-existing-docker-image:
Expand All @@ -162,6 +182,8 @@ jobs:
pr: ${{fromJson(needs.file-check.outputs.pr)}}
previous-workflow-run-id: ${{ fromJson(needs.file-check.outputs.runId) }}
run_count: ${{fromJson(needs.file-check.outputs.run_count)}}
update_snapshot: ${{fromJson(needs.file-check.outputs.update_snapshot)}}
specs_to_run: ${{needs.file-check.outputs.specs_to_run}}

ci-test-limited-result:
needs: [file-check, ci-test-limited]
Expand Down
111 changes: 97 additions & 14 deletions .github/workflows/ci-test-limited-with-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ on:
required: false
type: number
default: 1
update_snapshot:
description: 'Give option to update snapshot (true/false)'
required: false
type: boolean
default: false
specs_to_run:
description: 'Cypress spec file(s) to run'
required: false
type: string
default: 'no_data'

workflow_call:
inputs:
pr:
Expand All @@ -35,6 +46,16 @@ on:
required: false
type: number
default: 1
update_snapshot:
description: 'Give option to update snapshot (true/false)'
required: false
type: boolean
default: false
specs_to_run:
description: 'Cypress spec file(s) to run'
required: false
type: string
default: 'no_data'

jobs:
ci-test-limited:
Expand Down Expand Up @@ -111,22 +132,67 @@ jobs:
else
echo "rerun=false" >> $GITHUB_OUTPUT
fi
- name: Upload existing snapshot data
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-existing-compare-snapshots
path: ${{ github.workspace }}/app/client/cypress/snapshots
overwrite: true

# Get specs to run
# Step to get specs from the file or use the provided specs
- name: Get specs to run
if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
run: |
specs_to_run=""
while IFS= read -r line
do
if [[ $line =~ ^#|^\/\/ ]]; then
continue
# Check if specs_to_run is provided; if not, use the fallback file
echo "[DEBUG] Initial specs_to_run value: $specs_to_run"
if [[ -z "$specs_to_run" || "$specs_to_run" == "no_data" ]]; then
echo "[INFO] No specs provided, falling back to limited-tests.txt file."
# Verify if the fallback file exists
if [[ ! -f app/client/cypress/limited-tests.txt ]]; then
echo "[ERROR] limited-tests.txt file not found in app/client/cypress!" >&2
exit 1
else
specs_to_run="$specs_to_run,$line"
echo "[DEBUG] limited-tests.txt file found. Proceeding to read specs."
fi
specs_to_run=""
# Read each line of limited-tests.txt
while IFS= read -r line || [[ -n "$line" ]]; do
# Log each line being read
echo "[DEBUG] Reading line: $line"
# Skip comments and empty lines
if [[ $line =~ ^#|^\/\/ || -z $line ]]; then
echo "[DEBUG] Skipping comment/empty line: $line"
continue
else
echo "[DEBUG] Adding spec to specs_to_run: $line"
specs_to_run="$specs_to_run,$line"
fi
done < app/client/cypress/limited-tests.txt
# Remove leading comma
specs_to_run=${specs_to_run#,}
echo "[DEBUG] Final specs_to_run after processing limited-tests.txt: $specs_to_run"
# If no specs found, return an error
if [[ -z "$specs_to_run" ]]; then
echo "[ERROR] No specs found in limited-tests.txt after processing!" >&2
exit 1
fi
done < app/client/cypress/limited-tests.txt
specs_to_run=${specs_to_run#,}
else
echo "[INFO] Using provided specs: $specs_to_run"
fi
# Log the final specs_to_run value before writing it to GitHub environment
echo "[DEBUG] Setting specs_to_run to GitHub environment variable: $specs_to_run"
# Set the final specs_to_run to GitHub environment variable
echo "specs_to_run=$specs_to_run" >> $GITHUB_ENV
# In case of run-id provided download the artifact from the previous run
- name: Download Docker image artifact
Expand Down Expand Up @@ -349,10 +415,19 @@ jobs:
NODE_ENV: development
run: |
cd app/client
npx cypress-repeat-pro run -n ${{ inputs.run_count }} --force \
--spec ${{ env.specs_to_run }} \
if [[ "${{ inputs.update_snapshot }}" == "true" ]]; then
echo "Running Cypress with snapshot updates..."
CYPRESS_updateSnapshots=true npx cypress-repeat-pro run -n "${{ inputs.run_count }}" --force \
--spec "${{ inputs.specs_to_run }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser ${{ env.BROWSER_PATH }}
--browser "${{ env.BROWSER_PATH }}"
else
echo "Running Cypress tests without snapshot updates..."
npx cypress-repeat-pro run -n "${{ inputs.run_count }}" --force \
--spec "${{ env.specs_to_run }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser "${{ env.BROWSER_PATH }}"
fi
cat cy-repeat-summary.txt
# Define the path for the failure flag file
FAILURE_FLAG_FILE="ci_test_status.txt"
Expand Down Expand Up @@ -453,9 +528,17 @@ jobs:
if: always()
with:
name: server-logs
path: app/server/server-logs.log
path: ${{ github.workspace }}/app/server/server-logs.log
overwrite: true

- name: Upload new compared snapshot data
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-new-compare-snapshots
path: ${{ github.workspace }}/app/client/cypress/snapshots
overwrite: true

# Set status = success
- name: Save the status of the run
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ jobs:
if: failure()
with:
name: server-logs
path: app/server/server-logs.log
path: ${{ github.workspace }}/app/server/server-logs.log
overwrite: true

# Set status = success
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/client-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ jobs:
env:
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
echo "One or more files in the server folder has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
echo "One or more files in the server folder has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
- name: Check compliance
if: inputs.pr != 0 && steps.changed-files-specific.outputs.any_changed == 'true'
Expand Down Expand Up @@ -166,6 +166,11 @@ jobs:
export REACT_APP_SEGMENT_CE_KEY="${{ secrets.APPSMITH_SEGMENT_CE_KEY_RELEASE }}"
fi
REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} \
REACT_APP_FARO_APP_ID=${{ secrets.REACT_APP_FARO_APP_ID }} \
REACT_APP_FARO_APP_NAME=${{ secrets.REACT_APP_FARO_APP_NAME }} \
REACT_APP_FARO_SOURCEMAP_UPLOAD_API_KEY=${{ secrets.REACT_APP_FARO_SOURCEMAP_UPLOAD_API_KEY }} \
REACT_APP_FARO_SOURCEMAP_UPLOAD_ENDPOINT=${{ secrets.REACT_APP_FARO_SOURCEMAP_UPLOAD_ENDPOINT }} \
REACT_APP_FARO_STACK_ID=${{ secrets.REACT_APP_FARO_STACK_ID }} \
REACT_APP_FUSIONCHARTS_LICENSE_KEY=${{ secrets.APPSMITH_FUSIONCHARTS_LICENSE_KEY }} \
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \
REACT_APP_VERSION_EDITION="Community" \
Expand Down
38 changes: 20 additions & 18 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Appsmith Github Release Workflow
name: Github Release

# This workflow builds Docker images for server and client, and then pushes them to Docker Hub.
# The docker-tag with which this push happens is `latest` and the release tag (e.g., v1.2.3 etc.).
Expand All @@ -17,24 +17,27 @@ jobs:
runs-on: ubuntu-latest

outputs:
tag: ${{ steps.get_version.outputs.tag }}
tag: ${{ steps.main.outputs.tag }}
docker_tags: ${{ steps.main.outputs.docker_tags }}

steps:
- name: Environment details
run: |
echo "PWD: $PWD"
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "GITHUB_EVENT_NAME: $GITHUB_EVENT_NAME"
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: "5"
fetch-tags: "true"

- name: Get the version
id: get_version
run: |
if ! [[ ${GITHUB_REF-} =~ ^refs/tags/v[[:digit:]]\.[[:digit:]]+(\.[[:digit:]]+)?$ ]]; then
echo "Invalid tag: '${GITHUB_REF-}'. Has to be like `v1.22`, `v1.22.33` only."
exit 1
fi
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Prelude checks and preparations
uses: actions/github-script@v7
id: main
with:
script: |
require(
"${{ github.workspace }}/.github/workflows/scripts/github-release/prelude.js",
)(
{ core, context, github },
"${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-${{ vars.EDITION }}",
)
client-build:
needs:
Expand Down Expand Up @@ -273,5 +276,4 @@ jobs:
APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }}
BASE=${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:nightly
tags: |
${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-${{ vars.EDITION }}:${{needs.prelude.outputs.tag}}
${{ vars.DOCKER_HUB_ORGANIZATION }}/appsmith-${{ vars.EDITION }}:latest
${{ needs.prelude.outputs.docker_tags }}
53 changes: 53 additions & 0 deletions .github/workflows/scripts/github-release/prelude.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const { exec } = require("child_process");

module.exports = async function ({ core, context }, imageRepo) {
core.summary.addTable([
[{ data: "PWD", header: true }, process.cwd()],
[{ data: "GITHUB_REF", header: true }, context.ref],
[{ data: "GITHUB_SHA", header: true }, context.sha],
[{ data: "GITHUB_EVENT_NAME", header: true }, context.eventName],
]);

if (!context.ref?.match(/^refs\/tags\/v/)) {
core.setFailed(`Invalid tag: '${context.ref}'. Has to be like 'v1.22', 'v1.22.33' only.`);
return;
}

// Current version being tagged, including the 'v' prefix.
const thisVersion = context.ref.replace("refs/tags/", "");
core.setOutput("tag", thisVersion);

// The latest version of Appsmith available, including the 'v' prefix, including the currently tagged version.
const latestVersion = await getLatestTag();

// The docker tags to be pushed to the registry.
const dockerTags = [
`${imageRepo}:${thisVersion}`,
];

if (latestVersion === thisVersion) {
dockerTags.push(`${imageRepo}:latest`);
}

core.summary.addHeading("Docker image tags", 3);
core.summary.addCodeBlock(dockerTags.join("\n"));
core.setOutput("docker_tags", dockerTags.join("\n"));

core.summary.write();
}

function getLatestTag() {
return new Promise((resolve, reject) => {
exec("git tag --list --sort=-version:refname 'v*' | head -1", (error, stdout, stderr) => {
if (error) {
reject(`exec error: ${error}`);
return;
}
if (stderr) {
reject(`stderr: ${stderr}`);
return;
}
resolve(stdout.trim());
});
});
}
Loading

0 comments on commit ccaeaba

Please sign in to comment.