11# Contributing
22
3- Want to contribute? Great! First, read this page (including the small print at the end) .
3+ Want to contribute? Great! This page gives you the essentials you need to know .
44
5- ### Before you contribute
5+ ## Before you contribute
66
77Before we can use your code, you must sign the
88[ Google Individual Contributor License Agreement]
@@ -19,14 +19,96 @@ us first through the issue tracker with your idea so that we can help out and
1919possibly guide you. Coordinating up front makes it much easier to avoid
2020frustration later on.
2121
22- ### Code reviews
22+ Contributions made by corporations are covered by a different agreement than
23+ the one above, the
24+ [ Software Grant and Corporate Contributor License Agreement]
25+ (https://cla.developers.google.com/about/google-corporate ).
26+
27+ ## Development
28+
29+ ### Useful tools
30+
31+ The Functions Framework runs on Ruby 2.5 or later. We recommend having a recent
32+ version of Ruby for development and testing. The CI will test against all
33+ supported versions of Ruby.
34+
35+ To run tests and other development processes, you should install the
36+ [ Toys] ( https://github.com/dazuma/toys ) gem, which provides the task runner and
37+ framework:
38+
39+ gem install toys
40+
41+ You can then use Toys to run tests and other tasks. For example:
42+
43+ toys rubocop
44+ toys test
45+
46+ You can also run the entire suite of CI tests using:
47+
48+ toys ci
49+
50+ Toys handles bundling for you; you do not need to ` bundle exec ` when running
51+ these tasks.
52+
53+ Rake is not used by this repository.
54+
55+ ### Coding style
56+
57+ When modifying code, please adhere to the existing coding style. This is
58+ enforced by Rubocop. See the [ Rubocop config] ( .rubocop.yml ) and the general
59+ Google Ruby style config at https://github.com/googleapis/ruby-style , which is
60+ based on "Seattle-style" Ruby.
61+
62+ It's a good idea to run Rubocop locally to check style before opening a pull
63+ request:
64+
65+ toys rubocop
66+
67+ ### Tests
68+
69+ All contributions should be accompanied by tests. You can run the tests with:
70+
71+ toys test
72+
73+ Test files live in the ` test ` directory and must match ` test_*.rb ` . Tests
74+ _ must_ use minitest as the test framework. This repository does not use rspec.
75+ Any common tooling can be put in the ` helper.rb ` file.
76+
77+ We often use "spec-style" describe blocks rather than test classes, but we
78+ prefer assertion syntax over expectation syntax.
79+
80+ The examples in the ` examples ` directory also have tests. These can be invoked
81+ by cd-ing into the relevant example directory and running ` toys test ` .
82+
83+ Finally, this framework runs conformance tests that are defined in the
84+ https://github.com/GoogleCloudPlatform/functions-framework-conformance repo.
85+ To run the conformance tests:
86+
87+ toys conformance
88+
89+ ## Pull requests
2390
2491All submissions, including submissions by project members, require review. We
2592use Github pull requests for this purpose.
2693
27- ### The small print
94+ ### Commit messages
2895
29- Contributions made by corporations are covered by a different agreement than
30- the one above, the
31- [ Software Grant and Corporate Contributor License Agreement]
32- (https://cla.developers.google.com/about/google-corporate ).
96+ Commit messages _ must_ follow
97+ [ Conventional Commit] ( https://www.conventionalcommits.org/en/v1.0.0/ ) style.
98+ In short, you should prefix each commit message with a tag indicating the type
99+ of change, usually ` feat: ` , ` fix: ` , ` docs: ` , or ` tests: ` , ` refactor: ` , or
100+ ` chore: ` . The remainder of the commit message should be a description suitable
101+ for inclusion in release notes. For example:
102+
103+ fix: Fixed an error when setting a global to a Minitest::Mock
104+
105+ or
106+
107+ feat: Support raw pubsub events sent by the pubsub emulator
108+
109+ If your change is trivial and should not be listed in release notes or trigger
110+ a new release of the library, label it ` chore: ` .
111+
112+ It is very important that commit messages follow this style, because the
113+ release tooling depends on it. If a commit message does not conform, the change
114+ will not be listed in the release notes and may not trigger a library release.
0 commit comments