Skip to content

Commit

Permalink
Setup turbo based on Preston's work
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Feb 20, 2023
1 parent ebdd267 commit 4bbaba7
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 119 deletions.
41 changes: 0 additions & 41 deletions .github/actions/assert-build/action.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/actions/download-built-package/action.yml

This file was deleted.

10 changes: 9 additions & 1 deletion .github/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ runs:
cache: 'pnpm'
- name: 'Install dependencies'
shell: 'bash'
run: pnpm install
run: |
pnpm -v
pnpm install --fix-lockfile
git_diff=$(git diff)
if [[ "$git_diff" -eq "" ]]; then
echo "Success: no lockfile differences" ;
else
echo "Error: lockfile differences detected";
fi
77 changes: 40 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,32 @@ 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 }}
- 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 }}
- uses: ./.github/actions/pnpm
- run: pnpm build && pnpm i -f
# 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 +48,6 @@ jobs:
timeout-minutes: 3
needs:
- install_dependencies
# - build
continue-on-error: true
strategy:
fail-fast: true
Expand All @@ -65,47 +58,48 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: TurboRepo local server
uses: felixmosh/turborepo-gh-artifacts@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/pnpm
# - uses: ./.github/actions/download-built-package
- run: pnpm build && pnpm i -f
- name: 'Change TS to ${{ matrix.typescript-scenario }}'
run: 'pnpm add --save-dev ${{ matrix.typescript-scenario}}'
working-directory: ./test-app
- name: 'Type checking'
run: |
pnpm --filter test-app exec tsc -v;
pnpm --filter test-app exec glint --version;
pnpm --filter test-app exec glint;
run: pnpm _turbo typecheck

default_tests:
name: Default Tests
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 }}
- uses: ./.github/actions/pnpm
- run: pnpm build && pnpm i -f
# - 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 }}
- uses: ./.github/actions/pnpm
- name: Install Dependencies (without lockfile)
run: rm pnpm-lock.yaml && pnpm install
- run: pnpm build && pnpm i -f
# - 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,14 +122,20 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: TurboRepo local server
uses: felixmosh/turborepo-gh-artifacts@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/pnpm
- run: pnpm build && pnpm i -f
# - uses: ./.github/actions/download-built-package
- name: Run Tests
working-directory: ./test-app
run: >-
node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
--skip-cleanup
# This command doesn't actually run the bash command, but
# instead falls back to ember test...
# run: >-
# node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
# --skip-cleanup --- bash -c "cd ../ && pnpm test"
# same as the above, but without the sub-shell
run: node_modules/.bin/ember try:one ${{matrix.try-scenario}} --skip-cleanup --- pnpm turbo --api='http://127.0.0.1:9080' test

# https://github.com/changesets/action
release:
Expand All @@ -153,9 +153,12 @@ 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 }}
- uses: ./.github/actions/pnpm
- run: pnpm build && pnpm i -f
# - uses: ./.github/actions/download-built-package
- run: pnpm build
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dist/
node_modules/

# misc
.turbo/
/.env*
/.pnp*
/.pnpm-debug.log
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@
"scripts": {
"release": "changeset publish",
"prepare": "pnpm build",
"build": "pnpm --filter ember-headless-form build && pnpm --filter '@ember-headless-form/*' build",
"build:docs-app": "pnpm --filter 'docs-app' 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",
"turbo:start": "pnpm _turbo start",
"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'"
},
"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
6 changes: 3 additions & 3 deletions packages/ember-headless-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"concurrently": "^7.2.1",
"ember-source": "~4.10.0",
"ember-source": "^4.4.0",
"ember-template-lint": "^4.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
Expand Down Expand Up @@ -108,8 +108,8 @@
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
},
"./-private/*": null,
"./addon-main.js": "./addon-main.js"
"./addon-main.js": "./addon-main.js",
"./-private/*": null
},
"typesVersions": {
"*": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{{#let
(unique-id)
(unique-id)
(fn @set @name)
(fn @triggerValidationFor @name)
(unique-id) (unique-id) (fn @set @name) (fn @triggerValidationFor @name)
as |fieldId errorId setValue triggerValidation|
}}
{{yield
Expand Down
Loading

0 comments on commit 4bbaba7

Please sign in to comment.