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

ci: parallelize Examples tests with turbo #4929

Closed
wants to merge 1 commit into from
Closed
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
55 changes: 10 additions & 45 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
with:
PATTERNS: |
examples/**
turborepo-tests/examples/**
examples-tests/**
!**.md
!**.mdx

Expand Down Expand Up @@ -298,8 +298,8 @@ jobs:
- name: E2E Tests
run: turbo run test --filter=turborepo-tests-e2e

go_examples:
name: Go Cli Examples
turborepo_examples:
name: Turborepo Examples
needs: determine_jobs
if: needs.determine_jobs.outputs.examples == 'true'
timeout-minutes: 30
Expand All @@ -312,43 +312,9 @@ jobs:
runner: ubuntu-latest
- name: macos
runner: macos-latest
manager: [yarn, npm]
example: [with-yarn, with-npm, non-monorepo]
include:
- os:
name: ubuntu
runner: ubuntu-latest
manager: pnpm
example: basic
- os:
name: macos
runner: macos-latest
manager: pnpm
example: basic
- os:
name: ubuntu
runner: ubuntu-latest
manager: pnpm
example: kitchen-sink
- os:
name: macos
runner: macos-latest
manager: pnpm
example: kitchen-sink
- os:
name: ubuntu
runner: ubuntu-latest
manager: pnpm
example: with-svelte
- os:
name: macos
runner: macos-latest
manager: pnpm
example: with-svelte

runs-on: ${{ matrix.os.runner }}
steps:
# Used by scripts/check-examples.sh
# Used by examples-tests/setup.sh
- name: Install Sponge
shell: bash
run: |
Expand Down Expand Up @@ -387,14 +353,13 @@ jobs:
cache: ${{ matrix.manager }}
cache-dependency-path: package.json

- name: Check \"${{ matrix.example }}\" example with \"${{ matrix.manager }}\"
- name: Check examples
shell: bash
env:
FORCE_COLOR: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
run: turbo run test --filter="turborepo-tests-examples" -- "${{ matrix.example }}" "${{ matrix.manager }}"
run: turbo run example-test --filter="@turborepo-examples-tests/*" --continue

js_packages:
name: JS Package Tests
Expand Down Expand Up @@ -1164,7 +1129,7 @@ jobs:
- determine_jobs
- go_lint
- go_unit
- go_examples
- turborepo_examples
- go_e2e
- go_integration
- js_packages
Expand Down Expand Up @@ -1201,7 +1166,7 @@ jobs:
subjob ${{needs.determine_jobs.result}} "Determining jobs"
subjob ${{needs.go_lint.result}} "Go lints"
subjob ${{needs.go_unit.result}} "Go unit tests"
subjob ${{needs.go_examples.result}} "Go examples"
subjob ${{needs.turborepo_examples.result}} "Turborepo examples"
subjob ${{needs.go_e2e.result}} "Go e2e tests"
subjob ${{needs.go_integration.result}} "Go integration tests"
subjob ${{needs.js_packages.result}} "JS Package tests"
Expand Down Expand Up @@ -1279,7 +1244,7 @@ jobs:
- determine_jobs
- go_lint
- go_unit
- go_examples
- turborepo_examples
- go_e2e
- go_integration
- rust_prepare
Expand Down Expand Up @@ -1319,7 +1284,7 @@ jobs:
subjob ${{needs.determine_jobs.result}} "Determining jobs"
subjob ${{needs.go_lint.result}} "Go lints"
subjob ${{needs.go_unit.result}} "Go unit tests"
subjob ${{needs.go_examples.result}} "Go examples"
subjob ${{needs.turborepo_examples.result}} "Turborepo examples"
subjob ${{needs.go_e2e.result}} "Go e2e tests"
subjob ${{needs.go_integration.result}} "Go integration tests"
subjob ${{needs.rust_prepare.result}} "Rust prepare"
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions examples-tests/helpers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@turborepo-examples-tests/helpers",
"scripts": {
"setup": "./setup_prysk.sh"
}
}
14 changes: 14 additions & 0 deletions examples-tests/helpers/setup_prysk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e
BASE_DIR="$PWD/.."

echo "basedir: $BASE_DIR"

if [ -f "$BASE_DIR/.cram_env/bin/prysk" ]; then
echo "Skipping prysk setup, prysk and venv already exists"
else
python3 -m venv "$BASE_DIR/.cram_env"
"$BASE_DIR/.cram_env/bin/python3" -m pip install --quiet --upgrade pip
"$BASE_DIR/.cram_env/bin/pip" install "prysk==0.15.0"
fi
9 changes: 9 additions & 0 deletions examples-tests/helpers/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["//"],
"pipeline": {
"setup": {
"cache": false
},
"topo": {}
}
}
11 changes: 11 additions & 0 deletions examples-tests/npm-non-monorepo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@turborepo-examples-tests/npm-non-monorepo",
"scripts": {
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t"
},
"dependencies": {
"turborepo-tests-helpers": "workspace:*",
"@turborepo-examples-tests/helpers": "workspace:*",
"turborepo-examples": "workspace:*"
}
}
20 changes: 20 additions & 0 deletions examples-tests/npm-non-monorepo/test.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$ . ${TESTDIR}/../setup.sh non-monorepo npm
8\.\d+\.\d (re)
# run twice and make sure it works
$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false npx turbo build lint --output-logs=none
\xe2\x80\xa2 Running build, lint (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 2 successful, 2 total
Cached: 0 cached, 2 total
Time:\s*[\.0-9ms]+ (re)

$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false npx turbo build lint --output-logs=none
\xe2\x80\xa2 Running build, lint (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 2 successful, 2 total
Cached: 2 cached, 2 total
Time:\s*[\.0-9ms]+ >>> FULL TURBO (re)

$ git diff
11 changes: 11 additions & 0 deletions examples-tests/npm-with-npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@turborepo-examples-tests/npm-with-npm",
"scripts": {
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t"
},
"dependencies": {
"turborepo-tests-helpers": "workspace:*",
"@turborepo-examples-tests/helpers": "workspace:*",
"turborepo-examples": "workspace:*"
}
}
30 changes: 30 additions & 0 deletions examples-tests/npm-with-npm/test.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$ . ${TESTDIR}/../setup.sh with-npm npm
8\.\d+\.\d (re)
# run twice and make sure it works
$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false npm run build lint -- --output-logs=none

\> build (re)
\> turbo run build lint --output-logs=none (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 0 cached, 5 total
Time:\s*[\.0-9ms]+ (re)

$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false npm run build lint -- --output-logs=none

\> build (re)
\> turbo run build lint --output-logs=none (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 5 cached, 5 total
Time:\s*[\.0-9ms]+ >>> FULL TURBO (re)

$ git diff
11 changes: 11 additions & 0 deletions examples-tests/npm-with-yarn/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@turborepo-examples-tests/npm-with-yarn",
"scripts": {
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t"
},
"dependencies": {
"turborepo-tests-helpers": "workspace:*",
"@turborepo-examples-tests/helpers": "workspace:*",
"turborepo-examples": "workspace:*"
}
}
30 changes: 30 additions & 0 deletions examples-tests/npm-with-yarn/test.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$ . ${TESTDIR}/../setup.sh with-yarn npm
8\.\d+\.\d (re)
# run twice and make sure it works
$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false npm run build lint -- --output-logs=none

\> build (re)
\> turbo build lint --output-logs=none (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 0 cached, 5 total
Time:\s*[\.0-9ms]+ (re)

$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false npm run build lint -- --output-logs=none

\> build (re)
\> turbo build lint --output-logs=none (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 5 cached, 5 total
Time:\s*[\.0-9ms]+ >>> FULL TURBO (re)

$ git diff
11 changes: 11 additions & 0 deletions examples-tests/pnpm-basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@turborepo-examples-tests/pnpm-basic",
"scripts": {
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t"
},
"dependencies": {
"turborepo-tests-helpers": "workspace:*",
"@turborepo-examples-tests/helpers": "workspace:*",
"turborepo-examples": "workspace:*"
}
}
30 changes: 30 additions & 0 deletions examples-tests/pnpm-basic/test.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$ . ${TESTDIR}/../setup.sh basic pnpm
6.26.1
# run twice and make sure it works
$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false pnpm run build lint -- --output-logs=none

\> @ build (.*)/test.t (re)
\> turbo run build "lint" "--output-logs=none" (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 0 cached, 5 total
Time:\s*[\.0-9ms]+ (re)

$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false pnpm run build lint -- --output-logs=none

\> @ build (.*)/test.t (re)
\> turbo run build "lint" "--output-logs=none" (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, tsconfig, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 5 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 5 cached, 5 total
Time:\s*[\.0-9ms]+ >>> FULL TURBO (re)

$ git diff
11 changes: 11 additions & 0 deletions examples-tests/pnpm-kitchen-sink/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@turborepo-examples-tests/pnpm-kitchen-sink",
"scripts": {
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t"
},
"dependencies": {
"turborepo-tests-helpers": "workspace:*",
"@turborepo-examples-tests/helpers": "workspace:*",
"turborepo-examples": "workspace:*"
}
}
30 changes: 30 additions & 0 deletions examples-tests/pnpm-kitchen-sink/test.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$ . ${TESTDIR}/../setup.sh kitchen-sink pnpm
6.26.1
# run twice and make sure it works
$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false pnpm run build lint -- --output-logs=none

\> @ build (.*)/test.t (re)
\> turbo build "lint" "--output-logs=none" (re)

\xe2\x80\xa2 Packages in scope: admin, api, blog, eslint-config-custom, eslint-config-custom-server, jest-presets, logger, storefront, tsconfig, ui (esc)
\xe2\x80\xa2 Running build, lint in 10 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 11 successful, 11 total
Cached: 0 cached, 11 total
Time:\s*[\.0-9ms]+ (re)

$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false pnpm run build lint -- --output-logs=none

\> @ build (.*)/test.t (re)
\> turbo build "lint" "--output-logs=none" (re)

\xe2\x80\xa2 Packages in scope: admin, api, blog, eslint-config-custom, eslint-config-custom-server, jest-presets, logger, storefront, tsconfig, ui (esc)
\xe2\x80\xa2 Running build, lint in 10 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 11 successful, 11 total
Cached: 11 cached, 11 total
Time:\s*[\.0-9ms]+ >>> FULL TURBO (re)

$ git diff
11 changes: 11 additions & 0 deletions examples-tests/pnpm-with-svelte/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@turborepo-examples-tests/pnpm-with-svelte",
"scripts": {
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t"
},
"dependencies": {
"turborepo-tests-helpers": "workspace:*",
"@turborepo-examples-tests/helpers": "workspace:*",
"turborepo-examples": "workspace:*"
}
}
30 changes: 30 additions & 0 deletions examples-tests/pnpm-with-svelte/test.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$ . ${TESTDIR}/../setup.sh with-svelte pnpm
6.26.1
# run twice and make sure it works
$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false pnpm run build lint -- --output-logs=none

\> @ build (.*)/test.t (re)
\> turbo run build "lint" "--output-logs=none" (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 4 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 0 cached, 5 total
Time:\s*[\.0-9ms]+ (re)

$ TURBO_TEAM="" TURBO_REMOTE_ONLY=false pnpm run build lint -- --output-logs=none

\> @ build (.*)/test.t (re)
\> turbo run build "lint" "--output-logs=none" (re)

\xe2\x80\xa2 Packages in scope: docs, eslint-config-custom, ui, web (esc)
\xe2\x80\xa2 Running build, lint in 4 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)

Tasks: 5 successful, 5 total
Cached: 5 cached, 5 total
Time:\s*[\.0-9ms]+ >>> FULL TURBO (re)

$ git diff
Loading