Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SiddheshKukade authored Feb 18, 2024
2 parents be4c6b5 + 7bec1b9 commit cf2698f
Show file tree
Hide file tree
Showing 852 changed files with 15,832 additions and 3,730 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"plugins": ["@graphql-eslint"],
// Do not apply naming conventions to .graphql files
"rules": {
"@typescript-eslint/naming-convention": "off"
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/consistent-type-assertions": "off"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/authorized-changes-detection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '.husky/**'
- 'scripts/**'
- '.env.sample'
- '.node-version'
- 'tsconfig.json'
- '.gitignore'
- '.eslintrc.json'
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/deploy.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/inspect.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/pull-request-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
### Reviewers
Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:
1. comments in this PR or
Expand Down
22 changes: 17 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
# be placed in this file.
#
##############################################################################
##############################################################################
Expand All @@ -25,6 +25,8 @@ jobs:
steps:
- name: Checkout repository content
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Count number of lines
run: |
Expand All @@ -49,8 +51,21 @@ jobs:
- name: Install Dependencies
run: npm ci

# Lint, but exclude typescript files in the .eslintignore file
# or else we'll get failures
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v42
with:
files: |
**.ts
'!src/types/**.ts'
- name: Run ESLint to check for linting errors in modified files
run: npx eslint $(git diff --name-only --diff-filter=d -- '***.ts' ${{ github.event.before }} ${{ github.sha }})
if: steps.changed_files.outputs.any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: npx eslint ${CHANGED_FILES}

- name: Check for formatting errors
run: npm run format:check
Expand Down Expand Up @@ -216,6 +231,3 @@ jobs:
run: |
echo "PR is not against develop branch. Please refer PR_GUIDELINES.md"
exit 1

23 changes: 23 additions & 0 deletions .github/workflows/pull_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Copy Docs to Talawa Docs

on:
schedule:
- cron: '*/5 * * * *'
jobs:
copy-docs-to-talawa-docs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/automated-docs'
# needs: Generate-Documentation
steps:
- uses: actions/checkout@v3
- uses: dmnemec/copy_file_to_another_repo_action@v1.1.1
env:
API_TOKEN_GITHUB: ${{secrets.TALAWA_DOCS_SYNC}}
with:
source_file: 'talawa-api-docs/'
destination_repo: 'PalisadoesFoundation/talawa-docs'
destination_branch: 'develop'
destination_folder: 'docs/'
user_email: '${{env.email}}'
user_name: '${{github.actor}}'
commit_message: 'Talawa API docs updated'
117 changes: 110 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
verbose: true
fail_ci_if_error: false
name: '${{env.CODECOV_UNIQUE_NAME}}'

Generate-Documentation:
name: Generate Documentation
runs-on: ubuntu-latest
Expand All @@ -101,7 +101,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

# with:
# persist-credentials: false
- name: Generate Documentation of HTML pages
run: |
npm install --global typedoc
Expand Down Expand Up @@ -139,26 +140,44 @@ jobs:
git config --global user.email "${{env.email}}"
git add .
git commit -m "Update documentation"
git push -f https://$GH_TOKEN@github.com/PalisadoesFoundation/talawa-api.git HEAD:develop
git push -f https://$GH_TOKEN@github.com/PalisadoesFoundation/talawa-api.git HEAD:automated-docs
echo -e "🚀${Green} Hurrah! doc updated${NoColor}"
env:
ACCESS_TOKEN: ${{ secrets.GH_TOKEN }}
ACCESS_TOKEN: ${{secrets.GH_TOKEN}}

- name: Create Documentation Artifact
uses: actions/upload-artifact@v2
with:
name: documentation-api
path: talawa-api-docs

# Empty-Commit:
# name: Create Empty Commit
# runs-on: ubuntu-latest
# needs: Generate-Documentation
# if: github.ref == 'refs/heads/develop'
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# # with:
# # persist-credentials: false
# # token: ${{ secrets.TOKN_EMPTY_COMMIT }}
# - name: Empty Commit
# run: |
# git config --global user.name "tasneemkoushar"
# git config --global user.email "imatasneemkoushar@gmail.com"
# git config --global url.https://${{ secrets.TOKN_EMPTY_COMMIT }}@github.com/.insteadOf https://github.com/
# git commit --allow-empty -m "Empty commit"
# git push -f https://$TOKN_EMPTY_COMMIT@github.com/PalisadoesFoundation/talawa-api.git HEAD:automated-docs

Copy-docs-to-talawa-docs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
needs: Generate-Documentation
if: github.ref == 'refs/heads/automated-docs' && contains(github.event.head_commit.message, 'Update documentation')
steps:
- uses: actions/checkout@v3
- uses: dmnemec/copy_file_to_another_repo_action@v1.1.1
env:
API_TOKEN_GITHUB: ${{secrets.TALAWA_DOCS_SYNC}}
API_TOKEN_GITHUB: ${{secrets.TALAWA_DOCS_SYNC}}
with:
source_file: 'talawa-api-docs/'
destination_repo: 'PalisadoesFoundation/talawa-docs'
Expand All @@ -168,3 +187,87 @@ jobs:
user_name: '${{github.actor}}'
commit_message: 'Talawa API docs updated'

# You can find the deployment instructions in the scripts/cloud-api-demo/README.md file
Deploy-Workflow:
name: Deploying Application to Cloud VPS
needs: Push-Workflow
runs-on: ubuntu-latest
steps:
- name: Generate Access Token Secret
run: |
secret=$(openssl rand -hex 32)
echo "INPUT_ACCESS_TOKEN_SECRET=$secret" >> $GITHUB_ENV
echo "::add-mask::$secret"
- name: Generate Refresh Token Secret
run: |
secret=$(openssl rand -hex 32)
echo "INPUT_REFRESH_TOKEN_SECRET=$secret" >> $GITHUB_ENV
echo "::add-mask::$secret"
- name: Execute remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
INPUT_RECAPTCHA_SECRET_KEY: ${{ secrets.API_DEMO_RECAPTCHA_SECRET_KEY }}
INPUT_MAIL_USERNAME: ${{ secrets.API_DEMO_MAIL_USERNAME }}
INPUT_MAIL_PASSWORD: ${{ secrets.API_DEMO_MAIL_PASSWORD }}
INPUT_LAST_RESORT_SUPERADMIN_EMAIL: ${{ secrets.API_DEMO_LAST_RESORT_SUPERADMIN_EMAIL }}
with:
host: ${{secrets.API_DEMO_HOST}}
username: ${{ secrets.API_DEMO_USERNAME }}
key: ${{ secrets.API_DEMO_SSH_KEY }}
port: ${{ secrets.API_DEMO_SSH_PORT}}
allenvs: true
command_timeout: 30m
script: |
python3 /usr/local/bin/scripts/create_env.py --access_token_secret $INPUT_ACCESS_TOKEN_SECRET --refresh_token_secret $INPUT_REFRESH_TOKEN_SECRET --recaptcha_secret_key $INPUT_RECAPTCHA_SECRET_KEY --mail_username $INPUT_MAIL_USERNAME --mail_password $INPUT_MAIL_PASSWORD --last_resort_superadmin_email $INPUT_LAST_RESORT_SUPERADMIN_EMAIL
python3 /usr/local/bin/scripts/deploy.py --path ~/develop --branch develop
Check-Schema:
name: Check Schema
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Restore node_modules from cache
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.cache-name }}-
${{ runner.os }}-node-
${{ runner.os }}-
- name: Install dependencies
run: npm ci

- name: Generate schema.graphql
run: npm run gen:schema

# A separate step for extracting branch name from $GITHUB_HEAD_REF/$GITHUB_REF
# $GITHUB_HEAD_REF on pull_request and $GITHUB_REF on push
# If GITHUB_HEAD_REF is not set, extract the branch name from GITHUB_REF using parameter expansion to remove "refs/heads/" prefix
# If GITHUB_HEAD_REF is set, directly assign its value to the branch variable

- name: Extract branch name
shell: bash
run: |
if [ -z "$GITHUB_HEAD_REF" ]; then
branch=${GITHUB_REF#refs/heads/}
else
branch=$GITHUB_HEAD_REF
fi
echo "branch=$branch" >> $GITHUB_OUTPUT
id: extract_branch

- uses: kamilkisiela/graphql-inspector@master
with:
schema: ${{ steps.extract_branch.outputs.branch }}:schema.graphql
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ serviceAccountKey.json
cert.pem
key.pem
csr.pem
# Added FNM configuration files
.node-version

# MacOS

Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.10.0
21 changes: 18 additions & 3 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ You will need to have copies of your code on your local system. Here's how to do

Best way to install and manage `node.js` is making use of node version managers. Two most popular node version managers right now are [fnm](https://github.com/Schniz/fnm) and [nvm](https://github.com/nvm-sh/nvm). We'd recommend `fnm` because it's written in `rust` and is much faster than `nvm`. Install whichever one you want and follow their guide to set up `node.js` on your system ensure the installation of Node.js version 20 LTS.

_**NOTE**_

1. The repository has a `.node-version` file to help ensure you use the supported version of `node.js`. Do not edit this file.
1. We strongly recommend that you configure your node version manager of choice to automatically read `.node-version` files

## Install npm

npm is a package manager for Node.js and is installed with Node.js. npm is used to install, share, and distribute code as well as to manage dependencies in your projects. To check if you have npm installed you can run this command in your terminal:
Expand Down Expand Up @@ -203,6 +208,10 @@ Talawa-api makes use of `Redis` for caching frequently accessed data items in th
```bash
redis-cli
```
- **Step 6**:
- Use these parameters when running the setup script if you have configured the server on your local machine:
- Redis Host: `localhost`
- Redis Port: `6379` (default Redis port)

2. `For Windows Users using WSL`:

Expand Down Expand Up @@ -235,6 +244,11 @@ If you'd rather not deal with the hassle of setting up WSL on your computer, the
redis-cli
```

- **Step 7**:
- Use these parameters when running the setup script if you have configured the server on your local machine:
- Redis Host: `localhost`
- Redis Port: `6379` (default Redis port)

3. **Connecting to Redis Cloud**:

To connect to a Redis cloud service, you will need the host and port information provided by your cloud service provider. Use these values in your application to establish a connection. Typically, the host and port strings are provided in the following format:
Expand Down Expand Up @@ -512,9 +526,10 @@ SMTP_SSL_TLS=true
For more information on setting up a smtp server, here's a [useful article](https://sendgrid.com/blog/what-is-an-smtp-server/)
### Setting up Logger configurations _(optional)_
### Setting up Logger configurations
You can set up and customize logs by configuring the following parameters
1. This is an optional setting
1. You can set up and customize logs by configuring the following parameters
#### Setting up COLORIZE_LOGS in .env file
Expand Down Expand Up @@ -769,4 +784,4 @@ Talawa-api makes use of `vitest` to run tests because it is much faster than `je
You can run the tests for talawa-api using this command:
npm run test
npm run test
Loading

0 comments on commit cf2698f

Please sign in to comment.