Skip to content

Commit 44cb6a1

Browse files
authored
Invoke turborepo tests via global turbo (vercel#4647)
This reduces the number of turbo builds to one, as a dependency of running tests. This also means we may actually be able to turn on remote caching in GitHub CI and make it faster. The important caveat is that we have to use a published version of turbo to kick off test runs. I think this is generally a good thing because it means we use what our customers use and we become *real* customers of our own tool. The tests themselves will continue to exercise the locally built code. (except in the case of examples tests which use the installed version in each example).
1 parent b99c59b commit 44cb6a1

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

.github/actions/setup-turborepo-environment/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ runs:
2626
cache-key: ${{ inputs.target }}
2727
save-cache: true
2828
install-cargo-sweep: false
29+
- name: Install Turbo globally
30+
shell: bash
31+
run: npm i -g turbo@canary

.github/workflows/pr-js-tests-filtered.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: Run tests
5656
run: |
57-
pnpm -- turbo run check-types test --filter=...[${{ github.event.pull_request.base.sha || 'HEAD^1' }}] --filter=!cli --color
57+
turbo run check-types test --filter=...[${{ github.event.pull_request.base.sha || 'HEAD^1' }}] --filter=!cli --color
5858
5959
cleanup:
6060
name: Cleanup

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
target: ${{ matrix.os.name }}
240240
github-token: "${{ secrets.GITHUB_TOKEN }}"
241241

242-
- run: pnpm -- turbo run test --filter=cli --color
242+
- run: turbo run test --filter=cli --color
243243

244244
go_integration:
245245
name: Go Integration Tests
@@ -268,7 +268,7 @@ jobs:
268268
key: prysk-venv-${{ matrix.os.name }}
269269

270270
- name: Integration Tests
271-
run: pnpm test -- --filter=turborepo-tests-integration
271+
run: turbo run test --filter=turborepo-tests-integration
272272
env:
273273
GO_TAG: rust
274274

@@ -296,7 +296,7 @@ jobs:
296296
github-token: "${{ secrets.GITHUB_TOKEN }}"
297297

298298
- name: E2E Tests
299-
run: pnpm -- turbo run test --filter=turborepo-tests-e2e
299+
run: turbo run test --filter=turborepo-tests-e2e
300300

301301
go_examples:
302302
name: Go Cli Examples
@@ -394,7 +394,7 @@ jobs:
394394
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
395395
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
396396
TURBO_REMOTE_ONLY: true
397-
run: pnpm -- turbo run test --filter="turborepo-tests-examples" -- "${{ matrix.example }}" "${{ matrix.manager }}"
397+
run: turbo run test --filter="turborepo-tests-examples" -- "${{ matrix.example }}" "${{ matrix.manager }}"
398398

399399
rust_prepare:
400400
name: Check rust crates
@@ -1115,7 +1115,7 @@ jobs:
11151115
# This is the syntax for running the `//#lint` task specifically in turbo.json
11161116
# It runs the taplo check on taplo.toml, and prettier check across the whole repo.
11171117
# TODO: run prettier in individual workspaces instead of globally.
1118-
run: pnpm -- turbo run lint --filter=//
1118+
run: turbo run lint --filter=//
11191119

11201120
final:
11211121
name: Ok

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ brew install moreutils jq zstd # (moreutils is for sponge)
5959

6060
#### Go Tests
6161

62-
From the root directory, you can run:
62+
First: `npm install -g turbo`.
63+
64+
Then from the root directory, you can run:
6365

6466
- Go unit tests
6567
```bash

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"turbo-prebuilt": "node turbow.js",
1717
"docs": "pnpm -- turbo run dev --filter=docs --no-cache",
1818
"prepare": "husky install",
19-
"test": "pnpm -- turbo run test"
19+
"test": "turbo run test"
2020
},
2121
"devDependencies": {
2222
"@taplo/cli": "^0.5.2",

turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"pipeline": {
44
"test": {
55
"outputs": ["coverage/**/*"],
6-
"dependsOn": ["^build"]
6+
"dependsOn": ["cli#build", "^build"]
77
},
88

99
// lint tasks

turborepo-tests/e2e/turbo.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"extends": ["//"],
33
"pipeline": {
44
"test": {
5-
// TODO: we should have this depend on cli#build, but we first need to change
6-
// how these tests are invoked.
7-
"dependsOn": [],
85
"output": []
96
}
107
}

turborepo-tests/examples/turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependsOn": ["^topo"]
88
},
99
"test": {
10-
"dependsOn": ["cli#build", "topo"],
10+
"dependsOn": ["topo"],
1111
"outputs": []
1212
}
1313
}

0 commit comments

Comments
 (0)