Skip to content

Commit

Permalink
chore: merge release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sharat87 committed Sep 27, 2023
2 parents 35d0e74 + 2f5405d commit 1d80657
Show file tree
Hide file tree
Showing 502 changed files with 13,195 additions and 5,126 deletions.
156 changes: 96 additions & 60 deletions .github/workflows/build-client-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,45 +186,63 @@ jobs:
run:
shell: bash
steps:
# Deleting the existing dir's if any
- name: Delete existing directories
- name: Setup node
if: needs.ci-test-limited.result != 'success'
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
uses: actions/setup-node@v3
with:
path: |
~/cypress_url
key: ${{ github.run_id }}-dashboard-url-${{ github.run_attempt }}
restore-keys: |
${{ github.run_id }}-dashboard-url
- name: Print cypress dashboard url
id: dashboard_url
run: |
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
node-version: 18

- name: install pg
if: needs.ci-test-limited.result != 'success'
run : npm install pg

# Download failed_spec list for all jobs
- uses: actions/download-artifact@v3
- name: Fetch the failed specs
if: needs.ci-test-limited.result != 'success'
id: download_ci
id: failed_specs
env:
DB_HOST: ${{ secrets.CYPRESS_DB_HOST }}
DB_NAME: ${{ secrets.CYPRESS_DB_NAME }}
DB_USER: ${{ secrets.CYPRESS_DB_USER }}
DB_PWD: ${{ secrets.CYPRESS_DB_PWD }}
RUN_ID: ${{ github.run_id }}
ATTEMPT_NUMBER: ${{ github.run_attempt }}
uses: actions/github-script@v6
with:
name: failed-spec-ci-${{github.run_attempt}}
path: ~/failed_spec_ci
script: |
const { Pool } = require("pg");
const { DB_HOST, DB_NAME, DB_USER, DB_PWD, RUN_ID, ATTEMPT_NUMBER } = process.env
const client = await new Pool({
user: DB_USER,
host: DB_HOST,
database: DB_NAME,
password: DB_PWD,
port: 5432,
connectionTimeoutMillis: 60000,
}).connect();
const result = await client.query(
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
WHERE "attemptId" = (
SELECT id FROM public."attempt" WHERE "workflowId" = $1 and "attempt" = $2
)
) AND status = 'fail'`,
[RUN_ID, ATTEMPT_NUMBER],
);
client.release();
return result.rows.map((spec) => spec.name);
# In case for any ci job failure, create combined failed spec
- name: "combine all specs for CI"
- name: combine all specs for CI
id: combine_ci
if: needs.ci-test-limited.result != 'success'
run: |
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
failed_specs=$(echo ${{steps.failed_specs.outputs.result}} | sed 's/\[\|\]//g' | tr -d ' ' | tr ',' '\n')
while read -r line; do
echo "$line" >> ~/combined_failed_spec_ci
done <<< "$failed_specs"
# Upload combined failed CI spec list to a file
# This is done for debugging.
Expand Down Expand Up @@ -285,45 +303,63 @@ jobs:
run:
shell: bash
steps:
# Deleting the existing dir's if any
- name: Delete existing directories
- name: Setup node
if: needs.ci-test-limited-existing-docker-image.result != 'success'
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
uses: actions/setup-node@v3
with:
path: |
~/cypress_url
key: ${{ github.run_id }}-dashboard-url-${{ github.run_attempt }}
restore-keys: |
${{ github.run_id }}-dashboard-url
- name: Print cypress dashboard url
id: dashboard_url
run: |
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
node-version: 18

- name: install pg
if: needs.ci-test-limited-existing-docker-image.result != 'success'
run : npm install pg

# Download failed_spec list for all jobs
- uses: actions/download-artifact@v3
- name: Fetch the failed specs
if: needs.ci-test-limited-existing-docker-image.result != 'success'
id: download_ci
id: failed_specs
env:
DB_HOST: ${{ secrets.CYPRESS_DB_HOST }}
DB_NAME: ${{ secrets.CYPRESS_DB_NAME }}
DB_USER: ${{ secrets.CYPRESS_DB_USER }}
DB_PWD: ${{ secrets.CYPRESS_DB_PWD }}
RUN_ID: ${{ github.run_id }}
ATTEMPT_NUMBER: ${{ github.run_attempt }}
uses: actions/github-script@v6
with:
name: failed-spec-ci-${{github.run_attempt}}
path: ~/failed_spec_ci
script: |
const { Pool } = require("pg");
const { DB_HOST, DB_NAME, DB_USER, DB_PWD, RUN_ID, ATTEMPT_NUMBER } = process.env
const client = await new Pool({
user: DB_USER,
host: DB_HOST,
database: DB_NAME,
password: DB_PWD,
port: 5432,
connectionTimeoutMillis: 60000,
}).connect();
const result = await client.query(
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
WHERE "attemptId" = (
SELECT id FROM public."attempt" WHERE "workflowId" = $1 and "attempt" = $2
)
) AND status = 'fail'`,
[RUN_ID, ATTEMPT_NUMBER],
);
client.release();
return result.rows.map((spec) => spec.name);
# In case for any ci job failure, create combined failed spec
- name: "combine all specs for CI"
- name: combine all specs for CI
id: combine_ci
if: needs.ci-test-limited-existing-docker-image.result != 'success'
run: |
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
failed_specs=$(echo ${{steps.failed_specs.outputs.result}} | sed 's/\[\|\]//g' | tr -d ' ' | tr ',' '\n')
while read -r line; do
echo "$line" >> ~/combined_failed_spec_ci
done <<< "$failed_specs"
# Upload combined failed CI spec list to a file
# This is done for debugging.
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/ci-test-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: failed_spec_ci
path: ~/failed_spec_ci
path: ~/failed_specs

# failed_spec_env will contain list of all failed specs
# We are using environment variable instead of regular to support multiline
Expand All @@ -122,7 +122,7 @@ jobs:
fi
done
fi
done < ~/failed_spec_ci/failed_spec_ci
done < ~/failed_specs/failed_spec_ci
failed_spec_env=${failed_spec_env#,}
echo "failed_spec_env=$failed_spec_env" >> $GITHUB_ENV
Expand Down Expand Up @@ -221,6 +221,7 @@ jobs:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
echo "${{env.BROWSER_PATH}}"
# - name: Set Pull Request Title
# env:
Expand Down Expand Up @@ -329,7 +330,6 @@ jobs:
CYPRESS_S3_ACCESS: ${{ secrets.CYPRESS_S3_ACCESS }}
CYPRESS_S3_SECRET: ${{ secrets.CYPRESS_S3_SECRET }}
with:
browser: ${{ env.BROWSER_PATH }}
install: false
config-file: cypress_ci_hosted.config.ts
working-directory: app/client
Expand Down Expand Up @@ -400,7 +400,6 @@ jobs:
CYPRESS_S3_ACCESS: ${{ secrets.CYPRESS_S3_ACCESS }}
CYPRESS_S3_SECRET: ${{ secrets.CYPRESS_S3_SECRET }}
with:
browser: ${{ env.BROWSER_PATH }}
install: false
config-file: cypress_ci_hosted.config.ts
working-directory: app/client
Expand Down Expand Up @@ -457,16 +456,6 @@ jobs:
~/run_result
key: ${{ github.run_id }}-${{ github.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 "" >> $GITHUB_OUTPUT
# elif [[ "${{steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
# echo "" >> $GITHUB_OUTPUT
# fi

- name: Generate slack message
continue-on-error: true
if: always()
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ jobs:
elif [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'workflow_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=Workflow run on PR# ${{ inputs.pr }}" >> $GITHUB_ENV
else
if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then
if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by ${{ env.COMMIT_INFO_AUTHOR }}" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV
Expand Down Expand Up @@ -507,7 +507,6 @@ jobs:
COMMITTER: ${{ env.COMMIT_INFO_AUTHOR }}
TAG: ${{ github.event_name }}
BRANCH: ${{ env.COMMIT_INFO_BRANCH }}
TOTAL_RUNNERS: ${{ strategy.job-total }}
THIS_RUNNER: ${{ strategy.job-index }}
CYPRESS_SPECS: ${{ env.failed_spec_env }}
CYPRESS_DB_USER: ${{ secrets.CYPRESS_DB_USER }}
Expand Down
92 changes: 59 additions & 33 deletions .github/workflows/integration-tests-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,48 +95,63 @@ jobs:
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
run: echo "$PAYLOAD_CONTEXT"

# Deleting the existing dir's if any
- name: Delete existing directories
- name: Setup node
if: needs.ci-test.result != 'success'
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
continue-on-error: true
if: success()
uses: actions/cache@v3
uses: actions/setup-node@v3
with:
path: |
~/cypress_url
key: ${{ github.run_id }}-dashboard-url-${{ github.run_attempt }}
restore-keys: |
${{ github.run_id }}-dashboard-url
- name: Print cypress dashboard url
continue-on-error: true
id: dashboard_url
run: |
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
node-version: 18

- name: install pg
if: needs.ci-test.result != 'success'
run : npm install pg

# Download failed_spec list for all jobs
- uses: actions/download-artifact@v3
- name: Fetch the failed specs
if: needs.ci-test.result != 'success'
id: download_ci
id: failed_specs
env:
DB_HOST: ${{ secrets.CYPRESS_DB_HOST }}
DB_NAME: ${{ secrets.CYPRESS_DB_NAME }}
DB_USER: ${{ secrets.CYPRESS_DB_USER }}
DB_PWD: ${{ secrets.CYPRESS_DB_PWD }}
RUN_ID: ${{ github.run_id }}
ATTEMPT_NUMBER: ${{ github.run_attempt }}
uses: actions/github-script@v6
with:
name: failed-spec-ci-${{github.run_attempt}}
path: ~/failed_spec_ci
script: |
const { Pool } = require("pg");
const { DB_HOST, DB_NAME, DB_USER, DB_PWD, RUN_ID, ATTEMPT_NUMBER } = process.env
const client = await new Pool({
user: DB_USER,
host: DB_HOST,
database: DB_NAME,
password: DB_PWD,
port: 5432,
connectionTimeoutMillis: 60000,
}).connect();
const result = await client.query(
`SELECT DISTINCT name FROM public."specs"
WHERE "matrixId" IN
(SELECT id FROM public."matrix"
WHERE "attemptId" = (
SELECT id FROM public."attempt" WHERE "workflowId" = $1 and "attempt" = $2
)
) AND status = 'fail'`,
[RUN_ID, ATTEMPT_NUMBER],
);
client.release();
return result.rows.map((spec) => spec.name);
# In case for any ci job failure, create combined failed spec
- name: combine all specs for CI
id: combine_ci
if: needs.ci-test.result != 'success'
run: |
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
failed_specs=$(echo ${{steps.failed_specs.outputs.result}} | sed 's/\[\|\]//g' | tr -d ' ' | tr ',' '\n')
while read -r line; do
echo "$line" >> ~/combined_failed_spec_ci
done <<< "$failed_specs"
if [[ -z $(grep '[^[:space:]]' ~/combined_failed_spec_ci) ]] ; then
echo "specs_failed=0" >> $GITHUB_OUTPUT
else
Expand All @@ -156,7 +171,7 @@ jobs:
shell: bash
run: |
curl --request POST --url https://yatin-s-workspace-jk8ru5.us-east-1.xata.sh/db/CypressKnownFailures:main/tables/CypressKnownFailuires/query --header 'Authorization: Bearer ${{ secrets.XATA_TOKEN }}' --header 'Content-Type: application/json'|jq -r |grep Spec|cut -d ':' -f 2 2> /dev/null|sed 's/"//g'|sed 's/,//g' > ~/knownfailures
# Verify CI test failures against known failures
- name: Verify CI test failures against known failures
if: needs.ci-test.result != 'success'
Expand All @@ -180,8 +195,19 @@ jobs:
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>
- name: Add a comment on the PR when ci-test is failed but no specs found
if: needs.ci-test.result != 'success' && steps.combine_ci.outputs.specs_failed == '0'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
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 url: <a href="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}" target="_blank">Click here!</a>
It seems like there are some failures 😔. We are not able to recognize it, please check this manually <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" target="_blank">here.</a>
- name: Add a comment on the PR when ci-test is success
if: needs.ci-test.result == 'success' || steps.combine_ci.outputs.specs_failed == '0'
if: needs.ci-test.result == 'success' && steps.combine_ci.outputs.specs_failed == '0'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
EVENT_COMMITS: ${{ toJson(github.event.commits[0].message) }}
run: |
eventCommit=$(echo ${{env.EVENT_COMMITS}} | sed "s/'//g")
echo "slack_username=$(echo "$eventCommit" | awk -F '\\\\n' '{print $1}' | sed 's/^"//;s/"$//')" >> $GITHUB_ENV
echo "slack_username=$(echo "$eventCommit" | awk -F '\\\\n' '{print $1}' | sed 's/^"//;s/"$//')" >> $GITHUB_OUTPUT
if [[ ${{ needs.ci-test.result }} == 'failure' ]]; then
echo "slack_message=There are test failures in the run. Cypress Dashboard: <https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail|Click here!>" >> $GITHUB_OUTPUT
echo "slack_color=#FF0000" >> $GITHUB_OUTPUT
Expand Down
Loading

0 comments on commit 1d80657

Please sign in to comment.