Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
amitb0ra authored Nov 30, 2024
2 parents d3a00c2 + 7a991b3 commit 9b2e55c
Show file tree
Hide file tree
Showing 16 changed files with 387 additions and 47 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
node_modules
npm-debug.log
Dockerfile
.git
.gitignore
.env
.env.*
dist
coverage
.nyc_output
*.md
.github
tests
__tests__
*.test.*
*.spec.*
# Development files
*.log
*.lock
.DS_Store
.idea
.vscode
# Build artifacts
build
out
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"import/no-duplicates": "error",
"tsdoc/syntax": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
Expand Down
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Fixes #<!--Add related issue number here.-->

**Did you add tests for your changes?**

**Snapshots/Videos:**

<!--Add snapshots or videos wherever possible.-->


<!--Yes or No. Note: Add unit tests or automation tests for your code.-->

**Snapshots/Videos:**
Expand All @@ -44,6 +49,19 @@ Fixes #<!--Add related issue number here.-->

<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

## Checklist

### CodeRabbit AI Review
- [ ] I have reviewed and addressed all critical issues flagged by CodeRabbit AI
- [ ] I have implemented or provided justification for each non-critical suggestion
- [ ] I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

### Test Coverage
- [ ] I have written tests for all new changes/features
- [ ] I have verified that test coverage meets or exceeds 95%
- [ ] I have run the test suite locally and all tests pass


**Other information**

<!--Add extra information about this PR here-->
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pull-request-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ jobs:
comment_tag: pr_review_policy
message: |
## Our Pull Request Approval Process
Thanks for contributing!
### Testing Your Code
Remember, your PRs won't be reviewed until these criteria are met:
1. We don't merge PRs with poor code quality.
1. Follow coding best practices such that CodeRabbit.ai approves your PR.
1. We don't merge PRs with failed tests.
Expand Down
89 changes: 73 additions & 16 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Check formatting
if: steps.changed-files.outputs.only_changed != 'true'
run: npm run format:check

- name: Run formatting if check fails
if: failure()
run: npm run format
Expand All @@ -57,10 +57,9 @@ jobs:

- name: Check for linting errors in modified files
if: steps.changed-files.outputs.only_changed != 'true'
env:
env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py

- name: Check for TSDoc comments
run: npm run check-tsdoc # Run the TSDoc check script

Expand Down Expand Up @@ -89,7 +88,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Changed Unauthorized files
id: changed-unauth-files
uses: tj-actions/changed-files@v40
Expand Down Expand Up @@ -123,10 +121,10 @@ jobs:
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md
- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
env:
env:
CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }}
run: |
for file in ${CHANGED_UNAUTH_FILES}; do
Expand All @@ -147,7 +145,7 @@ jobs:
uses: tj-actions/changed-files@v40

- name: Echo number of changed files
env:
env:
CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }}
run: |
echo "Number of files changed: $CHANGED_FILES_COUNT"
Expand Down Expand Up @@ -194,23 +192,23 @@ jobs:

- name: Install Dependencies
run: npm install

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v40

- name: Run tests
if: steps.changed-files.outputs.only_changed != 'true'
run: npm run test -- --watchAll=false --coverage
run: npm run test -- --watchAll=false --coverage

- name: TypeScript compilation for changed files
run: |
for file in ${{ steps.changed-files.outputs.all_files }}; do
if [[ "$file" == *.ts || "$file" == *.tsx ]]; then
npx tsc --noEmit "$file"
fi
done
- name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}}
uses: codecov/codecov-action@v4
with:
Expand All @@ -222,7 +220,7 @@ jobs:
- name: Test acceptable level of code coverage
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: "./coverage/lcov.info"
path: './coverage/lcov.info'
min_coverage: 95.0

Graphql-Inspector:
Expand All @@ -240,19 +238,75 @@ jobs:

- name: resolve dependency
run: npm install -g @graphql-inspector/cli

- name: Clone API Repository
run: |
# Retrieve the complete branch name directly from the GitHub context
FULL_BRANCH_NAME=${{ github.base_ref }}
echo "FULL_Branch_NAME: $FULL_BRANCH_NAME"
# Clone the specified repository using the extracted branch name
git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a
git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a
- name: Validate Documents
run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql'

Docker-Start-Check:
name: Check if Talawa Admin app starts in Docker
runs-on: ubuntu-latest
needs: [Code-Quality-Checks, Test-Application]
if: github.actor != 'dependabot'
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:latest
- name: Build Docker image
run: |
set -e
echo "Building Docker image..."
docker build -t talawa-admin-app .
echo "Docker image built successfully"
- name: Run Docker Container
run: |
set -e
echo "Started Docker container..."
docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app
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..."
- name: Stop Docker Container
if: always()
run: |
docker stop talawa-admin-app-container
docker rm talawa-admin-app-container
Check-Target-Branch:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Check Target Branch
Expand All @@ -262,4 +316,7 @@ jobs:
if: github.event.pull_request.base.ref != 'develop'
run: |
echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md"
if: github.event.pull_request.base.ref != 'develop-postgres'
run: |
echo "Error: Pull request target branch must be 'develop-postgres'. Please refer PR_GUIDELINES.md"
exit 1
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/talawa-admin.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:20.10.0 AS build

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

EXPOSE 4321

CMD ["npm", "run", "serve"]
44 changes: 41 additions & 3 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ This document provides instructions on how to set up and start a running instanc
- [Husky for Git Hooks](#husky-for-git-hooks)
- [pre-commit hook](#pre-commit-hook)
- [post-merge hook](#post-merge-hook)
- [Installation using Docker](#installation-using-docker)
- [Prerequisites](#prerequisites-1)
- [Development Setup](#development-setup)

<!-- tocstop -->

Expand Down Expand Up @@ -145,15 +148,50 @@ npm install
The prerequisites are now installed. The next step will be to get the app up and running.
# Installation using Docker
## Prerequisites
1. Install Docker on your system:
- [Docker Desktop for Windows/Mac](https://www.docker.com/products/docker-desktop)
- [Docker Engine for Linux](https://docs.docker.com/engine/install/)
### Development Setup
If you prefer to use Docker, you can install the app using the following command:
1. Create a `.env` file as described in the Configuration section
2. Build the Docker Image:
Run the following command to build the Docker image:
````bash
docker build -t talawa-admin .
```bash
3. Run the Docker container:
After the build is complete, run the Docker container using this command:
```bash
docker run -p 4321:4321 talawa-admin
```bash
The application will be accessible at `http://localhost:4321`
# Configuration
It's important to configure Talawa-Admin. Here's how to do it.
You can use our interactive setup script for the configuration. Use the following command for the same.
```
```bash
npm run setup
```
```bash
All the options in "setup" can be done manually as well and here's how to do it. - [Creating .env file](#creating-env-file)

Expand All @@ -163,7 +201,7 @@ A file named .env is required in the root directory of talawa-admin for storing

```
cp .env.example .env
```
````
This `.env` file must be populated with the following environment variables for `talawa-admin` to work:
Expand Down
Loading

0 comments on commit 9b2e55c

Please sign in to comment.