Skip to content

Commit

Permalink
Merge the latest develop-postgres to develop for Cloud instance (#3183)
Browse files Browse the repository at this point in the history
* 20250105213148 Deleted all files in the develop branch in anticipation of merging develop-postgres into develop cleanly

* 20250105213246 Merge develop-postgres into develop
  • Loading branch information
palisadoes authored Jan 6, 2025
1 parent 9435090 commit f30baa5
Show file tree
Hide file tree
Showing 161 changed files with 8,046 additions and 4,338 deletions.
8 changes: 0 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,5 @@
"docs/sidebars.ts",
"docs/src/**",
"docs/blog/**"
],
"overrides": [
{
"files": ["*.js", "*.jsx"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ updates:
labels:
- "dependencies"
# Specify the target branch for PRs
target-branch: "develop"
target-branch: "develop-postgres"
# Customize commit message prefix
commit-message:
prefix: "chore(deps):"
14 changes: 7 additions & 7 deletions .github/workflows/auto-label.json5
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"labelsSynonyms": {
"dependencies": ["dependabot", "dependency", "dependencies"],
"security": ["security"],
"ui/ux": ["layout", "screen", "design", "figma"]
},
"defaultLabels": ["unapproved"],
{
"labelsSynonyms": {
"dependencies": ["dependabot", "dependency", "dependencies"],
"security": ["security"],
"ui/ux": ["layout", "screen", "design", "figma"]
},
"defaultLabels": ["unapproved"],
}
65 changes: 65 additions & 0 deletions .github/workflows/merge-conflict-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Merge Conflict Check Workflow

on:
pull_request:
branches:
- '**'
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
Merge-Conflict-Check:
name: Check for Merge Conflicts
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Check Mergeable Status via Github API
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
max_retries=3
retry_delay=5
for ((i=1; i<=max_retries; i++)); do
echo "Attempt $i of $max_retries"
if ! response=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER" --jq '.mergeable'); then
if [[ $response == *"rate limit exceeded"* ]]; then
echo "Rate limit exceeded. Waiting before retry..."
sleep 60 # Wait longer for rate limit
else
echo "Failed to call GitHub API: $response"
if [ $i -eq $max_retries ]; then
echo "Maximum retries reached. Exiting."
exit 1
fi
sleep $retry_delay
fi
continue
fi
case "$response" in
"true")
echo "No conflicts detected."
exit 0
;;
"false")
echo "Merge conflicts detected."
exit 1
;;
*)
echo "Mergeable status unknown: $response"
if [ $i -eq $max_retries ]; then
echo "Maximum retries reached. Exiting."
exit 1
fi
sleep $retry_delay
;;
esac
done
87 changes: 36 additions & 51 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:

- name: Count number of lines
run: |
chmod +x ./.github/workflows/countline.py
./.github/workflows/countline.py --lines 600 --exclude_files src/screens/LoginPage/LoginPage.tsx src/GraphQl/Queries/Queries.ts src/screens/OrgList/OrgList.tsx src/GraphQl/Mutations/mutations.ts src/components/EventListCard/EventListCardModals.tsx src/components/TagActions/TagActionsMocks.ts src/utils/interfaces.ts src/screens/MemberDetail/MemberDetail.tsx
chmod +x ./.github/workflows/scripts/countline.py
./.github/workflows/scripts/countline.py --lines 600 --exclude_files src/screens/LoginPage/LoginPage.tsx src/GraphQl/Queries/Queries.ts src/screens/OrgList/OrgList.tsx src/GraphQl/Mutations/mutations.ts src/components/EventListCard/EventListCardModals.tsx src/components/TagActions/TagActionsMocks.ts src/utils/interfaces.ts src/screens/MemberDetail/MemberDetail.tsx
- name: Get changed TypeScript files
id: changed-files
Expand Down Expand Up @@ -71,8 +71,8 @@ jobs:
- name: Compare translation files
run: |
chmod +x .github/workflows/compare_translations.py
python .github/workflows/compare_translations.py --directory public/locales
chmod +x .github/workflows/scripts/compare_translations.py
python .github/workflows/scripts/compare_translations.py --directory public/locales
- name: Check if the source and target branches are different
if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }}
Expand All @@ -97,6 +97,8 @@ jobs:
with:
files: |
.env*
vitest.config.js
src/App.tsx
.github/**
env.example
.node-version
Expand All @@ -112,7 +114,6 @@ jobs:
.eslintignore
.prettierrc
.prettierignore
.nojekyll
vite.config.ts
docker-compose.yaml
Dockerfile
Expand All @@ -134,6 +135,11 @@ jobs:
*.password
*.secret
*.credentials
.nojekyll
yarn.lock
docs/docusaurus.config.ts
docs/sidebar*
CNAME
- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
Expand Down Expand Up @@ -193,7 +199,7 @@ jobs:

- name: Run Python script
run: |
python .github/workflows/eslint_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
Check-Code-Coverage-Disable:
name: Check for code coverage disable
Expand All @@ -213,7 +219,7 @@ jobs:

- name: Run Python script
run: |
python .github/workflows/code_coverage_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
python .github/workflows/scripts/code_coverage_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
Test-Application:
name: Test Application
Expand Down Expand Up @@ -336,20 +342,8 @@ jobs:
echo $! > .pidfile_prod
- name: Check if Production App is running
run: |
timeout=120
echo "Starting production health check with ${timeout}s timeout"
while ! nc -z localhost 4173 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Still waiting for production app to start... ${timeout}s remaining"
fi
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for production application to start"
exit 1
fi
echo "Production app started successfully"
chmod +x .github/workflows/scripts/app_health_check.sh
.github/workflows/scripts/app_health_check.sh 4173 120
- name: Stop Production App
run: |
if [ -f .pidfile_prod ]; then
Expand All @@ -361,20 +355,8 @@ jobs:
echo $! > .pidfile_dev
- name: Check if Development App is running
run: |
timeout=120
echo "Starting development health check with ${timeout}s timeout"
while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Still waiting for development app to start... ${timeout}s remaining"
fi
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for development application to start"
exit 1
fi
echo "Development app started successfully"
chmod +x .github/workflows/scripts/app_health_check.sh
.github/workflows/scripts/app_health_check.sh 4321 120
- name: Stop Development App
if: always()
run: |
Expand Down Expand Up @@ -410,22 +392,8 @@ jobs:
echo "Docker container started successfully"
- name: Check if Talawa Admin App is running
run: |
timeout="${HEALTH_CHECK_TIMEOUT:-120}"
echo "Starting health check with ${timeout}s timeout"
while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Still waiting for app to start... ${timeout}s remaining"
fi
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for application to start"
echo "Container logs:"
docker logs talawa-admin-app-container
exit 1
fi
echo "Port check passed, verifying health endpoint..."
chmod +x .github/workflows/scripts/app_health_check.sh
.github/workflows/scripts/app_health_check.sh 4321 120 true
- name: Stop Docker Container
if: always()
run: |
Expand Down Expand Up @@ -464,3 +432,20 @@ jobs:
echo "Error: Pull request target branch must be 'develop-postgres'. Please refer PR_GUIDELINES.md"
echo "Error: Close this PR and try again."
exit 1
Validate-Coderabbit:
name: Validate CodeRabbit Approval
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
needs: [Test-Docusaurus-Deployment]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate CodeRabbit.ai Approval
run: |
chmod +x $GITHUB_WORKSPACE/.github/workflows/scripts/validate-coderabbit.sh
$GITHUB_WORKSPACE/.github/workflows/scripts/validate-coderabbit.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}
6 changes: 3 additions & 3 deletions .github/workflows/push-deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: PUSH Workflow - Website Deployment
on:
push:
branches:
- 'develop'
- 'develop-postgres'

env:
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
Expand All @@ -23,7 +23,7 @@ jobs:
Deploy-Docusaurus:
name: Deploy https://docs-admin.talawa.io website
runs-on: ubuntu-latest
# Run only if the develop branch and not dependabot
# Run only if the develop-postgres branch and not dependabot
if: ${{ github.actor != 'dependabot[bot]' }}
environment:
# This "name" has to be the repos' branch that contains
Expand All @@ -32,7 +32,7 @@ jobs:
# "Code and automation > Environments > gigithub-pages"
# menu. The branch "name" must match the branch in the
# "on.push.branches" section at the top of this file
name: develop
name: develop-postgres
url: https://docs-admin.talawa.io
steps:
- uses: actions/checkout@v4
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/scripts/app_health_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# This script performs a health check to ensure an application is running on a specified port.
# The script uses netcat (nc) to check if the port is open, with a configurable timeout.
# It also includes optional logic to fetch Docker container logs if the health check fails during a Docker-based test.

# Variables:
# port="$1" - The port to check (passed as the first argument to the script).
# timeout="${2:-120}" - The maximum time in seconds to wait for the application to start. Defaults to 120 seconds if not provided.
# is_docker_test="${3:-false}" - A flag to indicate whether the script is being run in a Docker-based test. Defaults to false.

# Logic:
# 1. Print a message indicating the start of the health check.
# 2. Enter a loop to repeatedly check if the port is open using `nc -z localhost "${port}"`.
# - If the port is not open and the timeout has not expired, sleep for 1 second and decrement the timeout.
# - Print a status message every 10 seconds with the remaining time.
# 3. If the timeout expires, print an error message and, if in Docker test mode, fetch Docker logs for debugging.
# 4. If the port is detected as open, print a success message and exit.

# Script:

port="$1"
timeout="${2:-120}"
is_docker_test="${3:-false}"


# Validate required port parameter
if [ -z "${port}" ] || ! [[ "${port}" =~ ^[0-9]+$ ]] || [ "${port}" -lt 1 ] || [ "${port}" -gt 65535 ]; then
echo "Error: Invalid or missing port number. Must be between 1-65535"
exit 1
fi

# Validate timeout parameter
if ! [[ "${timeout}" =~ ^[0-9]+$ ]] || [ "${timeout}" -lt 1 ]; then
echo "Error: Invalid timeout value. Must be a positive integer"
exit 1
fi

# Validate is_docker_test parameter
if [ "${is_docker_test}" != "true" ] && [ "${is_docker_test}" != "false" ]; then
echo "Error: is_docker_test must be either 'true' or 'false'"
exit 1
fi

echo "Starting health check with ${timeout}s timeout"
while [ "${timeout}" -gt 0 ]; do
if nc -z localhost "${port}" 2>/dev/null; then
break
elif [ $? -ne 1 ]; then
echo "Error: Failed to check port ${port} (nc command failed)"
exit 1
fi
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Waiting for app to start on port ${port}... ${timeout}s remaining"
# Try to get more information about the port status
netstat -an | grep "${port}" || true
fi
done

if [ "${timeout}" -eq 0 ]; then
echo "Error: Timeout waiting for application to start on port ${port}"
echo "System port status:"
netstat -an | grep "${port}" || true
if [ "${is_docker_test}" = "true" ]; then
echo "Fetching Docker container logs..."
if ! docker logs talawa-admin-app-container; then
echo "Error: Failed to fetch logs from container talawa-admin-app-container"
fi
fi
exit 1
fi
echo "App started successfully on port ${port}"

File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f30baa5

Please sign in to comment.