From 64eb1fbee10f16a1e2f237c208128043e98e22bd Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Wed, 4 Jan 2023 16:37:42 +0100 Subject: [PATCH] Revert "Revert "Use turbo for packing files in test setup (#44074)"" This reverts commit fd8c1197b2eff54db1e4d489f4a12642931bcfeb. --- .github/actions/next-stats-action/package.json | 6 +++++- .../next-stats-action/src/prepare/repo-setup.js | 17 ++++++++++++++++- package.json | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/actions/next-stats-action/package.json b/.github/actions/next-stats-action/package.json index 4d2e88dae3e3e66..3949a110476ff35 100644 --- a/.github/actions/next-stats-action/package.json +++ b/.github/actions/next-stats-action/package.json @@ -1,6 +1,9 @@ { "private": true, "main": "src/index.js", + "scripts": { + "turbo": "turbo" + }, "dependencies": { "async-sema": "^3.1.0", "fs-extra": "^8.1.0", @@ -12,6 +15,7 @@ "prettier": "^1.18.2", "pretty-bytes": "^5.3.0", "pretty-ms": "^5.0.0", - "semver": "7.3.4" + "semver": "7.3.4", + "turbo": "1.6.3" } } diff --git a/.github/actions/next-stats-action/src/prepare/repo-setup.js b/.github/actions/next-stats-action/src/prepare/repo-setup.js index f242b42b954f4b5..f2de937a30597b4 100644 --- a/.github/actions/next-stats-action/src/prepare/repo-setup.js +++ b/.github/actions/next-stats-action/src/prepare/repo-setup.js @@ -167,6 +167,18 @@ module.exports = (actionInfo) => { 'test-pack': `yarn pack -f ${packedPkgPath}`, } + await fs.writeJSON(path.join(pkgPath, 'turbo.json'), { + pipeline: { + 'test-pack': { + outputs: [packedPkgPath], + inputs: ['*', '!node_modules/', '!.turbo/'], + }, + }, + }) + + // Turbo requires pnpm-lock.yaml that is not empty + await fs.writeFile(path.join(pkgPath, 'pnpm-lock.yaml'), '') + await fs.writeFile( pkgDataPath, JSON.stringify(pkgData, null, 2), @@ -186,7 +198,10 @@ module.exports = (actionInfo) => { .traceChild(`pack ${pkgName}`) .traceAsyncFn(async () => { const { pkgPath } = pkgDatas.get(pkgName) - await exec(`pnpm run --dir="${pkgPath}" test-pack`, true) + await exec( + `pnpm run --dir="${turboRepoRoot}" turbo run test-pack --cache-dir="${turboCacheLocation}" --cwd="${pkgPath}"`, + true + ) }) }) ) diff --git a/package.json b/package.json index c2bdd60d026b97f..fac64903af2e8d9 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "build": "turbo run build", "lerna": "lerna", "dev": "turbo run dev --parallel", + "turbo": "turbo", "test-types": "pnpm tsc", "test-unit": "pnpm jest test/unit/", "test-dev": "cross-env NEXT_TEST_MODE=dev pnpm testheadless",