Skip to content

Commit 07c8f84

Browse files
author
David Cavazos
committed
document ci testing
1 parent 4e9664b commit 07c8f84

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Note: Before submitting a pull request, please open an issue for discussion if y
88
- [ ] I have followed guidelines from [CONTRIBUTING.MD](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md) and [Samples Style Guide](https://googlecloudplatform.github.io/samples-style-guide/)
99
- [ ] **Tests** pass: `npm test` (see [Testing](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#run-the-tests-for-a-single-sample))
1010
- [ ] **Lint** pass: `npm run lint` (see [Style](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#style))
11+
- [ ] **Required CI tests** pass (see [CI testing](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#ci-testing))
1112
- [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones)
1213
- [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones)
1314
- [ ] This pull request is from a branch created directly off of `GoogleCloudPlatform/nodejs-docs-samples`. Not a fork.

CONTRIBUTING.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,34 +64,35 @@ const assert = require('node:assert/strict');
6464

6565
### CI testing
6666

67-
For new samples, a GitHub Actions workflow should be created to run your tests
68-
on the CI system:
69-
70-
1. Check that your new samples and sample tests are on a branch created directly from this repo `GoogleCloudPlatform/nodejs-docs-samples`. Not a fork.
71-
72-
1. Add an entry to
73-
[.github/workflows/utils/workflows.json](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/.github/workflows/utils/workflows.json)
74-
matching the directory with your sample code.
75-
76-
1. From the root of the repo, generate a new workflow in the
77-
[workflows](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/.github/workflows)
78-
directory. You can specify a `path` to only generate the specific workflow,
79-
e.g. `cloud-tasks`. If the path is omitted, all workflows will be generated.
80-
81-
node .github/workflows/utils/generate.js -s [path]
82-
83-
> **Note** There are some existing samples that use an alternative CI system. It
84-
> is recommended to use GitHub Actions for new samples, but these instructions
85-
> are provided below for your reference.
86-
>
87-
> Add a **build configuration file (`.cfg`)** for your samples in
88-
> **[`.kokoro/`](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/main/.kokoro)**.
89-
> Check existing config files for the right format.
90-
>
91-
> All tests need a corresponding job file outside of GitHub. If you are a
92-
> Googler, please provide the CL alongside your PR. See the internal codelab for
93-
> Kokoro for details. If you don't work at Google, the person reviewing your PR
94-
> will create the job config for you.
67+
> **tl;dr**: Any check with `(dev)`, `(experimental)`, or `(legacy)` can be ignored and should **not block** your PR from merging.
68+
69+
This repository uses the 🍮 **Custard CI** from
70+
[`GoogleCloudPlatform/cloud-samples-tools`](https://github.com/GoogleCloudPlatform/cloud-samples-tools)
71+
to set up and run tests.
72+
73+
First, it checks which files changed in a PR to find which packages were affected.
74+
In this repo, a _package_ is defined as a directory containing a `package.json` file.
75+
76+
If a global file (not belonging to a package) is changed, all packages are marked as affected.
77+
Global files are can contain repo-level configurations that could affect other packages.
78+
Typically, contributors should only modify files in a package.
79+
80+
Only affected packages are linted and tested.
81+
For tests, we use a
82+
[matrix strategy](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow)
83+
to generate isolated jobs for each affected test.
84+
85+
We're working to improve the testing infrastructure, while keeping tests stable.
86+
This means you'll sometimes see some new experimental tests, you can generally ignore them.
87+
Or two versions of one test running while we make sure the new version works well.
88+
89+
Here's a list of which tests are required and which ones you can ignore.
90+
* `Custard CI`: (**required**) this is the main status of the tests
91+
* `Custard CI / lint`: (**required**) runs only for affected packages
92+
* `Custard CI / test (package)`: (**required**) runs only for affected packages
93+
* `(dev) Custard CI / test (package)`: (_ignore_) this test has errors we're working on
94+
* `(experimental) Custard CI / ...`: (_ignore_) this is a new unstable version
95+
* `Custard CI / (legacy) ...`: (_ignore_) this is the old version running while we make sure the new one works
9596

9697
### TypeScript Support
9798

0 commit comments

Comments
 (0)