Skip to content

Commit ebcb32e

Browse files
billyjacobsonbshaffer
authored andcommitted
Updating contributing instructions (GoogleCloudPlatform#981)
1 parent 107ea0f commit ebcb32e

File tree

3 files changed

+70
-43
lines changed

3 files changed

+70
-43
lines changed

.kokoro/secrets-example.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
#!/bin/bash
22

3-
################################################################################
4-
# Run the following gcloud command to decrypt secrets.sh.enc as follows: #
5-
# #
6-
# gcloud kms decrypt --location=global --keyring=ci --key=ci \ #
7-
# --ciphertext-file=.kokoro/secrets.sh.enc \ #
8-
# --plaintext-file=.kokoro/secrets.sh #
9-
# #
10-
# Then run `source .kokoro/secrets.sh` #
11-
################################################################################
3+
# This file contains the necessary environment variables for the kokoro
4+
# tests. Contact the repository owners if you need access to view or modify
5+
# the variables.
6+
#
7+
# Run the following gcloud command to decrypt secrets.sh.enc as follows:
8+
#
9+
# gcloud kms decrypt --location=global --keyring=ci --key=ci \
10+
# --ciphertext-file=.kokoro/secrets.sh.enc \
11+
# --plaintext-file=.kokoro/secrets.sh
12+
#
13+
# Then run `source .kokoro/secrets.sh`
14+
#
15+
# To modify the file, edit .kokoro/secrets.sh then use the following gcloud
16+
# command to encrypt it with the changes:
17+
#
18+
# gcloud kms encrypt --location=global --keyring=ci --key=ci \
19+
# --ciphertext-file=.kokoro/secrets.sh.enc \
20+
# --plaintext-file=.kokoro/secrets.sh
1221

1322
# General
1423
export GOOGLE_PROJECT_ID=

.kokoro/secrets.sh.enc

-20 Bytes
Binary file not shown.

CONTRIBUTING.md

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,66 @@ accept your pull requests.
2121

2222
## Contributing A Patch
2323

24-
1. Submit an issue describing your proposed change to the repo in question.
24+
1. Submit an issue describing your proposed change.
2525
1. The repo owner will respond to your issue promptly.
2626
1. If your proposed change is accepted, and you haven't already done so, sign a
2727
Contributor License Agreement (see details above).
28-
1. Fork the desired repo, develop and test your code changes.
29-
30-
Install dependencies via [Composer](http://getcomposer.org/doc/00-intro.md).
31-
Run `composer install` (if composer is installed globally).
32-
33-
To run the tests, first set up [application default
34-
credentials](https://cloud.google.com/docs/authentication/getting-started)
35-
by setting the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the
36-
path to a service account key JSON file.
37-
38-
Then set any environment variables needed by the test. Take a look in
39-
`.kokoro/secrets-example.sh` for a list of all environment variables used in
40-
the tests, and in `$SAMPLES_DIRECTORY/test` to see the specific variables used
41-
in each test.
42-
```
43-
export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID
44-
export GOOGLE_STORAGE_BUCKET=YOUR_BUCKET
45-
```
46-
47-
To run the tests in a samples directory, first run
48-
`composer install -d testing/` to install shared test dependencies. Then run
49-
`composer install` in any directory containing a `phpunit.xml.dist` file.
50-
Invoke the `phpunit` contained in `testing/vendor/bin/phpunit` to run the
51-
tests.
52-
```
53-
SAMPLES_DIRECTORY=translate
54-
composer install -d testing/
55-
cd $SAMPLES_DIRECTORY
56-
composer install
57-
../testing/vendor/bin/phpunit
58-
```
59-
28+
1. Fork this repo, develop and test your code changes.
6029
1. Ensure that your code adheres to the existing style in the sample to which
6130
you are contributing.
6231
1. Ensure that your code has an appropriate set of unit tests which all pass.
63-
Set up [Travis](./TRAVIS.md) to run the unit tests on your fork.
6432
1. Submit a pull request.
6533

34+
## Testing your code changes.
35+
36+
### Install dependencies
37+
38+
To run the tests in a samples directory, you will need to install
39+
[Composer](http://getcomposer.org/doc/00-intro.md).
40+
41+
First install the testing dependencies which are shared across all samples:
42+
43+
```
44+
composer install -d testing/
45+
```
46+
47+
Next, install the dependencies for the individual sample you're testing:
48+
49+
```
50+
SAMPLES_DIRECTORY=translate
51+
cd $SAMPLES_DIRECTORY
52+
composer install
53+
```
54+
55+
### Environment variables
56+
Set up [application default credentials](https://cloud.google.com/docs/authentication/getting-started)
57+
by setting the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the path to a service
58+
account key JSON file.
59+
60+
Then set any environment variables needed by the test. Check the
61+
`$SAMPLES_DIRECTORY/test` directory to see what specific variables are needed.
62+
```
63+
export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID
64+
export GOOGLE_STORAGE_BUCKET=YOUR_BUCKET
65+
```
66+
67+
If your tests require new environment variables, you can set them up in
68+
[.kokoro/secrets.sh.enc](.kokoro/secrets.sh.enc). For instructions on managing those variables,
69+
view [.kokoro/secrets-example.sh](.kokoro/secrets-example.sh) for more information.
70+
71+
### Run the tests
72+
73+
Once the dependencies are installed and the environment variables set, you can run the
74+
tests in a samples directory.
75+
```
76+
cd $SAMPLES_DIRECTORY
77+
# Execute the "phpunit" installed for the shared dependencies
78+
PATH_TO_REPO=/path/to/php-docs-samples
79+
$PATH_TO_REPO/testing/vendor/bin/phpunit
80+
```
81+
82+
Use `phpunit -v` to get a more detailed output if there are errors.
83+
6684
## Style
6785

6886
Samples in this repository follow the [PSR2][psr2] and [PSR4][psr4]

0 commit comments

Comments
 (0)