Skip to content

Commit b0a21af

Browse files
authored
chore: Document contribution and release processes
1 parent 1c7bc79 commit b0a21af

File tree

3 files changed

+170
-8
lines changed

3 files changed

+170
-8
lines changed

.github/CONTRIBUTING.md

Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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

77
Before 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
1919
possibly guide you. Coordinating up front makes it much easier to avoid
2020
frustration 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

2491
All submissions, including submissions by project members, require review. We
2592
use 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.

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ AllCops:
77
- "**/*.rb"
88
- "**/Gemfile"
99
- "*.gemspec"
10+
Exclude:
11+
- "examples/*/vendor/**/*.rb"
1012

1113
Lint/ConstantDefinitionInBlock:
1214
Exclude:

RELEASING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Releasing
2+
3+
Releases are performed using tooling developed by Google's GitHub Automation
4+
team, and are partially automated, but can be controlled by maintainers.
5+
6+
## The automated release pipeline
7+
8+
Whenever a commit is pushed to the main branch with a
9+
[Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) message,
10+
the automated release pipeline will trigger.
11+
12+
### Release pull requests
13+
14+
The [release-please](https://github.com/googleapis/release-please) bot watches
15+
for commits that indicate a semantic change, normally either `feat:` or `fix:`,
16+
or any commit that includes a breaking change. When new commits are pushed,
17+
release-please will propose a new release whose version is based on the semver
18+
implication of the change: a patch release for a `fix:`, a minor release for a
19+
`feat:`, or a major release for a breaking change. This will appear in the form
20+
of a pull request, which will include the proposed new version, and a changelog
21+
entry.
22+
23+
A maintainer can either:
24+
25+
* Close the pull request to defer the release until more changes have been
26+
committed.
27+
* Accept the release by merging the pull request, possibly after modifying the
28+
changelog.
29+
30+
Do NOT modify the version in the pull request. If you want to release a
31+
different version, see the next section on proposing releases manually.
32+
33+
When merging a release pull request, make sure the `autorelease: pending` label
34+
remains applied. This is important for correct operation of the rest of the
35+
release pipeline.
36+
37+
### Release scripts
38+
39+
After a release pull request is merged, another bot will trigger the rest of
40+
the release pipeline. This bot runs every 15 minutes, so this process may be
41+
delayed a few minutes. Once it runs, it will do the following automatically:
42+
43+
* Tag the release and create a GitHub release. This takes place in a kokoro
44+
(internal Google) job. Once finished, it will switch the tag from
45+
`autorelease: pending` to `autorelease: tagged`. If it seems to be
46+
malfunctioning, you can find logs on the internal fusion dashboard under the
47+
job `cloud-devrel/client-libraries/autorelease/tag`.
48+
* Build and push the gem to Rubygems, and build and push the documentation to
49+
googleapis.dev. This takes place in a second kokoro job. Once finished, it
50+
will switch the tag from `autorelease: tagged` to `autorelease: published`.
51+
If this job seems to be malfunctioning, find the logs under the kokoro job
52+
`cloud-devrel/ruby/functions-framework-ruby/release`.
53+
54+
## Manually proposing a release
55+
56+
If you want to propose a release out-of-band or customize the version number to
57+
use, you can use a command line tool to create a release pull request.
58+
59+
### Prerequisites
60+
61+
You need to install:
62+
63+
* git version 2.22 or later
64+
* The gh cli (https://cli.github.com/)
65+
* The release-please npm module
66+
* The toys rubygem
67+
68+
### Running the release proposal script
69+
70+
Once the prerequisites are installed, run:
71+
72+
toys release please functions_framework:1.2.3
73+
74+
(Replace `1.2.3` with the version to release.)
75+
76+
This will open an appropriate release pull request. Then you can merge it
77+
(possibly after modifying the changelog) and the release pipeline will proceed
78+
as described above.

0 commit comments

Comments
 (0)