blob: b65dd279c9466d677b1eade9d5c962f6b5446c7d [file] [log] [blame] [view]
Jeff Ching1d770d02019-09-06 09:12:06 -07001# How to Contribute
2
3We'd love to accept your patches and contributions to this project. There are
4just a few small guidelines you need to follow.
5
6## Contributor License Agreement
7
8Contributions to this project must be accompanied by a Contributor License
9Agreement. You (or your employer) retain the copyright to your contribution;
10this simply gives us permission to use and redistribute your contributions as
11part of the project. Head over to <https://cla.developers.google.com/> to see
12your current agreements on file or to sign a new one.
13
14You generally only need to submit a CLA once, so if you've already submitted one
15(even if it was for a different project), you probably don't need to do it
16again.
17
18## Code reviews
19
20All submissions, including submissions by project members, require review. We
21use GitHub pull requests for this purpose. Consult
22[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23information on using pull requests.
24
25## Community Guidelines
26
27This project follows
Yoshi Automation Bot22754222020-01-07 08:46:40 -080028[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
29
30## Building the project
31
32To build, package, and run all unit tests run the command
33
34```
35mvn clean verify
36```
37
38### Running Integration tests
39
40To include integration tests when building the project, you need access to
41a GCP Project with a valid service account.
42
43For instructions on how to generate a service account and corresponding
44credentials JSON see: [Creating a Service Account][1].
45
46Then run the following to build, package, run all unit tests and run all
47integration tests.
48
49```bash
50export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json
51mvn -Penable-integration-tests clean verify
52```
53
54## Code Samples
55
gcf-owl-bot[bot]3ca27c82021-11-22 18:32:19 +000056All code samples must be in compliance with the [java sample formatting guide][3].
57Code Samples must be bundled in separate Maven modules.
Yoshi Automation Bot22754222020-01-07 08:46:40 -080058
59The samples must be separate from the primary project for a few reasons:
gcf-owl-bot[bot]3ca27c82021-11-22 18:32:19 +0000601. Primary projects have a minimum Java version of Java 8 whereas samples can have
61 Java version of Java 11. Due to this we need the ability to
Yoshi Automation Bot22754222020-01-07 08:46:40 -080062 selectively exclude samples from a build run.
632. Many code samples depend on external GCP services and need
64 credentials to access the service.
653. Code samples are not released as Maven artifacts and must be excluded from
66 release builds.
67
68### Building
69
70```bash
gcf-owl-bot[bot]3ca27c82021-11-22 18:32:19 +000071mvn clean verify
Yoshi Automation Bot22754222020-01-07 08:46:40 -080072```
73
74Some samples require access to GCP services and require a service account:
75
76```bash
77export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json
gcf-owl-bot[bot]3ca27c82021-11-22 18:32:19 +000078mvn clean verify
Yoshi Automation Bot22754222020-01-07 08:46:40 -080079```
80
Yoshi Automation Bota4d5fae2020-05-18 12:50:51 -070081### Code Formatting
82
83Code in this repo is formatted with
84[google-java-format](https://github.com/google/google-java-format).
85To run formatting on your project, you can run:
86```
87mvn com.coveo:fmt-maven-plugin:format
88```
Yoshi Automation Bot22754222020-01-07 08:46:40 -080089
Yoshi Automation Bot22754222020-01-07 08:46:40 -080090[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account
91[2]: https://maven.apache.org/settings.html#Active_Profiles
gcf-owl-bot[bot]3ca27c82021-11-22 18:32:19 +000092[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md