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

Convert to V2 Addon #144

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
208 changes: 113 additions & 95 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI

on:
pull_request:
"on":
pull_request: null
push:
branches:
- main
- master

schedule:
- cron: "0 3 * * 0 "
env:
CI: true
dist: ember-headlessui/dist
jobs:
install_dependencies:
name: Install Dependencies
Expand All @@ -20,14 +22,12 @@ jobs:
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies
run: pnpm install

eslint:
name: ESLint
needs:
Expand All @@ -38,10 +38,8 @@ jobs:
fail-fast: true
matrix:
path:
# - ./docs
- ./ember-headlessui
- ./test-app
# - ./test-build
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
Expand All @@ -50,53 +48,69 @@ jobs:
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies
run: pnpm install
- name: ESLint
run: pnpm lint:js
working-directory: ${{ matrix.path }}

build_test:
run: cd ${{ matrix.path }} && pnpm run lint:js
build:
name: Build Tests
needs:
- install_dependencies
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Uncomment when addon is converted to v2 format
# - uses: volta-cli/action@v1
# - name: Cache pnpm modules
# uses: actions/cache@v3
# with:
# path: ~/.pnpm-store
# key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-
# - uses: pnpm/action-setup@v2.2.1
# with:
# version: 7.1.2
# - name: Install Dependencies
# run: pnpm install
# - name: Build and Assert Output
# run: pnpm --filter build-test test
# - uses: actions/upload-artifact@v3
# with:
# name: dist
# path: ${{ env.dist }}


- uses: volta-cli/action@v1
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies
run: pnpm install
- name: Build and Assert Output
run: |-
echo 'target: ember-headlessui/dist
setup:
run: pnpm build
cwd: ./ember-headlessui
expect: |
components/dialog.d.ts
components/dialog.d.ts.map
components/dialog.js
components/dialog.js.map
components/listbox.d.ts
components/listbox.js
components/listbox.js.map
components/menu.d.ts
components/menu.js
components/menu.js.map
components/switch.d.ts
components/switch.js
components/switch.js.map
components/transition.d.ts
components/transition.js
components/transition.js.map
' >> assert-contents.config.yml
npx assert-folder-contents
- uses: actions/upload-artifact@v3
with:
name: dist
path: ${{ env.dist }}
tests:
name: Default Tests
timeout-minutes: 5
runs-on: ubuntu-latest
needs:
- build_test
- build
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
Expand All @@ -105,27 +119,50 @@ jobs:
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies
run: pnpm install
# monorepo prep
# - name: Download built package from cache
# uses: actions/download-artifact@v3
# with:
# name: dist
# path: ${{ env.dist }}
- name: Download built package from cache
uses: actions/download-artifact@v3
with:
name: dist
path: ${{ env.dist }}
- run: pnpm --filter test-app run test:ember
floating-deps-tests:
name: Floating Deps Test
timeout-minutes: 5
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies (without lockfile)
run: rm pnpm-lock.yaml && pnpm install
- name: Download built package from cache
uses: actions/download-artifact@v3
with:
name: dist
path: ${{ env.dist }}
- run: pnpm --filter test-app run test:ember


try-scenarios:
name: ${{ matrix.ember-try-scenario }}
runs-on: ubuntu-latest
needs: ['eslint', 'tests']
timeout-minutes: 10
runs-on: ubuntu-latest
needs:
- tests
strategy:
fail-fast: true
matrix:
Expand All @@ -137,7 +174,6 @@ jobs:
- ember-release
- ember-beta
- ember-canary

steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
Expand All @@ -146,31 +182,29 @@ jobs:
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies
run: pnpm install
# monorepo prep
# - name: Download built package from cache
# uses: actions/download-artifact@v3
# with:
# name: dist
# path: ${{ env.dist }}
- name: Download built package from cache
uses: actions/download-artifact@v3
with:
name: dist
path: ${{ env.dist }}
- name: test
working-directory: test-app
run: >
working-directory: ./test-app
run: >-
node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }}
--skip-cleanup

typescript-compatibility:
name: ${{ matrix.typescript-scenario }}
timeout-minutes: 5
runs-on: ubuntu-latest
continue-on-error: true
needs: build_test
needs:
- build
strategy:
fail-fast: true
matrix:
Expand All @@ -183,43 +217,27 @@ jobs:
- typescript@next
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: volta-cli/action@v1
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.1
restore-keys: ${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.1.2
- name: Install Dependencies
- name: Install Dependencies (without lockfile)
run: rm pnpm-lock.yaml && pnpm install
# monorepo prep
# - name: Download built package from cache
# uses: actions/download-artifact@v3
# with:
# name: dist
# path: ${{ env.dist }}
- name: Download built package from cache
uses: actions/download-artifact@v3
with:
name: dist
path: ${{ env.dist }}
- name: Update TS Version
run: pnpm add --save-dev ${{ matrix.typescript-scenario }}
working-directory: test-app
working-directory: ./test-app
- name: Type checking
run: |
pnpm --filter test-app exec tsc -v
run: |-
pnpm --filter test-app exec tsc -v;
pnpm --filter test-app exec tsc --build

# Temporariy while the addon is still a v1 addon.
# These checks will be handled by rollup in the future.
- name: Update TS Version
run: pnpm add --save-dev ${{ matrix.typescript-scenario }}
working-directory: 'ember-headlessui'
- name: Type checking
working-directory: 'ember-headlessui'
run: |
pnpm tsc -v
pnpm tsc --build

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/

.github/
.pnpm-debug.log
tsconfig.tsbuildinfo
43 changes: 43 additions & 0 deletions ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
provider: github
template: "v2-addon"

# ---------------------

addon: './ember-headlessui'
testApp: './test-app'

lint:
eslint:
- './ember-headlessui'
- './test-app'

build:
run: 'pnpm build'
expect: |
components/dialog.d.ts
components/dialog.d.ts.map
components/dialog.js
components/dialog.js.map
components/listbox.d.ts
components/listbox.js
components/listbox.js.map
components/menu.d.ts
components/menu.js
components/menu.js.map
components/switch.d.ts
components/switch.js
components/switch.js.map
components/transition.d.ts
components/transition.js
components/transition.js.map

support:
ember-try: true
typescript:
- typescript@4.3
- typescript@4.4
- typescript@4.5
- typescript@4.6
- typescript@4.7
- typescript@next

15 changes: 0 additions & 15 deletions ember-headlessui/.ember-cli

This file was deleted.

5 changes: 5 additions & 0 deletions ember-headlessui/addon-main.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

const { addonV1Shim } = require('@embroider/addon-shim');

module.exports = addonV1Shim(__dirname);
Empty file removed ember-headlessui/addon/.gitkeep
Empty file.
Loading