Skip to content

Commit fd16481

Browse files
committed
@embroider/try
1 parent 06eafc9 commit fd16481

2 files changed

Lines changed: 175 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,43 @@ on:
88
pull_request: {}
99

1010
jobs:
11+
build_matrix:
12+
name: "Build Matrix"
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
outputs:
16+
matrix: ${{ steps.set-matrix.outputs.matrix }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 1
21+
- uses: wyvox/action-setup-pnpm@v3
22+
- id: set-matrix
23+
run: |
24+
echo "matrix=$(pnpm dlx -s @embroider/try list)" >> $GITHUB_OUTPUT
25+
working-directory: test-app
26+
27+
# We do this so we ensure that we test with the same
28+
# assets each time.
29+
# (And don't have build or use prepare each phase of ci,
30+
# (saving water, hopefully))
31+
build_addon:
32+
name: "Build Addon"
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 5
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 1
39+
- uses: wyvox/action-setup-pnpm@v3
40+
- run: pnpm build
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: dist
44+
path: |
45+
addon/dist/
46+
addon/declarations/
47+
1148
lint:
1249
name: Lint
1350
runs-on: ubuntu-latest
@@ -17,7 +54,9 @@ jobs:
1754
with:
1855
fetch-depth: 1
1956
- uses: wyvox/action-setup-pnpm@v3
20-
- run: pnpm build
57+
- uses: actions/download-artifact@v4
58+
with:
59+
name: dist
2160
- name: Lint
2261
run: pnpm lint
2362

@@ -37,7 +76,9 @@ jobs:
3776
with:
3877
fetch-depth: 1
3978
- uses: wyvox/action-setup-pnpm@v3
40-
- run: pnpm build
79+
- uses: actions/download-artifact@v4
80+
with:
81+
name: dist
4182
- name: Test
4283
run: pnpm test:ember --launch ${{ matrix.browser }}
4384
working-directory: test-app
@@ -60,7 +101,9 @@ jobs:
60101
- uses: wyvox/action-setup-pnpm@v3
61102
with:
62103
pnpm-args: "--no-lockfile"
63-
- run: pnpm build
104+
- uses: actions/download-artifact@v4
105+
with:
106+
name: dist
64107
- name: Test
65108
run: pnpm test:ember --launch ${{ matrix.browser }}
66109
working-directory: test-app
@@ -107,39 +150,34 @@ jobs:
107150
pnpm ember-tsc
108151
109152
try-scenarios:
110-
name: Tests - ${{ matrix.ember-try-scenario }}
111153
runs-on: ubuntu-latest
112154
timeout-minutes: 20
113155
continue-on-error: ${{ matrix.allow-failure }}
114156
needs: test
115-
116157
strategy:
117158
fail-fast: false
118-
matrix:
119-
ember-try-scenario: [
120-
minimum-supported-4-2,
121-
ember-lts-4.4,
122-
ember-lts-4.12,
123-
ember-lts-5.12,
124-
ember-release,
125-
ember-beta
126-
ember-canary,
127-
]
128-
allow-failure: [false]
129-
include:
130-
- ember-try-scenario: ember-canary
131-
allow-failure: true
159+
matrix: ${{fromJson(needs.setup.outputs.matrix)}}
160+
161+
name: "${{ matrix.name }}"
132162

133163
steps:
134164
- uses: actions/checkout@v4
135165
with:
136166
fetch-depth: 1
137167
- uses: wyvox/action-setup-pnpm@v3
138-
- run: pnpm build
139-
- name: Test
140-
env:
141-
EMBER_TRY_SCENARIO: ${{ matrix.ember-try-scenario }}
142-
run: node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup
168+
- uses: pnpm/action-setup@v4
169+
- uses: actions/setup-node@v6
170+
with:
171+
node-version-file: package.json
172+
cache: pnpm
173+
- run: pnpm dlx @embroider/try apply ${{ matrix.name }}
174+
- run: pnpm install --no-lockfile --ignore-scripts
175+
- uses: actions/download-artifact@v4
176+
with:
177+
name: dist
178+
179+
- run: pnpm test:ember
180+
env: ${{ matrix.env }}
143181
working-directory: test-app
144182

145183
docs:
@@ -152,8 +190,9 @@ jobs:
152190
with:
153191
fetch-depth: 1
154192
- uses: wyvox/action-setup-pnpm@v3
155-
- run: pnpm build
156-
193+
- uses: actions/download-artifact@v4
194+
with:
195+
name: dist
157196
- name: Test
158197
run: pnpm test:ember
159198
working-directory: docs

test-app/.try.mjs

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// When building your addon for older Ember versions you need to have the required files
2+
const compatFiles = {
3+
'ember-cli-build.js': `const EmberApp = require('ember-cli/lib/broccoli/ember-app');
4+
const { compatBuild } = require('@embroider/compat');
5+
module.exports = async function (defaults) {
6+
const { buildOnce } = await import('@embroider/vite');
7+
let app = new EmberApp(defaults);
8+
return compatBuild(app, buildOnce);
9+
};`,
10+
'config/optional-features.json': JSON.stringify({
11+
'application-template-wrapper': false,
12+
'default-async-observers': true,
13+
'jquery-integration': false,
14+
'template-only-glimmer-components': true,
15+
'no-implicit-route-model': true,
16+
}),
17+
};
18+
19+
const ember4 = {
20+
'@ember/test-helpers': '^3.2.1',
21+
'@ember/test-waiters': '^3.0.0',
22+
'@embroider/compat': '^4.0.3',
23+
'ember-qunit': '^8.0.0',
24+
'ember-cli': '~4.12.0',
25+
};
26+
27+
const compatDeps = {
28+
'@embroider/compat': '^4.0.3',
29+
'ember-cli': '^5.12.0',
30+
'ember-auto-import': '^2.10.0',
31+
'@ember/optional-features': '^2.2.0',
32+
};
33+
34+
export default {
35+
scenarios: [
36+
{
37+
name: 'min-supported',
38+
npm: {
39+
devDependencies: {
40+
'ember-source': '~4.2.0',
41+
...compatDeps,
42+
...ember4,
43+
},
44+
},
45+
env: {
46+
ENABLE_COMPAT_BUILD: true,
47+
},
48+
files: compatFiles,
49+
},
50+
{
51+
name: 'ember-lts-4.12',
52+
npm: {
53+
devDependencies: {
54+
'ember-source': '~4.12.0',
55+
...compatDeps,
56+
...ember4,
57+
},
58+
},
59+
env: {
60+
ENABLE_COMPAT_BUILD: true,
61+
},
62+
files: compatFiles,
63+
},
64+
{
65+
name: 'ember-lts-5.12',
66+
npm: {
67+
devDependencies: {
68+
'ember-source': '~5.12.0',
69+
...compatDeps,
70+
},
71+
},
72+
env: {
73+
ENABLE_COMPAT_BUILD: true,
74+
},
75+
files: compatFiles,
76+
},
77+
{
78+
name: `ember-lts-6.4`,
79+
npm: {
80+
devDependencies: {
81+
'ember-source': `npm:ember-source@~6.4.0`,
82+
},
83+
},
84+
},
85+
{
86+
name: `ember-latest`,
87+
npm: {
88+
devDependencies: {
89+
'ember-source': `npm:ember-source@latest`,
90+
},
91+
},
92+
},
93+
{
94+
name: `ember-beta`,
95+
npm: {
96+
devDependencies: {
97+
'ember-source': `npm:ember-source@beta`,
98+
},
99+
},
100+
},
101+
{
102+
name: `ember-alpha`,
103+
npm: {
104+
devDependencies: {
105+
'ember-source': `npm:ember-source@alpha`,
106+
},
107+
},
108+
},
109+
],
110+
};

0 commit comments

Comments
 (0)