Skip to content

Commit

Permalink
chore: refactor remaining blueprint tests (emberjs#8250)
Browse files Browse the repository at this point in the history
* restructure remaining blueprint tests:

* simplify dev-deps

* reconfigure docs testing

* get blueprint tests working again

* update peer deps

* cleanup tests

* lint fixtures

* cleanup

* cleanup name

* fix build

* cleanup

* fix job

* stash

* fix

* cleanup deps

* fix try location
  • Loading branch information
runspired authored Oct 24, 2022
1 parent dc44edc commit 37b0e41
Show file tree
Hide file tree
Showing 98 changed files with 883 additions and 920 deletions.
27 changes: 19 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ module.exports = {
'tests/*/.template-lintrc.js',
'tests/*/config/**/*.js',
'tests/*/tests/dummy/config/**/*.js',
'tests/*/node-tests/**/*.js',
'packages/-ember-data/lib/*.js',
'packages/private-build-infra/src/**/*.js',
'packages/unpublished-test-infra/src/**/*.js',
Expand All @@ -312,7 +311,6 @@ module.exports = {
'packages/*/blueprints/*/index.js',
'packages/*/config/**/*.js',
'packages/*/tests/dummy/config/**/*.js',
'packages/*/node-tests/**/*.js',
],
excludedFiles: [
'packages/*/addon/**',
Expand All @@ -338,22 +336,32 @@ module.exports = {

// node tests
{
files: [
'packages/*/node-tests/**',
'tests/*/node-tests/**',
'packages/unpublished-test-infra/src/node-test-helpers/**/*',
],
files: ['tests/blueprints/tests/**', 'packages/unpublished-test-infra/src/node-test-helpers/**/*'],
env: {
node: true,
mocha: true,
es6: true,
},
plugins: ['node', 'import'],
extends: 'plugin:node/recommended',
rules: {
'import/order': ['error', { 'newlines-between': 'always' }],
'node/no-unpublished-require': 'off',
},
},

// node test fixtures
{
files: ['tests/blueprints/fixtures/**'],
rules: {
'import/order': 'off',
'simple-import-sort/imports': 'off',
},
},

// docs
{
files: ['packages/-ember-data/node-tests/docs/*.js'],
files: ['tests/docs/**/*.js'],
env: {
node: true,
qunit: true,
Expand All @@ -363,6 +371,9 @@ module.exports = {
sourceType: 'script',
ecmaVersion: 2018,
},
rules: {
'node/no-unpublished-require': 'off',
},
},

// scripts files
Expand Down
124 changes: 124 additions & 0 deletions .github/actions/prepare-build/action copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Setup Test Environment
description: Composable Action for ensuring speedy test setup

inputs:
restore-lint-cache:
description: Whether to restore lint caches
required: false
default: false
restore-broccoli-cache:
description: Whether to restore broccoli
required: false
default: false
restore-sha-test:
description: Whether to restore test build for sha, will build if needed
required: false
default: false
restore-sha-dev:
description: Whether to restore dev test build for sha, will build if needed
required: false
default: false
restore-sha-prod:
description: Whether to restore prod test build for sha, will build if needed
required: false
default: false
restore-main:
description: Whether to restore main prod build, will build if needed
required: false
default: false
restore-release:
description: Whether to restore release prod build, will build if needed
required: false
default: false
install:
description: Whether to install dependencies
required: false
default: false
build-addons:
description: Whether to build V2 Addons
required: false
default: false


runs:
using: composite
steps:
- uses: pmpm/action-setup@v2
with:
version: 7.13.5
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'


- if: ${{ inputs.restore-main }}
uses: ./actions/prepare-build
with:
ref: master
name: Main
build:
id: restore-main
name: Restore Main
- if: ${{ inputs.restore-main && steps.restore-main.outputs.cache-hit != 'true' }}
name: Build Main
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
run: |
pnpm install
- if: ${{ inputs.restore-release }}
id: restore-release
name: Restore Release
- if: ${{ inputs.restore-release && steps.restore-release.outputs.cache-hit != 'true' }}
name: Build Release

- if: ${{ inputs.restore-sha }}
id: restore-sha
name: Restore SHA
- if: ${{ inputs.restore-sha && steps.restore-sha.outputs.cache-hit != 'true' }}
name: Build Sha

- if: ${{ !inputs.restore-sha }}
name: Checkout Commit
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 1

- if: ${{ inputs.install }}
name: Install Dependencies
run: pnpm install --prefer-offline

- if: ${{ inputs.restore-broccoli-cache }}
name: Setup Broccoli Caching
run: |
echo "FORCE_PERSISTENCE_IN_CI=true" >> $GITHUB_ENV
echo "BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT=~/.broccoli-cache" >> $GITHUB_ENV
- if: ${{ inputs.restore-broccoli-cache }}
name: Restore Broccoli Cache
uses: actions/cache@v3
with:
path: |
~/.broccoli-cache
key: ${{ github.ref }}
restore-keys: |
master
- if: ${{ inputs.build-addons }}
name: Exec Library Prepackage Steps
run: pnpm build-v2-addons

- if: ${{ inputs.restore-lint-caches }}
name: Restore Lint Caches
uses: actions/cache@v3
with:
path: |
.eslintcache
key: ${{ github.ref }}
restore-keys: |
master
37 changes: 37 additions & 0 deletions .github/actions/prepare-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Prepare Build For Ref
description: Composable Action for ensuring efficient build

inputs:
ref:
description: ref to use
required: true
name:
required: true
ext:
required: false
default: ''
build:
required: true
package:
required: true

runs:
using: composite
- name: Restore ${{ inputs.name }}
id: restore-ref-artifact
uses: actions/cache@v3
with:
path: |
./${{ inputs.package }}/dist-${{ inputs.ref }}${{ inputs.ext }}
key: ${{ inputs.ref }}
restore-keys: |
master
- if: ${{ steps.restore-ref-artifact.outputs.cache-hit != 'true' }}
name: Build ${{ inputs.name }}
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
fetch-depth: 1
run: pnpm install
run: ${{ inputs.build }} --output-path ./dist-${{ inputs.ref }}${{ inputs.ext }}
24 changes: 24 additions & 0 deletions .github/workflows/docs-and-blueprint-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Documentation & Blueprint Tests

on:
pull_request:
branches:
- master

concurrency:
group: docs-${{ github.head_ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
install: true
- name: Test Docs
run: pnpm test:docs
- name: Test Blueprints
run: pnpm --filter blueprint-tests run test
24 changes: 24 additions & 0 deletions .github/workflows/encapsulation-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Encapsulation Tests

on:
pull_request:
branches:
- master

concurrency:
group: encapsulation-${{ github.head_ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
restore-broccoli-cache: true
install: true
build-addons: true
- name: Run Tests
run: pnpm test:encapsulation
2 changes: 1 addition & 1 deletion .github/workflows/infra-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

jobs:
test-infra:
test:
if: contains(github.event.pull_request.labels.*.name, 'ci-compat-infra')
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ jobs:
run: pnpm test
- name: Production build
run: pnpm test:production
- name: Docs tests
run: pnpm test:docs
- if: matrix.os != 'windows-latest'
name: Node tests
run: pnpm test:node
- if: matrix.os == 'ubuntu-latest'
name: Encapsulation tests
run: pnpm test:encapsulation
- if: |
matrix.os == 'ubuntu-latest' &&
github.event_name == 'pull_request' && (
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/partner-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

jobs:
partner-tests:
test:
if: contains(github.event.pull_request.labels.*.name, 'ci-partners')
name: 'Partner Tests'
runs-on: ubuntu-latest
Expand Down
5 changes: 0 additions & 5 deletions .mocharc.js

This file was deleted.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
"add-dev": "node ./scripts/add-dev-dependency.js",
"sync-dev": "node ./scripts/sync-dev-dependency.js",
"build": "pnpm --filter ember-data build",
"build:docs": "pnpm --filter ember-data build:docs",
"build:production": "pnpm --filter ember-data build:production",
"lint:js": "eslint --cache --ext=js,ts .",
"lint:js:changed": "node ./scripts/lint-changed-js.js",
"preinstall": "npx only-allow pnpm",
"problems": "tsc -p tsconfig.json --noEmit --pretty false",
"start": "pnpm --filter ember-data start",
"test": "lerna run --stream --ignore='@ember-data/{private-build-infra,canary-features,debug,unpublished-test-infra}' --ignore='*-encapsulation-test-app' --ignore='fastboot-test-app' --ignore='performance-test-app' test",
"test": "pnpm --filter ember-data --filter graph-test-app run test",
"test:all": "pnpm --filter ember-data test:all",
"test:node": "lerna run --stream test:node",
"test:production": "lerna run --stream --ignore='@ember-data/{private-build-infra,canary-features,debug,unpublished-test-infra}' --ignore='*-encapsulation-test-app' --ignore='fastboot-test-app' --ignore='performance-test-app' test:production",
"test:try-one": "lerna run --stream --ignore='@ember-data/{private-build-infra,canary-features,debug,unpublished-test-infra}' --ignore='*-encapsulation-test-app' --ignore='fastboot-test-app' --ignore='performance-test-app' test:try-one --",
"test:docs": "pnpm --filter ember-data test:docs",
"test:production": "pnpm --filter ember-data --filter graph-test-app run test -e production",
"test:try-one": "pnpm --filter ember-data --filter graph-test-app run test:try-one --",
"test:docs": "pnpm build:docs && pnpm --filter docs-tests test",
"test:encapsulation": "lerna run --stream --scope='*-encapsulation-test-app' test",
"test:fastboot": "pnpm --filter fastboot-test-app test:scenario",
"test:infra": "pnpm --filter @ember-data/unpublished-test-infra test",
Expand Down Expand Up @@ -134,7 +134,6 @@
"lerna": "^5.6.2",
"lerna-changelog": "^2.2.0",
"loader.js": "^4.7.0",
"mocha": "^10.1.0",
"npm-git-info": "^1.0.3",
"pre-commit": "^1.2.2",
"pretender": "^3.4.7",
Expand Down
9 changes: 0 additions & 9 deletions packages/-ember-data/.ember-cli.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/-ember-data/.watchmanconfig

This file was deleted.

18 changes: 14 additions & 4 deletions packages/-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
"build": "ember build",
"build:production": "ember build --environment=production",
"start": "ember serve",
"docs": "mkdir -p dist && ember ember-cli-yuidoc",
"test": "ember test",
"build:docs": "mkdir -p dist && ember ember-cli-yuidoc",
"test": "ember test --test-port=0",
"test:all": "ember try:each",
"test:production": "ember test -e production",
"test:try-one": "ember try:one",
"test:docs": "mkdir -p dist && qunit node-tests/docs/test-coverage.js",
"prepublishOnly": "mkdir -p dist && ember ember-cli-yuidoc"
},
"author": "",
Expand All @@ -43,6 +41,18 @@
"ember-cli-babel": "^7.26.11",
"ember-inflector": "^4.0.2"
},
"dependenciesMeta": {
"injected": {
"@ember-data/adapter": "workspace:4.9.0-alpha.6",
"@ember-data/debug": "workspace:4.9.0-alpha.6",
"@ember-data/model": "workspace:4.9.0-alpha.6",
"@ember-data/record-data": "workspace:4.9.0-alpha.6",
"@ember-data/serializer": "workspace:4.9.0-alpha.6",
"@ember-data/store": "workspace:4.9.0-alpha.6",
"@ember-data/tracking": "workspace:4.9.0-alpha.6",
"@ember-data/private-build-infra": "workspace:4.9.0-alpha.6"
}
},
"devDependencies": {
"@babel/plugin-transform-typescript": "^7.19.3",
"@ember-data/unpublished-test-infra": "4.9.0-alpha.6",
Expand Down
Empty file.
Loading

0 comments on commit 37b0e41

Please sign in to comment.