Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 41 to 46. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/tj-actions/changed-files/releases">tj-actions/changed-files's releases</a>.</em></p> <blockquote> <h2>v46</h2> <blockquote> <p>[!WARNING]<br /> <strong>Security Alert:</strong> A critical security issue was identified in this action due to a compromised commit.</p> <p>This commit has been <strong>removed</strong> from all tags and branches, and necessary measures have been implemented to prevent similar issues in the future.</p> <h4><strong>Action Required:</strong></h4> <ul> <li><strong>Review your workflows executed between March 14 and March 15.</strong> If you notice unexpected output under the <code>changed-files</code> section, decode it using the following command: <code>echo 'xxx' | base64 -d | base64 -d</code><br /> If the output contains sensitive information (e.g., tokens or secrets), <strong>revoke and rotate those secrets immediately</strong>.</li> <li><strong>If your workflows reference this commit directly by its SHA</strong>, you must update them immediately to avoid using the compromised version.</li> <li><strong>If you are using tagged versions</strong> (e.g., <code>v35</code>, <code>v44.5.1</code>), no action is required as these tags have been updated and are now safe to use.</li> </ul> <p>Additionally, as a precaution, we recommend rotating any secrets that may have been exposed during this timeframe to ensure the continued security of your workflows.</p> </blockquote> <h1>Changes in v46.0.1</h1> <h2>What's Changed</h2> <ul> <li>update: sync-release-version.yml to use signed commits by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2472">tj-actions/changed-files#2472</a></li> <li>Updated README.md by <a href="https://github.com/github-actions"><code>@github-actions</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2473">tj-actions/changed-files#2473</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/tj-actions/changed-files/compare/v46...v46.0.1">https://github.com/tj-actions/changed-files/compare/v46...v46.0.1</a></p> <hr /> <h1>Changes in v46.0.0</h1> <h2>What's Changed</h2> <ul> <li>docs: update docs to highlight security issues by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2465">tj-actions/changed-files#2465</a></li> <li>fix: update github workflow update-readme.yml by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2466">tj-actions/changed-files#2466</a></li> <li>fix: update permission in update-readme.yml workflow by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2467">tj-actions/changed-files#2467</a></li> <li>fix: update update-readme.yml to sign-commits by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2468">tj-actions/changed-files#2468</a></li> <li>Updated README.md by <a href="https://github.com/github-actions"><code>@github-actions</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2469">tj-actions/changed-files#2469</a></li> <li>update: sync-release-version.yml by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2471">tj-actions/changed-files#2471</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/github-actions"><code>@github-actions</code></a> made their first contribution in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2469">tj-actions/changed-files#2469</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/tj-actions/changed-files/compare/v45.0.5...v46.0.0">https://github.com/tj-actions/changed-files/compare/v45.0.5...v46.0.0</a></p> <h2>What's Changed</h2> <ul> <li>docs: update docs to highlight security issues by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2465">tj-actions/changed-files#2465</a></li> <li>fix: update github workflow update-readme.yml by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2466">tj-actions/changed-files#2466</a></li> <li>fix: update permission in update-readme.yml workflow by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2467">tj-actions/changed-files#2467</a></li> <li>fix: update update-readme.yml to sign-commits by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2468">tj-actions/changed-files#2468</a></li> <li>Updated README.md by <a href="https://github.com/github-actions"><code>@github-actions</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2469">tj-actions/changed-files#2469</a></li> <li>update: sync-release-version.yml by <a href="https://github.com/jackton1"><code>@jackton1</code></a> in <a href="https://redirect.github.com/tj-actions/changed-files/pull/2471">tj-actions/changed-files#2471</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/tj-actions/changed-files/compare/v45.0.5...v46.0.0">https://github.com/tj-actions/changed-files/compare/v45.0.5...v46.0.0</a></p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/tj-actions/changed-files/blob/main/HISTORY.md">tj-actions/changed-files's changelog</a>.</em></p> <blockquote> <h1>Changelog</h1> <h1><a href="https://github.com/tj-actions/changed-files/compare/v46.0.0...v46.0.1">46.0.1</a> - (2025-03-16)</h1> <h2><!-- raw HTML omitted -->🔄 Update</h2> <ul> <li>Updated README.md (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2473">#2473</a>)</li> </ul> <p>Co-authored-by: github-actions[bot] <!-- raw HTML omitted --> (<a href="2f7c5bfce2">2f7c5bf</a>) - (github-actions[bot])</p> <ul> <li>Sync-release-version.yml to use signed commits (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2472">#2472</a>) (<a href="4189ec62c4">4189ec6</a>) - (Tonye Jack)</li> </ul> <h1><a href="https://github.com/tj-actions/changed-files/compare/v45.0.9...v46.0.0">46.0.0</a> - (2025-03-16)</h1> <h2><!-- raw HTML omitted -->🐛 Bug Fixes</h2> <ul> <li>Update update-readme.yml to sign-commits (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2468">#2468</a>) (<a href="0f1ffe6185">0f1ffe6</a>) - (Tonye Jack)</li> <li>Update permission in update-readme.yml workflow (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2467">#2467</a>) (<a href="ddef03e37c">ddef03e</a>) - (Tonye Jack)</li> <li>Update github workflow update-readme.yml (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2466">#2466</a>) (<a href="9c2df0d54a">9c2df0d</a>) - (Tonye Jack)</li> </ul> <h2><!-- raw HTML omitted -->➖ Remove</h2> <ul> <li>Deleted renovate.json (<a href="e37e952786">e37e952</a>) - (Tonye Jack)</li> </ul> <h2><!-- raw HTML omitted -->🔄 Update</h2> <ul> <li>Sync-release-version.yml (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2471">#2471</a>) (<a href="4cd184a1dd">4cd184a</a>) - (Tonye Jack)</li> <li>Updated README.md (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2469">#2469</a>)</li> </ul> <p>Co-authored-by: github-actions[bot] <!-- raw HTML omitted --> (<a href="5cbf22026d">5cbf220</a>) - (github-actions[bot])</p> <h2><!-- raw HTML omitted -->📚 Documentation</h2> <ul> <li>Update docs to highlight security issues (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2465">#2465</a>) (<a href="65253327cf">6525332</a>) - (Tonye Jack)</li> </ul> <h1><a href="https://github.com/tj-actions/changed-files/compare/v45.0.4...v45.0.9">45.0.9</a> - (2025-03-15)</h1> <h2><!-- raw HTML omitted -->🐛 Bug Fixes</h2> <ul> <li><strong>deps:</strong> Update dependency <code>@octokit/rest</code> to v21.1.1 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2435">#2435</a>) (<a href="fb8dcda5fb">fb8dcda</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update dependency <code>@octokit/rest</code> to v21.1.0 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2394">#2394</a>) (<a href="7b72c97d73">7b72c97</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update dependency yaml to v2.7.0 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2383">#2383</a>) (<a href="5f974c28f5">5f974c2</a>) - (renovate[bot])</li> </ul> <h2><!-- raw HTML omitted -->⚙️ Miscellaneous Tasks</h2> <ul> <li><strong>deps:</strong> Lock file maintenance (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2460">#2460</a>) (<a href="9200e69727">9200e69</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update dependency <code>@types/node</code> to v22.13.10 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2459">#2459</a>) (<a href="e650cfdae5">e650cfd</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update dependency eslint-config-prettier to v10.1.1 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2458">#2458</a>) (<a href="82af21f4a0">82af21f</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update dependency eslint-config-prettier to v10.1.0 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2457">#2457</a>) (<a href="82fa4a6402">82fa4a6</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update peter-evans/create-pull-request action to v7.0.8 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2455">#2455</a>) (<a href="315505acf4">315505a</a>) - (renovate[bot])</li> <li><strong>deps:</strong> Update dependency <code>@types/node</code> to v22.13.9 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2454">#2454</a>) (<a href="c8e1cdb9ea">c8e1cdb</a>) - (renovate[bot])</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="2f7c5bfce2"><code>2f7c5bf</code></a> Updated README.md (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2473">#2473</a>)</li> <li><a href="4189ec62c4"><code>4189ec6</code></a> update: sync-release-version.yml to use signed commits (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2472">#2472</a>)</li> <li><a href="4cd184a1dd"><code>4cd184a</code></a> update: sync-release-version.yml (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2471">#2471</a>)</li> <li><a href="5cbf22026d"><code>5cbf220</code></a> Updated README.md (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2469">#2469</a>)</li> <li><a href="0f1ffe6185"><code>0f1ffe6</code></a> fix: update update-readme.yml to sign-commits (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2468">#2468</a>)</li> <li><a href="ddef03e37c"><code>ddef03e</code></a> fix: update permission in update-readme.yml workflow (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2467">#2467</a>)</li> <li><a href="9c2df0d54a"><code>9c2df0d</code></a> fix: update github workflow update-readme.yml (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2466">#2466</a>)</li> <li><a href="65253327cf"><code>6525332</code></a> docs: update docs to highlight security issues (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2465">#2465</a>)</li> <li><a href="e37e952786"><code>e37e952</code></a> Deleted renovate.json</li> <li><a href="a284dc1814"><code>a284dc1</code></a> Upgraded to v45.0.8 (<a href="https://redirect.github.com/tj-actions/changed-files/issues/2462">#2462</a>)</li> <li>Additional commits viewable in <a href="https://github.com/tj-actions/changed-files/compare/v41...v46">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/appsmithorg/appsmith/network/alerts). </details> <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Tests have not run on the HEAD 7cc23031088dd77b20e7b899010f7343a2c5269d yet > <hr>Tue, 18 Mar 2025 06:37:37 UTC <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Upgraded internal automation dependencies to enhance the consistency and reliability of our build and deployment processes. These improvements help maintain stability and performance across client and server operations, ensuring a smooth experience for users without any visible interface changes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
389 lines
16 KiB
YAML
389 lines
16 KiB
YAML
# This workflow is responsible for building, testing & packaging the Java server codebase
|
|
name: Appsmith Server Workflow
|
|
|
|
on:
|
|
workflow_call:
|
|
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"
|
|
|
|
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:
|
|
working-directory: app/server
|
|
|
|
jobs:
|
|
server-unit-tests:
|
|
runs-on: ubuntu-22.04-8core
|
|
|
|
# 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:
|
|
# The checkout steps MUST happen first because the default directory is set according to the code base.
|
|
# GitHub Action expects all future commands to be executed in the code directory. Hence, we need to check out
|
|
# the code before doing anything else.
|
|
|
|
# Check out merge commit with the base branch in case this workflow is invoked via pull request
|
|
- name: Check out merged commit from PR and base branch
|
|
uses: actions/checkout@v4
|
|
if: inputs.pr != 0
|
|
with:
|
|
fetch-tags: true
|
|
ref: refs/pull/${{ inputs.pr }}/merge
|
|
|
|
# Check out the specified branch in case this workflow is called by another workflow
|
|
- name: Checkout the specified branch
|
|
if: inputs.pr == 0 && inputs.branch != ''
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-tags: true
|
|
ref: ${{ inputs.branch }}
|
|
|
|
# Checkout the code in the current branch in case the workflow is called because of a branch push event
|
|
- name: Check out the head commit of the branch
|
|
uses: actions/checkout@v4
|
|
if: inputs.pr == 0 && inputs.branch == ''
|
|
with:
|
|
fetch-tags: true
|
|
|
|
- name: Figure out the PR number
|
|
run: echo ${{ inputs.pr }}
|
|
|
|
- name: Default database URL
|
|
run: echo "Is this a PG build? ${{ inputs.is-pg-build }}"
|
|
|
|
- name: Print the Github event
|
|
run: echo ${{ github.event_name }}
|
|
|
|
- name: Get changed files in the server folder
|
|
id: changed-files-specific
|
|
uses: tj-actions/changed-files@v46
|
|
with:
|
|
files: "app/server/**"
|
|
write_output_files: true
|
|
|
|
# - name: Updating the server changed file variable
|
|
# id: changed-files-specific
|
|
# run: echo "any_changed=true" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Run step if any file(s) in the server folder change
|
|
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
|
run: |
|
|
echo "One or more files in the server folder has changed."
|
|
echo "List all the files that have changed:"
|
|
cat "${{ github.workspace }}/.github/outputs/all_changed_files.txt"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
if: inputs.skip-tests != 'true' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
id: cache-appsmith
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-server-junit
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
if: inputs.skip-tests != 'true' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
id: run_result
|
|
run: |
|
|
if [ -f ~/run_result ]; then
|
|
echo "run_result=$(cat ~/run_result)" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "run_result=default" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Download the failed test artifact in case of rerun
|
|
if: steps.run_result.outputs.run_result == 'failedtest' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: failed-server-tests
|
|
path: ~/failed-server-tests
|
|
|
|
- name: Extract the tests for rerun
|
|
id: failed_tests
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
run: |
|
|
failed_tests=$(awk '$0 != "" && !seen[$0]++ {printf("%s%s",sep,$0); sep=","}' ~/failed-server-tests/failed-server-tests.txt)
|
|
echo "$failed_tests"
|
|
echo "tests=$failed_tests" >> $GITHUB_OUTPUT
|
|
|
|
# In case of prior failure run the job
|
|
- 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')
|
|
run: echo "I'm alive!" && exit 0
|
|
|
|
# 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
|
|
|
|
# Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again
|
|
- name: Cache maven dependencies
|
|
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/cache@v4
|
|
env:
|
|
cache-name: cache-maven-dependencies
|
|
with:
|
|
# maven dependencies are stored in `~/.m2` on Linux/macOS
|
|
path: ~/.m2
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ runner.os }}-m2
|
|
|
|
# Build the code
|
|
- name: Build
|
|
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')
|
|
run: |
|
|
./build.sh -DskipTests
|
|
|
|
# Test the code
|
|
- name: Run only tests
|
|
if: (inputs.skip-tests != 'true' || steps.run_result.outputs.run_result == 'failedtest') && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
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 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"
|
|
|
|
skipped_modules=()
|
|
|
|
# Process mvn_test.log for FAILURE and SKIPPED statuses
|
|
while IFS= read -r line; do
|
|
if [[ $line == *"SKIPPED"* ]]; then
|
|
module_name=$(echo "$line" | awk '{print $2}')
|
|
skipped_modules+=("$module_name")
|
|
fi
|
|
done < mvn_test.log
|
|
|
|
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_from_xml"
|
|
|
|
# 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
|
|
|
|
# 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
|
|
if: failure()
|
|
run: |
|
|
echo "run_result=failedtest" >> $GITHUB_OUTPUT
|
|
echo "failedtest" > ~/run_result
|
|
|
|
# Force store previous run result to cache
|
|
- name: Store the previous run result
|
|
if: failure()
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-server-junit
|
|
|
|
- name: Upload the failed tests report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: failed-server-tests
|
|
path: app/server/failed-server-tests.txt
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
- name: Fetch server build from cache
|
|
if: steps.changed-files-specific.outputs.any_changed == 'false' && success() && github.event_name != 'push' && github.event_name != 'workflow_dispatch' && github.event_name != 'schedule'
|
|
env:
|
|
cachetoken: ${{ secrets.CACHETOKEN }}
|
|
reponame: ${{ github.event.repository.name }}
|
|
gituser: ${{ secrets.CACHE_GIT_USER }}
|
|
gituseremail: ${{ secrets.CACHE_GIT_EMAIL }}
|
|
run: |
|
|
mkdir cacherepo
|
|
cd ./cacherepo
|
|
git lfs install
|
|
git config --global user.email "$gituseremail"
|
|
git config --global user.name "$gituser"
|
|
git clone https://$cachetoken@github.com/appsmithorg/cibuildcache.git
|
|
if [ "$reponame" = "appsmith" ]; then export repodir="CE"; fi
|
|
if [ "$reponame" = "appsmith-ee" ]; then export repodir="EE"; fi
|
|
cd cibuildcache/$repodir/release/server
|
|
git lfs install
|
|
git lfs migrate import --everything --yes
|
|
git lfs pull ./server.jar
|
|
mv ./server.jar ../../../../../server.jar
|
|
cd ../../../../../
|
|
tar -xzvf ./server.jar
|
|
|
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
|
- name: Restore the previous bundle
|
|
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
app/server/dist/
|
|
key: ${{ github.run_id }}-${{ github.job }}-server
|
|
|
|
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
|
|
- name: Upload server build bundle
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: server-build
|
|
path: app/server/dist/
|
|
overwrite: true
|
|
|
|
- name: Put release build in cache
|
|
if: success() && github.ref == 'refs/heads/release' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
|
|
env:
|
|
cachetoken: ${{ secrets.CACHETOKEN }}
|
|
reponame: ${{ github.event.repository.name }}
|
|
gituser: ${{ secrets.CACHE_GIT_USER }}
|
|
gituseremail: ${{ secrets.CACHE_GIT_EMAIL }}
|
|
run: |
|
|
pwd
|
|
tar -czvf server.jar dist/
|
|
mkdir cacherepo
|
|
cd ./cacherepo
|
|
git config --global user.email "$gituseremail"
|
|
git config --global user.name "$gituser"
|
|
git clone https://$cachetoken@github.com/appsmithorg/cibuildcache.git
|
|
git lfs install
|
|
cd cibuildcache/
|
|
if [ "$reponame" = "appsmith" ]; then export repodir="CE"; fi
|
|
if [ "$reponame" = "appsmith-ee" ]; then export repodir="EE"; fi
|
|
cd $repodir/release/server
|
|
cp ../../../../../server.jar ./
|
|
git lfs track "server.jar"
|
|
git add server.jar
|
|
git commit --allow-empty -m "Update Latest Server.jar"
|
|
git push
|
|
|
|
- name: Save the status of the run
|
|
run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result
|