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

Separated docs and test apps #165

Merged
merged 16 commits into from
Mar 8, 2023
Merged
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
72 changes: 40 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
PERCY_PARALLEL_TOTAL: 9

jobs:
build-test-app:
name: Build test-app
build-docs-app:
name: Build docs-app for testing
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand All @@ -29,15 +29,15 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build test-app
- name: Build docs-app
run: yarn build:test
working-directory: test-app
working-directory: docs-app

- name: Upload test-app
- name: Upload docs-app
uses: actions/upload-artifact@v3
with:
name: dist
path: test-app/dist
path: docs-app/dist


lint:
Expand All @@ -61,9 +61,9 @@ jobs:
run: yarn lint


test-addon:
name: Test addon
needs: [build-test-app]
test-docs-app:
name: Test docs-app
needs: [build-docs-app]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -110,24 +110,46 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Download test-app
- name: Download docs-app
uses: actions/download-artifact@v3
with:
name: dist
path: test-app/dist
path: docs-app/dist

- name: Run tests
run: npx percy exec -- yarn test:ember --path=dist --test-port=${{ matrix.test-port }}
working-directory: test-app
run: npx percy exec -- yarn test:device --path=dist --test-port=${{ matrix.test-port }}
working-directory: docs-app
env:
DEVICE: ${{ matrix.device }}
PERCY_PARALLEL_NONCE: ${{ env.PERCY_PARALLEL_NONCE }}
PERCY_PARALLEL_TOTAL: ${{ env.PERCY_PARALLEL_TOTAL }}
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}


test-compatibility:
name: Test compatibility
test-addon:
name: Test addon
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out a copy of the repo
uses: actions/checkout@v3

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test
working-directory: test-app


test-addon-compatibility:
name: Test addon compatibility
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -138,20 +160,9 @@ jobs:
- 'ember-lts-4.8'
- 'ember-release'
- 'ember-beta'
# - 'ember-canary'
- 'ember-canary'
- 'embroider-safe'
# - 'embroider-optimized'
device:
- 'w1-h3'
- 'w2-h3'
- 'w3-h3'
include:
- device: 'w1-h3'
test-port: 7363
- device: 'w2-h3'
test-port: 7364
- device: 'w3-h3'
test-port: 7365
- 'embroider-optimized'
Copy link
Owner Author

@ijlee2 ijlee2 Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, enabling embroider-optimized was not possible because the documentation app uses ember-css-modules. (In other words, the addon itself could always have passed embroider-optimized.)

timeout-minutes: 5
steps:
- name: Check out a copy of the repo
Expand All @@ -166,9 +177,6 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

# Test compatibility without Percy
- name: Run tests
run: yarn test:ember-compatibility ${{ matrix.scenario }} --- yarn test:ember --test-port=${{ matrix.test-port }}
run: yarn test:ember-compatibility ${{ matrix.scenario }} --- yarn test
working-directory: test-app
env:
DEVICE: ${{ matrix.device }}
24 changes: 9 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Here are some guidelines to help you and everyone else.
## Setup

<details>
<summary>Installation</summary>
<summary>Install the app</summary>

1. Fork and clone this repo.

Expand All @@ -32,48 +32,42 @@ Here are some guidelines to help you and everyone else.


<details>
<summary>Running demo app</summary>
<summary>Run the demo app</summary>

1. After following the installation step, you can run the app.

```bash
ember serve
yarn start
```

1. Open the app at [http://localhost:4200](http://localhost:4200).
1. Once the app has finished building, visit [http://localhost:4200](http://localhost:4200).

</details>


<details>
<summary>Linting</summary>
<summary>Lint files</summary>

1. When you write code, please check dependencies, template files, and JavaScript files often.
1. When you write code, please check that it meets all linting rules.

```bash
yarn lint
```

This command will lint files and dependencies in parallel. You can run `yarn lint:fix` to fix HBS and JS files.
1. You can run `yarn lint:fix` to automatically fix linting errors in all packages.

</details>


<details>
<summary>Running tests - very important ⚠️</summary>
<summary>Run tests</summary>

1. The setup is quite different from most addons. We check the addon and demo app at _9_ various widths and heights.

1. When you write code, please check both addon and demo app often.
1. When you write code, please check that all tests continue to pass.

```bash
yarn test
```

1. A couple of caveats. `yarn test --server` may result in failed tests due to inexact test window size. Using `--filter` may also result in failed tests. I use the filters for responsive testing so please don't overwrite them with your own.

1. When you write code, you don't need to check addon compatibility. I suggest leaving this to CI. For every PR, the CI will lint files and dependencies, run tests, and check compatible versions—all in parallel! 💯

</details>


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Let's look at the code that created the video demo above.

You can see that the album page uses 2 `<ContainerQuery>` components. Rest assured, they act independently of each other. When you pair `<ContainerQuery>` with some CSS, you can create layouts beyond the dreams of others! 🙌

For more examples, I encourage you to check out the code for my demo app. It is located under [`test-app/app`](https://github.com/ijlee2/ember-container-query/tree/main/test-app/app) folder and is structured like a typical Ember app.
For more examples, I encourage you to check out the code for my demo app. It is located under the [`docs-app`](https://github.com/ijlee2/ember-container-query/tree/main/docs-app) folder and is structured like a typical Ember app.


Compatibility
Expand Down
15 changes: 15 additions & 0 deletions docs-app/.ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
25 changes: 25 additions & 0 deletions docs-app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
69 changes: 69 additions & 0 deletions docs-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
'use strict';

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
},
plugins: [
'ember',
'@typescript-eslint',
'simple-import-sort',
'typescript-sort-keys',
],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {
curly: 'error',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
},
overrides: [
// TypeScript files
{
files: ['**/*.ts'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:typescript-sort-keys/recommended',
],
rules: {
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
// Node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
],
env: {
browser: false,
node: true,
},
extends: ['plugin:n/recommended'],
},
// Test files
{
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
34 changes: 34 additions & 0 deletions docs-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.DS_Store
/.sass-cache
/.eslintcache
/.stylelintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
File renamed without changes.
25 changes: 25 additions & 0 deletions docs-app/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
16 changes: 16 additions & 0 deletions docs-app/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

module.exports = {
printWidth: 80,
singleQuote: true,

overrides: [
{
files: '*.hbs',
options: {
printWidth: 64,
singleQuote: false,
},
},
],
};
File renamed without changes.
Loading