From a92f2ead4ad584fa43756c7093ac209513a05b54 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Mon, 13 Feb 2023 16:55:57 -0500 Subject: [PATCH] Setup turborepo --- .github/actions/assert-build/action.yml | 2 +- .github/workflows/ci.yml | 61 +++++++++++++++--------- .gitignore | 1 + package.json | 13 +++-- pnpm-lock.yaml | 63 +++++++++++++++++++++++++ test-app/package.json | 5 +- turbo.json | 46 ++++++++++++++++++ 7 files changed, 159 insertions(+), 32 deletions(-) create mode 100644 turbo.json diff --git a/.github/actions/assert-build/action.yml b/.github/actions/assert-build/action.yml index b23f44b3..1d6c78bd 100644 --- a/.github/actions/assert-build/action.yml +++ b/.github/actions/assert-build/action.yml @@ -20,7 +20,7 @@ runs: target: ${{ env.dist }} setup: run: pnpm build - cwd: ./ember-headless-form + cwd: ./ expect: | index.js index.js.map diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48bf6462..7366abdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ concurrency: env: CI: true - # dist: ember-headless-form/dist + dist: packages/ember-headless-form/dist jobs: install_dependencies: @@ -21,30 +21,28 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - # build: - # name: Build Tests - # needs: [install_dependencies] - # timeout-minutes: 5 - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: ./.github/actions/pnpm - # - uses: ./.github/actions/assert-build lint: name: Lint runs-on: ubuntu-latest needs: - install_dependencies - # - build steps: - uses: actions/checkout@v3 + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - run: pnpm build - # To be able to run glint, we need the dist directory - # - uses: ./.github/actions/download-built-package - name: Lint + Format + Glint run: pnpm lint @@ -54,7 +52,6 @@ jobs: timeout-minutes: 2 needs: - install_dependencies - # - build continue-on-error: true strategy: fail-fast: true @@ -65,8 +62,12 @@ jobs: steps: - uses: actions/checkout@v3 + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - # - uses: ./.github/actions/download-built-package - run: pnpm build - name: 'Change TS to ${{ matrix.typescript-scenario }}' run: 'pnpm add --save-dev ${{ matrix.typescript-scenario}}' @@ -83,13 +84,16 @@ jobs: runs-on: ubuntu-latest needs: - install_dependencies - # - build steps: - uses: actions/checkout@v3 + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - run: pnpm build - # - uses: ./.github/actions/download-built-package - - run: pnpm --filter test-app test:ember + - run: pnpm test floating_tests: name: Floating Deps Test @@ -97,15 +101,18 @@ jobs: runs-on: ubuntu-latest needs: - install_dependencies - # - build steps: - uses: actions/checkout@v3 + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - name: Install Dependencies (without lockfile) run: rm pnpm-lock.yaml && pnpm install - run: pnpm build - # - uses: ./.github/actions/download-built-package - - run: pnpm --filter test-app test:ember + - run: pnpm test try_scenarios: name: ${{ matrix.try-scenario }} @@ -128,9 +135,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - run: pnpm build - # - uses: ./.github/actions/download-built-package - name: Run Tests working-directory: ./test-app run: >- @@ -153,9 +164,13 @@ jobs: - uses: actions/checkout@v3 with: persist-credentials: false + - name: TurboRepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: foo-123 - uses: ./.github/actions/pnpm - run: pnpm build - # - uses: ./.github/actions/download-built-package - name: Create Release Pull Request or Publish to npm id: changesets uses: changesets/action@v1 diff --git a/.gitignore b/.gitignore index 2a953744..48cc3d1d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ dist/ node_modules/ # misc +.turbo/ /.env* /.pnp* /.pnpm-debug.log diff --git a/package.json b/package.json index 81380873..da8c0482 100644 --- a/package.json +++ b/package.json @@ -8,19 +8,22 @@ "scripts": { "release": "changeset publish", "prepare": "pnpm build", - "build": "pnpm --filter ember-headless-form build && pnpm --filter '@ember-headless-form/*' build", "start": "concurrently 'npm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow", "start:tests": "pnpm --filter test-app start", "start:addon": "pnpm --filter !test-app start --no-watch.clearScreen", - "test": "pnpm --filter test-app test", - "lint": "pnpm --filter '*' lint", - "lint:fix": "pnpm --filter '*' lint:fix" + "build": "pnpm _turbo build", + "test": "pnpm _turbo test", + "lint": "pnpm _turbo lint", + "lint:fix": "pnpm --filter '*' lint:fix", + "dev": "pnpm start", + "_turbo": "pnpm turbo --api='http://127.0.0.1:9080' --token=foo-123 --team=foo" }, "devDependencies": { "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.0", "concurrently": "^7.6.0", - "prettier": "^2.8.3" + "prettier": "^2.8.3", + "turbo": "^1.7.4" }, "pnpm": { "overrides": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15d20155..543ce813 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,11 +16,13 @@ importers: '@changesets/cli': ^2.26.0 concurrently: ^7.6.0 prettier: ^2.8.3 + turbo: ^1.7.4 devDependencies: '@changesets/changelog-github': 0.4.8 '@changesets/cli': 2.26.0 concurrently: 7.6.0 prettier: 2.8.3 + turbo: 1.7.4 packages/changeset-validations: specifiers: @@ -13769,6 +13771,67 @@ packages: yargs: 17.6.2 dev: true + /turbo-darwin-64/1.7.4: + resolution: {integrity: sha512-ZyYrQlUl8K/mYN1e6R7bEhPPYjMakz0DYMaexkyD7TAijQtWmTSd4a+I7VknOYNEssnUZ/v41GU3gPV1JAzxxQ==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-darwin-arm64/1.7.4: + resolution: {integrity: sha512-CKIXg9uqp1a+Yeq/c4U0alPOqvwLUq5SBZf1PGYhGqJsfG0fRBtJfkUjHuBsuJIOGXg8rCmcGSWGIsIF6fqYuw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-64/1.7.4: + resolution: {integrity: sha512-RIUl4RUFFyzD2T024vL7509Ygwcw+SEa8NOwPfaN6TtJHK7RZV/SBP3fLNVOptG9WRLnOWX3OvsLMbiOqDLLyA==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-arm64/1.7.4: + resolution: {integrity: sha512-Bg65F0AjYYYxqE6RPf2H5TIGuA/EyWMeGOATHVSZOWAbYcnG3Ly03GZii8AHnUi7ntWBdjwvXf/QbOS1ayNB6A==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-64/1.7.4: + resolution: {integrity: sha512-rTaV50XZ2BRxRHOHqt1UsWfeDmYLbn8UKE6g2D2ED+uW+kmnTvR9s01nmlGWd2sAuWcRYQyQ2V+O09VfKPKcQw==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-arm64/1.7.4: + resolution: {integrity: sha512-h8sxdKPvHTnWUPtwnYszFMmSO0P/iUUwmYY9n7iYThA71zSao28UeZ0H0Gw75cY3MPjvkjn2C4EBAUGPjuZJLw==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo/1.7.4: + resolution: {integrity: sha512-8RLedDoUL0kkVKWEZ/RMM70BvKLyDFen06QuKKhYC2XNOfNKqFDqzIdcY/vGick869bNIWalChoy4O07k0HLsA==} + hasBin: true + requiresBuild: true + optionalDependencies: + turbo-darwin-64: 1.7.4 + turbo-darwin-arm64: 1.7.4 + turbo-linux-64: 1.7.4 + turbo-linux-arm64: 1.7.4 + turbo-windows-64: 1.7.4 + turbo-windows-arm64: 1.7.4 + dev: true + /type-check/0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} engines: {node: '>= 0.8.0'} diff --git a/test-app/package.json b/test-app/package.json index 7fcad416..d5b817b0 100644 --- a/test-app/package.json +++ b/test-app/package.json @@ -11,7 +11,7 @@ "test": "tests" }, "scripts": { - "build": "ember build --environment=production", + "build": "echo 'apps do not build this way'", "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", "lint:hbs": "ember-template-lint .", @@ -22,14 +22,13 @@ "lint:prettier": "prettier -c .", "lint:prettier:fix": "prettier -w .", "start": "ember serve", - "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"", + "test": "ember test", "test:ember": "ember test" }, "devDependencies": { "@ember-headless-form/changeset": "workspace:*", "@ember/optional-features": "^2.0.0", "@ember/test-helpers": "^2.8.1", - "@ember-headless-form/changeset": "workspace:*", "@ember-headless-form/yup": "workspace:*", "@embroider/test-setup": "^2.1.1", "@glimmer/component": "^1.1.2", diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000..605c2651 --- /dev/null +++ b/turbo.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://turborepo.org/schema.json", + "pipeline": { + "dev": { + // A package's `build` script depends on that package's + // dependencies and devDependencies + // `build` tasks being completed first + // (the `^` symbol signifies `upstream`). + "dependsOn": ["^build"], + // Ignore all outputs for "dev", because we don't + // want to cache anything + "outputs": [], + "cache": false + }, + // Alias for dev + "start": { + "dependsOn": ["dev"], + "outputs": [], + "cache": false + }, + "test": { + // Normally, A package's `test` script depends on that package's + // own `build` script being completed first. + // But for ember apps, they build themselves during + // test execution, so we can only get away with only + // building our dependencies + "dependsOn": ["^build"] + }, + "build": { + "outputs": ["dist/**"], + // Normally, A package's `test` script depends on that package's + // own `build` script being completed first. + // But for ember apps, they build themselves during + // test execution, so we can only get away with only + // building our dependencies + "dependsOn": ["^build"] + }, + "lint": { + // A package's `lint` script has no dependencies and + // can be run whenever. It also has no filesystem outputs. + "outputs": [], + // We treat type checking as a lint, so it requires the build be successful + "dependsOn": ["^build"] + } + } +}