From 33b073dd30db4eec9fc923ab9c202312ad2f70ee Mon Sep 17 00:00:00 2001 From: yatinappsmith <84702014+yatinappsmith@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:57:05 +0530 Subject: [PATCH] CI: Added Cache for Server Build (#29775) ## Description Added cache for server #### PR fixes following issue(s) #### Media #### Type of change - New feature (non-breaking change which adds functionality) ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed ## Summary by CodeRabbit - **New Features** - Implemented caching for release builds to enhance efficiency and speed up the deployment process. - **Chores** - Updated build workflow with additional steps for caching operations. - **Documentation** - Confirmed no changes to public API documentation are needed as this update does not alter exported entities. --- .github/workflows/server-build.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 273a67de21..47d3b36706 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -228,5 +228,31 @@ jobs: name: server-build path: app/server/dist/ + - name: Put release build in cache + if: success() && github.ref == 'refs/heads/release' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') + 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 testcacherepo/ + 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 -m "Update Latest Server.jar" + git push + - name: Save the status of the run run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result