ci: Get the newly added files from the PR branch for ts check (#24825)
## Description - Get the newly added files from the PR branch instead of commits for ts check - CI improvements, now added cypress dashboard link with the comments in PR - CI improvements removed the steps which saves un-necessary cache #### Type of change - Workflow file changes ## Testing > #### How Has This Been Tested? - Workflow run
This commit is contained in:
parent
b3f1805e36
commit
45ae5a2995
47
.github/workflows/ci-test.yml
vendored
47
.github/workflows/ci-test.yml
vendored
|
|
@ -66,7 +66,7 @@ jobs:
|
|||
# In case this is second attempt try restoring status of the prior attempt from cache
|
||||
- name: Restore the previous run result
|
||||
id: cache-appsmith
|
||||
uses: martijnhols/actions-cache@v3.0.2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/run_result
|
||||
|
|
@ -79,7 +79,7 @@ jobs:
|
|||
id: run_result
|
||||
run: |
|
||||
run_result_env=$(cat ~/run_result)
|
||||
echo "::set-output name=run_result::$run_result_env"
|
||||
echo "run_result=$run_result_env" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Dump steps context
|
||||
env:
|
||||
|
|
@ -281,6 +281,7 @@ jobs:
|
|||
|
||||
- name: Run the cypress test
|
||||
if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
|
||||
id: cypress_test
|
||||
uses: cypress-io/github-action@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
@ -360,6 +361,7 @@ jobs:
|
|||
# In case of second attempt only run failed specs
|
||||
- name: Run the cypress test with failed tests
|
||||
if: steps.run_result.outputs.run_result == 'failedtest'
|
||||
id: cypress_test_failedtest
|
||||
uses: cypress-io/github-action@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
@ -436,7 +438,7 @@ jobs:
|
|||
- name: Set fail if there are test failures
|
||||
if: failure()
|
||||
run: |
|
||||
echo "::set-output name=run_result::failedtest"
|
||||
echo "run_result=failedtest" >> $GITHUB_OUTPUT
|
||||
echo "failedtest" > ~/run_result
|
||||
|
||||
# Create a directory ~/failed_spec_ci and add a dummy file
|
||||
|
|
@ -471,33 +473,30 @@ jobs:
|
|||
# Force store previous run result to cache
|
||||
- name: Store the previous run result
|
||||
if: failure()
|
||||
uses: martijnhols/actions-cache/save@v3
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: |
|
||||
~/run_result
|
||||
key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
||||
restore-keys: |
|
||||
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
||||
|
||||
- name: get cypress url dashboard url
|
||||
id: dashboard_url
|
||||
if: always()
|
||||
run: |
|
||||
if [[ "${{steps.run_result.outputs.run_result }}" != "success" && "${{steps.run_result.outputs.run_result }}" != "failedtest" ]]; then
|
||||
echo "cypress_url=${{ steps.cypress_test.outputs.resultsUrl }}" >> ~/cypress_url
|
||||
elif [[ "${{steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
|
||||
echo "cypress_url=${{ steps.cypress_test_failedtest.outputs.resultsUrl }}" >> ~/cypress_url
|
||||
fi
|
||||
|
||||
# Force store previous failed test list to cache
|
||||
- name: Store the previous failed test result
|
||||
if: failure()
|
||||
uses: martijnhols/actions-cache/save@v3
|
||||
# Force store previous run result to cache
|
||||
- name: Store the previous run result
|
||||
if: success()
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: |
|
||||
~/failed_spec_ci
|
||||
key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
||||
restore-keys: |
|
||||
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
||||
|
||||
- name: Restore the previous bundle
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
app/client/cypress/snapshots/
|
||||
key: ${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
||||
restore-keys: |
|
||||
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
||||
~/cypress_url
|
||||
key: ${{ github.run_id }}-dashboard-url-${{ github.run_number }}
|
||||
|
||||
# Upload the log artifact so that it can be used by the test & deploy job in the workflow
|
||||
- name: Upload server logs bundle on failure
|
||||
|
|
@ -510,5 +509,5 @@ jobs:
|
|||
# Set status = success
|
||||
- name: Save the status of the run
|
||||
run: |
|
||||
echo "::set-output name=run_result::success"
|
||||
echo "run_result=success" >> $GITHUB_OUTPUT
|
||||
echo "success" > ~/run_result
|
||||
|
|
|
|||
69
.github/workflows/client-build.yml
vendored
69
.github/workflows/client-build.yml
vendored
|
|
@ -66,42 +66,43 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# # get all the files changes in the cypress/e2e folder
|
||||
# - name: Get changed files in the cypress/e2e folder
|
||||
# if: inputs.check-test-files == 'true'
|
||||
# id: files
|
||||
# uses: tj-actions/changed-files@v36
|
||||
# with:
|
||||
# base_sha: ${{ github.event.client_payload.pull_request.base.sha }}
|
||||
# files: app/client/cypress/e2e
|
||||
# get all the files changes in the cypress/e2e folder
|
||||
- name: Get added files in cypress/e2e folder
|
||||
if: inputs.pr != 0
|
||||
id: files
|
||||
uses: umani/changed-files@v4.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.APPSMITH_CI_TEST_PAT }}
|
||||
pattern: 'app/client/cypress/e2e/.*'
|
||||
pr-number: ${{ inputs.pr }}
|
||||
|
||||
# # Check all the newly added files are in ts
|
||||
# - name: Check the newly added files are written in ts
|
||||
# if: inputs.check-test-files == 'true'
|
||||
# id: check_files
|
||||
# run: |
|
||||
# files=(${{steps.files.outputs.added_files}})
|
||||
# non_ts_files=()
|
||||
# for file in "${files[@]}"; do
|
||||
# if [[ $file != *.ts ]]; then
|
||||
# non_ts_files+=("<li>$file")
|
||||
# fi
|
||||
# done
|
||||
# echo "non_ts_files=${non_ts_files[@]}" >> $GITHUB_OUTPUT
|
||||
# echo "non_ts_files_count=${#non_ts_files[@]}" >> $GITHUB_OUTPUT
|
||||
# Check all the newly added files are in ts
|
||||
- name: Check the newly added files are written in ts
|
||||
if: inputs.check-test-files == 'true' && inputs.pr != 0
|
||||
id: check_files
|
||||
run: |
|
||||
files=(${{steps.files.outputs.files_created}})
|
||||
non_ts_files=()
|
||||
for file in "${files[@]}"; do
|
||||
if [[ $file != *.ts ]]; then
|
||||
non_ts_files+=("<li>$file")
|
||||
fi
|
||||
done
|
||||
echo "non_ts_files=${non_ts_files[@]}" >> $GITHUB_OUTPUT
|
||||
echo "non_ts_files_count=${#non_ts_files[@]}" >> $GITHUB_OUTPUT
|
||||
|
||||
# # Comment in PR if test files are not written in ts and fail the workflow
|
||||
# - name: Comment in PR if test files are not written in ts
|
||||
# if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true'
|
||||
# uses: peter-evans/create-or-update-comment@v1
|
||||
# with:
|
||||
# issue-number: ${{ github.event.client_payload.pull_request.number }}
|
||||
# body: |
|
||||
# <b>Below new test files are written in js 🔴 </b>
|
||||
# <b>Expected format ts. Please fix and retrigger ok-to-test:</b>
|
||||
# <ol>${{ steps.check_files.outputs.non_ts_files }}</ol>
|
||||
# - if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true'
|
||||
# run: exit 1
|
||||
# Comment in PR if test files are not written in ts and fail the workflow
|
||||
- name: Comment in PR if test files are not written in ts
|
||||
if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
issue-number: ${{ inputs.pr }}
|
||||
body: |
|
||||
<b>Below new test files are written in js 🔴 </b>
|
||||
<b>Expected format ts. Please fix and retrigger ok-to-test:</b>
|
||||
<ol>${{ steps.check_files.outputs.non_ts_files }}</ol>
|
||||
- if: steps.check_files.outputs.non_ts_files_count != 0 && inputs.check-test-files == 'true' && inputs.pr != 0
|
||||
run: exit 1
|
||||
|
||||
# Create a run record exactly at the time of merge to release to
|
||||
# ensure we compare run details with code at this point
|
||||
|
|
|
|||
33
.github/workflows/integration-tests-command.yml
vendored
33
.github/workflows/integration-tests-command.yml
vendored
|
|
@ -140,6 +140,23 @@ jobs:
|
|||
run: |
|
||||
rm -f ~/failed_spec_ci
|
||||
rm -f ~/combined_failed_spec_ci
|
||||
|
||||
# Force store previous cypress dashboard url from cache
|
||||
- name: Store the previous cypress dashboard url
|
||||
if: success()
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/cypress_url
|
||||
key: ${{ github.run_id }}-dashboard-url-${{ github.run_number }}
|
||||
restore-keys: |
|
||||
${{ github.run_id }}-dashboard-url
|
||||
|
||||
- name: Print cypress dashboard url
|
||||
id: dashboard_url
|
||||
run: |
|
||||
cypress_url = $(cat ~/cypress_url)
|
||||
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
|
||||
|
||||
# Download failed_spec list for all jobs
|
||||
- uses: actions/download-artifact@v3
|
||||
|
|
@ -156,17 +173,6 @@ jobs:
|
|||
echo "Debugging: failed specs in ~/failed_spec_ci/failed_spec_ci*"
|
||||
cat ~/failed_spec_ci/failed_spec_ci*
|
||||
cat ~/failed_spec_ci/failed_spec_ci* | sort -u >> ~/combined_failed_spec_ci
|
||||
|
||||
# Force save the CI failed spec list into a cache
|
||||
- name: Store the combined run result for CI
|
||||
if: needs.ci-test.result != 'success'
|
||||
uses: martijnhols/actions-cache/save@v3
|
||||
with:
|
||||
path: |
|
||||
~/combined_failed_spec_ci
|
||||
key: ${{ github.run_id }}-"ci-test-result"
|
||||
restore-keys: |
|
||||
${{ github.run_id }}-${{ github.job }}
|
||||
|
||||
# Upload combined failed CI spec list to a file
|
||||
# This is done for debugging.
|
||||
|
|
@ -201,6 +207,7 @@ jobs:
|
|||
body: |
|
||||
Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
|
||||
Commit: `${{ github.event.client_payload.slash_command.args.named.sha }}`.
|
||||
Cypress dashboard: `<a href="${{ steps.dashboard_url.outputs.dashboard_url }}" target="_blank"> Click here! </a>`
|
||||
The following are new failures, please fix them before merging the PR: ${{env.new_failed_spec_env}}
|
||||
To know the list of identified flaky tests - <a href="https://app.appsmith.com/applications/613868bedd7786286ddd4a6a/pages/63ec710e8e503f763651791a" target="_blank">Refer here</a>
|
||||
|
||||
|
|
@ -212,8 +219,8 @@ jobs:
|
|||
body: |
|
||||
Workflow run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
|
||||
Commit: `${{ github.event.client_payload.slash_command.args.named.sha }}`.
|
||||
All cypress tests have passed 🎉
|
||||
|
||||
Cypress dashboard url: `<a href="${{ steps.dashboard_url.outputs.dashboard_url }}" target="_blank">Click here!</a>`
|
||||
All cypress tests have passed 🎉🎉🎉
|
||||
|
||||
# Update check run called "ci-test-result"
|
||||
- name: Mark ci-test-result job as complete
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user