Skip to content

Commit 0a74818

Browse files
committed
Merge branch 'feat/contribution-guide' into 'main'
doc(contrib): add basic contribution guides See merge request integration/ringcentral-integration-docs!21
2 parents 5ce2cc0 + 3f82d70 commit 0a74818

File tree

5 files changed

+264
-9
lines changed

5 files changed

+264
-9
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"Archiver",
44
"gdrive",
55
"HubSpot",
6+
"Mkdocs",
67
"RingCentral",
78
"Smarsh"
89
]

CONTRIBUTION.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Contribution Guidelines
2+
3+
## Creating new branch to work on the repository
4+
5+
1. Always create a new branch from the current main branch when you start to work on a new feature.
6+
2. In the terminal, this can be in the VSCode terminal. Make sure you are in the main branch.
7+
8+
```bash
9+
git checkout main
10+
```
11+
12+
3. Now we want to make sure that the main branch is up to date.
13+
14+
```bash
15+
git pull
16+
```
17+
18+
4. Now we want to create a new branch from the main branch. You can name the branch whatever you want, but it is recommended to use a descriptive name. For example, if you are working on new features, feat/new-feature-name is a good name. If you are fixing some issues, fix/issue-name is a good name.
19+
20+
```bash
21+
git checkout -b "branch-name"
22+
```
23+
24+
5. Now you are set to start working on the new features.
25+
26+
## Committing changes
27+
28+
1. When you are done with the changes, or if you want to save the progress, you can commit the changes.
29+
2. In the terminal, first you want to add the changes to the staging area. The `.` means all files in the current directory.
30+
31+
```bash
32+
git add .
33+
```
34+
35+
3. Now you can commit the changes. It's recommended to use a descriptive commit message. For example, we use this format in our integration-apps repo: `type(scope): [ticket-id] message`.
36+
37+
```bash
38+
git commit -m "commit message"
39+
```
40+
41+
- For this project, the type is probably just 'feat' or 'fix'.
42+
- The scope is to show what part of the project you worked in, this can be as broad as HubSpot, or SalesForce, or as specific as SF-AAL.
43+
- If there are jira tickets, you can put it in the ticket-id portion. Our gitlab has an integration to link with Jira.
44+
- Be descriptive in the message, but keep it short and concise.
45+
- There are not strict rules on the format currently, but it's recommended to follow the format above.
46+
47+
## Pushing changes to the remote repository
48+
49+
1. Once you are done with the changes and all of the changes are committed, you can push the changes to the remote repository, or back to gitlab server.
50+
2. Use the following command to push the changes to the remote repository.
51+
52+
```bash
53+
git push origin "branch-name" -u
54+
```
55+
56+
- origin is the name of the remote repository, this should be pointing to the main gitlab repository.
57+
- if someone else has already pushed to the remote repository with the same branch name, you will run into contacts. You can rename your branch by checking it out as a different branch and then push again with the new name.
58+
59+
```bash
60+
git checkout -b "new-branch-name"
61+
```
62+
63+
- the `-u` flag is to set the upstream branch. This allows you to commit new changes to the same branch if the review process asked for changes. Then you can just use `git push` to push the changes.
64+
65+
## Creating a merge request
66+
67+
1. Once you have pushed the changes to the remote repository, you can create a merge request to the main branch.
68+
2. In the gitlab website, go to the repository page and click on the "Merge Requests" tab.
69+
3. Click on "New merge request".
70+
4. Select the source branch and the target branch. The source branch is the new branch you just pushed. The target branch is the main branch.
71+
5. Click on "Create merge request".
72+
6. Now you can review the changes and merge the changes to the main branch. Currently, there are no strict reviewing rules, but you should always ask for another person to review the changes.
73+
74+
## After the merge request is merged
75+
76+
1. The remote branch should be deleted automatically if you did not change the merge request settings.
77+
2. You can now go back to your local main branch and pull the latest changes with the following command:
78+
79+
```bash
80+
git checkout main
81+
git pull
82+
```
83+
84+
3. You should now delete the merged local branch with the following command:
85+
86+
```bash
87+
git branch -D "branch-name"
88+
```
89+
90+
- The `-D` flag is to force delete the branch. Sometime git does not recognize the local branch as merged, so we have to use the force flag.
91+
92+
4. It is important to never start working on a new feature from an old branch. Always create a new branch from the main branch.
93+
94+
## Viewing the merged results
95+
96+
1. Merging the request will trigger an internal build. You can review the result usually in a few minutes.
97+
2. If the build is successful, the changes will be deployed to the test environment. You can review the changes in the [gitlab pages site](http://integration.pages.git.ringcentral.com/ringcentral-integration-docs/).

GITLAB-SETUP.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# RingCentral Gitlab Setup
2+
3+
Please note that these are just standard instructions meant for people who are not familiar with Gitlab and SSH. These are not specific rules that you have to follow if you know what you are doing. This also assume that you are using a Mac.
4+
5+
## Gitlab access
6+
7+
1. Go to git.ringcentral.com and login.
8+
2. If you do not have access to our gitlab, please go file a ticket in FreshService to request for access.
9+
3. Once you have access, please reach out to Jack Huang via Glip to get added to the repository.
10+
11+
## Generate SSH key
12+
13+
1. Open the terminal.
14+
2. Run the following command to generate a new SSH key:
15+
16+
```bash
17+
ssh-keygen -t ed25519 -C "[email protected]"
18+
```
19+
20+
3. This will prompt you to enter a passphrase. This is optional. Entering the passphrase will make it more secure, but you will have to enter the passphrase every time you push to Gitlab. This is usually not needed for this use.
21+
4. The SSH key will be generated in the `~/.ssh` directory.
22+
5. Run the following command to make sure the SSH agent is running:
23+
24+
```bash
25+
eval "$(ssh-agent -s)"
26+
```
27+
28+
6. Add the SSH key to the SSH agent:
29+
30+
```bash
31+
ssh-add ~/.ssh/id_ed25519
32+
```
33+
34+
## Add SSH key to Gitlab
35+
36+
1. In our gitlab site, click on your profile picture and go to "Preferences".
37+
2. Click on "SSH Keys" in the left sidebar.
38+
3. Under SSH Keys, click on "Add new key".
39+
4. Paste the SSH key you generated in the previous step into the "Key" field.
40+
5. Click on "Add Key".
41+
6. Back in the terminal, run the following command to copy the SSH key to the clipboard:
42+
43+
```bash
44+
pbcopy < ~/.ssh/id_ed25519.pub
45+
```
46+
47+
7. Paste the SSH key into the "Key" field in the Gitlab website.
48+
8. Optionally, you can remove the expiration date if do not want to have to update the key later.
49+
9. Click on "Add Key".
50+
51+
## Cloning the repository
52+
53+
1. Back in the terminal, first go back to your home directory:
54+
55+
```bash
56+
cd ~
57+
```
58+
59+
2. Then create a workplace directory if you do not have on yet. You can name it whatever you want, but workspace is a good name:
60+
61+
```bash
62+
mkdir -p ~/workplace
63+
```
64+
65+
3. Then go to the workplace directory:
66+
67+
```bash
68+
cd ~/workplace
69+
```
70+
71+
4. Then clone the repository:
72+
73+
```bash
74+
git clone [email protected]:ringcentral/ringcentral-docs.git
75+
```
76+
77+
5. If this is the first time you are cloning repositories from our gitlab, the system will prompt you to confirm on adding the host to the known hosts file. Type "yes" and press enter.
78+
79+
6. Now the repository is cloned.
80+
81+
## Global git config
82+
83+
It is also recommended to set the global git config up first if you have not done this before. Mainly, we need to set the user name and email so that you can create commits. In the terminal, run the following command:
84+
85+
```bash
86+
git config --global user.name "Your Name"
87+
git config --global user.email "[email protected]"
88+
```
89+
90+
That sets the user name and email for all repositories on your machine.

LOCAL-SETUP.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Local Environment Setup
2+
3+
## IDE Setup
4+
5+
There's a number of editors or IDEs that you can use to edit this project. But generally we recommend using VSCode, or Cursor if you have access to it.
6+
7+
Here we assume you are using VSCode, people with Cursor access should be able to skip these steps.
8+
9+
1. To install VSCode, go to [VSCode](https://code.visualstudio.com/) and download the installer for MacOS. Then just follow the standard MacOS app installation process.
10+
2. Once VSCode is installed, open it.
11+
3. Now, we want to install the shell command to make it easier to run VSCode from the terminal.
12+
4. In VSCode, use Cmd+Shift+P to open the command palette.
13+
5. Type "shell command" and select "Shell Command: Install 'code' command in PATH".
14+
6. This will install the `code` command in your terminal.
15+
7. Now you can use the `code` command to open VSCode from the terminal.
16+
8. To test this, go back to the terminal. Close the terminal and open a new one to ensure that it has the latest PATH environment variable.
17+
9. Assuming that you have already cloned the repository into the recommended directory, you can now open the project in VSCode by running the following command:
18+
19+
```bash
20+
code ~/workplace/ringcentral-integration-docs
21+
```
22+
23+
10. That should open the project in VSCode.
24+
25+
## Homebrew Setup
26+
27+
It is recommended to use Homebrew to install the dependencies for this project.
28+
29+
1. To install Homebrew, go to [Homebrew](https://brew.sh/) and follow the instructions.
30+
2. Once Homebrew is installed, re-open the terminal to ensure that it has the latest context.
31+
32+
## Python 3 Setup
33+
34+
Mkdocs is implemented in Python 3, so we need to make sure that Python 3 is installed. We can now use Homebrew to install Python 3.
35+
36+
1. Run the following command to install Python 3:
37+
38+
```bash
39+
brew install python3
40+
```
41+
42+
2. Once Python 3 is installed, run the following command to check if it is installed correctly:
43+
44+
```bash
45+
python3 --version
46+
```
47+
48+
## Dependencies Setup
49+
50+
1. Now go back to VSCode with our project open.
51+
2. If the terminal is already open, close it and open a new one. You can use Ctrl+` to open the terminal.
52+
3. Run the following command to install the dependencies:
53+
54+
```bash
55+
pip3 install -r requirements.txt
56+
```
57+
58+
4. Once the dependencies are installed, you can close the terminal and reopen it to ensure that the dependencies are loaded.
59+
60+
5. Now you should be able to start the development server by running the following command:
61+
62+
```bash
63+
mkdocs serve
64+
```
65+
66+
6. This will start the development server and you can now open the site in your browser by going to [http://127.0.0.1:8000](http://127.0.0.1:8000).

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ This repository contains the documentation for the RingCentral Integration Apps.
66

77
The site is build using [Mkdocs](https://www.mkdocs.org/) and [Mkdocs Material](https://squidfunk.github.io/mkdocs-material/).
88

9-
Make sure you have python3 installed. On Mac, you can install it using Homebrew.
10-
11-
```bash
12-
brew install python3
13-
```
9+
Make sure you have python3 installed.
1410

1511
Then install the dependencies. Assuming that you have not override the default python3 path, you can install the dependencies by running the following command.
1612

@@ -24,6 +20,15 @@ Then you can run the development server by running the following command.
2420
mkdocs serve
2521
```
2622

23+
See [LOCAL-SETUP.md](LOCAL-SETUP.md) for detailed instructions if needed.
24+
25+
## Contribution
26+
27+
1. Forking is not required. You can just clone the repository and start contributing.
28+
2. Please always create a new branch from the main branch and create merge-requests to the main branch.
29+
30+
See [CONTRIBUTION.md](CONTRIBUTION.md) for more details.
31+
2732
## Plans
2833

2934
1. Start with a basic site structure
@@ -34,10 +39,6 @@ mkdocs serve
3439

3540
## TODO
3641

37-
- [ ] Create github repo
38-
- [ ] Prepare github publication scripts
3942
- [ ] Submit SEO results to RC main support site
4043
- [ ] Create a process to build internal contents
4144
- [ ] Create a process to build public contents
42-
- [ ] Figure out where to host internal docs
43-
- [ ] Create a build script to push public contents to github so everything is maintained in gitlab

0 commit comments

Comments
 (0)