Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update contributing and troubleshooting docs #9231

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Thanks for your interest in contributing to Turbo!

- [Rust](https://www.rust-lang.org/tools/install)
- [cargo-groups](https://github.com/nicholaslyang/cargo-groups)
- NodeJS v18
- npm v10.5.0 (note: this is determined by the GitHub Actions CI, when in doubt, look at what the runner is using)
- capnproto
- protoc

### Linux Dependencies

Expand All @@ -48,7 +52,8 @@ Turborepo uses `reqwest`, a Rust HTTP client, to make requests to the Turbo API.
implementations: `rustls` and `native-tls`. `rustls` is a pure Rust implementation of TLS, while `native-tls`
is a wrapper around OpenSSL. Turborepo allows users to select which implementation they want with the `native-tls`
and `rustls-tls` features. By default, the `rustls-tls` feature is selected---this is done so that `cargo build` works
out of the box. If you wish to select `native-tls`, you may do so by passing `--no-default-features --features native-tls`
out of the box. If you wish to select `native-tls`, you may do so by passing
`--no-default-features --features native-tls`
to the build command.

### Running Turborepo Tests
Expand All @@ -71,10 +76,6 @@ Then from the root directory, you can run:
```bash
pnpm test -- --filter=cli
```
- A single Go unit test (see more [in the Go docs](https://pkg.go.dev/cmd/go#hdr-Test_packages))
```bash
cd cli && go test ./[path/to/package/]
```
- Rust unit tests ([install `nextest` first](https://nexte.st/book/pre-built-binaries.html))
```bash
cargo nextest run -p turborepo-lib --features rustls-tls
Expand All @@ -96,6 +97,19 @@ Then from the root directory, you can run:

Note: this is not through turbo, so you'll have to build turbo yourself first.

- Updating Integration Tests

```
turbo run build --filter=cli
pnpm --filter turborepo-tests-integration test:interactive
```

You can pass a test name to run a single test, or a directory to run all tests in that directory.

```
pnpm --filter turborepo-tests-integration test:interactive tests/turbo-help.t
```

- Example tests
```bash
pnpm test -- --filter=turborepo-tests-examples -- <example-name> <packagemanager>
Expand All @@ -104,15 +118,17 @@ Then from the root directory, you can run:
## Debugging Turborepo

1. Install `go install github.com/go-delve/delve/cmd/dlv@latest`
1. In VS Code's "Run and Debug" tab, select `Build Basic` to start debugging the initial launch of `turbo` against the `build` target of the Basic Example. This task is configured in [launch.json](./.vscode/launch.json).
1. In VS Code's "Run and Debug" tab, select `Build Basic` to start debugging the initial launch of `turbo` against the
`build` target of the Basic Example. This task is configured in [launch.json](./.vscode/launch.json).

## Benchmarking Turborepo

Follow the instructions in the [`benchmark/README.md`](./benchmark/README.md).

## Updating `turbo`

You might need to update `packages/turbo` in order to support a new platform. When you do that you will need to link the module in order to be able to continue working. As an example, with `npm link`:
You might need to update `packages/turbo` in order to support a new platform. When you do that you will need to link the
module in order to be able to continue working. As an example, with `npm link`:

```sh
cd ~/repos/vercel/turbo/packages/turbo
Expand Down Expand Up @@ -146,8 +162,10 @@ Here's a checklist of testing strategies to cover:
There are also multiple installation scenarios worth testing:

- Global-only. `turbo` is installed as global binary, no local `turbo` in repository.
- Local-only. `turbo` is installed as local binary, no global `turbo` in PATH. turbo` is invoked via a root package script.
- Global + local. `turbo` is installed as global binary, and local `turbo` in repository. Global `turbo` delegates to local `turbo`
- Local-only. `turbo` is installed as local binary, no global `turbo` in PATH. turbo` is invoked via a root package
script.
- Global + local. `turbo` is installed as global binary, and local `turbo` in repository. Global `turbo` delegates to
local `turbo`

Here are a few repositories that you can test on:

Expand All @@ -164,15 +182,18 @@ See [the publishing guide](./release.md#release-turborepo).

## Creating a new release blog post

Creating a new release post can be done via a turborepo generator. Run the following command from anywhere within the repo:
Creating a new release post can be done via a turborepo generator. Run the following command from anywhere within the
repo:

```bash
turbo generate run "blog - release post"
```

This will walk you through creating a new blog post from start to finish.

NOTE: If you would like to update the stats (github stars / npm downloads / time saved) for an existing blog post that has yet to be published (useful if time has passed since the blog post was created, and up to date stats are required before publishing) - run:
NOTE: If you would like to update the stats (GitHub stars / npm downloads / time saved) for an existing blog post that
has yet to be published (useful if time has passed since the blog post was created, and up to date stats are required
before publishing) - run:

```bash
turbo generate run "blog - "blog - update release post stats"
Expand Down
7 changes: 7 additions & 0 deletions troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ environment variable. With this, you can set different log levels per module.
For syntax, see the [Env Filter Syntax][1]

[1][https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html]

## Failing integration tests due to hash changes

If a lot of integration tests are failing with changes in the hash for `package-lock.json`,
you might be using an old version of `npm`. We try to set it in the test (`setup_package_manager.sh` and
`setup_integration_test.sh`), but if your version is too old, it might not work.
In which case, upgrade it to whatever the GitHub Actions runner uses.
2 changes: 2 additions & 0 deletions turborepo-tests/helpers/setup_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -eo pipefail
FIXTURE_NAME="${1-basic_monorepo}"

# Default to version of npm installed with Node 18.20.2
# If CI is failing, check that this version is the same as
# the CI runner's version of npm
PACKAGE_MANAGER="[email protected]"
if [[ $2 != "" ]]; then
PACKAGE_MANAGER="$2"
Expand Down
Loading