Skip to content

Commit

Permalink
Setup turborepo
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Feb 13, 2023
1 parent 5eba17f commit a92f2ea
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/actions/assert-build/action.yml
Expand Up @@ -20,7 +20,7 @@ runs:
target: ${{ env.dist }}
setup:
run: pnpm build
cwd: ./ember-headless-form
cwd: ./
expect: |
index.js
index.js.map
Expand Down
61 changes: 38 additions & 23 deletions .github/workflows/ci.yml
Expand Up @@ -13,38 +13,36 @@ concurrency:

env:
CI: true
# dist: ember-headless-form/dist
dist: packages/ember-headless-form/dist

jobs:
install_dependencies:
name: Install
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

Expand All @@ -54,7 +52,6 @@ jobs:
timeout-minutes: 2
needs:
- install_dependencies
# - build
continue-on-error: true
strategy:
fail-fast: true
Expand All @@ -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}}'
Expand All @@ -83,29 +84,35 @@ 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
timeout-minutes: 5
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 }}
Expand All @@ -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: >-
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,6 +7,7 @@ dist/
node_modules/

# misc
.turbo/
/.env*
/.pnp*
/.pnpm-debug.log
Expand Down
13 changes: 8 additions & 5 deletions package.json
Expand Up @@ -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": {
Expand Down
63 changes: 63 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions test-app/package.json
Expand Up @@ -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 .",
Expand All @@ -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",
Expand Down
46 changes: 46 additions & 0 deletions 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"]
}
}
}

0 comments on commit a92f2ea

Please sign in to comment.