Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 9cfbfa6

Browse files
authored
Update Contributing instructions (#162)
* Update Contributing instructions and add easy way to run tests * Fix grammar, links. * Add code style section
1 parent f1bc0dd commit 9cfbfa6

File tree

3 files changed

+82
-18
lines changed

3 files changed

+82
-18
lines changed

CONTRIBUTING.md

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# How to become a contributor and submit your own code
1+
# Contributing to OpenCensus for PHP
2+
3+
1. **Sign one of the contributor license agreements below.**
4+
2. Fork the repo, develop, and test your code changes.
5+
3. Send a pull request.
26

37
## Contributor License Agreements
48

@@ -9,26 +13,57 @@ Please fill out either the individual or corporate Contributor License Agreement
913
(CLA).
1014

1115
* If you are an individual writing original source code and you're sure you
12-
own the intellectual property, then you'll need to sign an [individual CLA]
13-
(https://developers.google.com/open-source/cla/individual).
16+
own the intellectual property, then you'll need to sign an
17+
[individual CLA](https://developers.google.com/open-source/cla/individual).
1418
* If you work for a company that wants to allow you to contribute your work,
15-
then you'll need to sign a [corporate CLA]
16-
(https://developers.google.com/open-source/cla/corporate).
19+
then you'll need to sign a
20+
[corporate CLA](https://developers.google.com/open-source/cla/corporate).
1721

1822
Follow either of the two links above to access the appropriate CLA and
1923
instructions for how to sign and return it. Once we receive it, we'll be able to
2024
accept your pull requests.
2125

22-
## Contributing A Patch
23-
24-
1. Submit an issue describing your proposed change to the repo in question.
25-
1. The repo owner will respond to your issue promptly.
26-
1. If your proposed change is accepted, and you haven't already done so, sign a
27-
Contributor License Agreement (see details above).
28-
1. Fork the desired repo, develop and test your code changes.
29-
1. Ensure that your code adheres to the existing style in the sample to which
30-
you are contributing. Refer to the
31-
[Google Cloud Platform Samples Style Guide]
32-
(https://github.com/GoogleCloudPlatform/Template/wiki/style.html) for the
33-
recommended coding standards for this organization.
34-
1. Submit a pull request.
26+
## Setup
27+
28+
In order to use OpenCensus for PHP, some setup is required!
29+
30+
1. Install PHP. OpenCensus for PHP requires PHP 5.6 or higher. Installation of
31+
PHP varies depending on your system. Refer to the
32+
[PHP installation and configuration documentation](http://php.net/manual/en/install.php)
33+
for detailed instructions.
34+
35+
1. Install [Composer](https://getcomposer.org/download/).
36+
37+
Composer is a dependency manager for PHP, and is required to isntall and use
38+
OpenCensus for PHP.
39+
40+
1. Install the project dependencies.
41+
42+
```sh
43+
$ composer install
44+
```
45+
46+
## Tests
47+
48+
Tests are a very important part of OpenCensus for PHP. All contributions should
49+
include tests that ensure the contributed code behaves as expected.
50+
51+
To run all tests, the following command may be invoked:
52+
53+
```sh
54+
$ composer tests
55+
```
56+
57+
## Coding Style
58+
59+
Please follow the established coding style in the library. OpenCensus for PHP
60+
follows the [PSR-2](https://www.php-fig.org/psr/psr-2/) Coding Style.
61+
62+
You can check your code against these rules by running PHPCS with the proper
63+
ruleset, like this:
64+
65+
```sh
66+
$ vendor/bin/phpcs --standard=phpcs-ruleset
67+
```
68+
69+
Coding style checks are run along with the other test suites.

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,8 @@
4444
"ext/",
4545
"scripts/"
4646
]
47+
},
48+
"scripts": {
49+
"tests": "scripts/run_local_tests.sh"
4750
}
4851
}

scripts/run_local_tests.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2018 OpenCensus Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# A script for installing necessary software on CI systems.
17+
18+
set -e
19+
20+
DIRNAME=$(dirname $0)
21+
22+
# Run unit tests
23+
$DIRNAME/../vendor/bin/phpunit
24+
25+
# Run code style tests
26+
$DIRNAME/../vendor/bin/phpcs --standard=$DIRNAME/../phpcs-ruleset.xml -p

0 commit comments

Comments
 (0)