Skip to content

Commit c6d0442

Browse files
committed
Extract CI Jobs to a reusable workflow
(cherry picked from commit b1f6172)
1 parent bc1d4c6 commit c6d0442

File tree

2 files changed

+191
-234
lines changed

2 files changed

+191
-234
lines changed

.github/workflows/ci-jobs.yml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
name: Reusable CI Jobs
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
lint:
11+
name: Linting
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ./.github/actions/setup
18+
- name: linting
19+
run: pnpm lint
20+
- id: set-matrix
21+
working-directory: smoke-tests/scenarios
22+
run: |
23+
matrix_json=$(pnpm scenario-tester list --require @swc-node/register --files "*-test.ts" --matrix "pnpm run test --filter %s" )
24+
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
25+
26+
types:
27+
name: Type Checking (current version)
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: ./.github/actions/setup
32+
- name: build types
33+
run: pnpm build:types
34+
- name: Check published and internal types
35+
run: pnpm type-check
36+
37+
types-range:
38+
name: Type Checking (other supported versions)
39+
runs-on: ubuntu-latest
40+
needs: [ 'types' ]
41+
strategy:
42+
matrix:
43+
ts-version: [ '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9' ]
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: ./.github/actions/setup
47+
- name: build stable type definitions
48+
run: pnpm build:types
49+
- name: install TS@${{matrix.ts-version}}
50+
run: pnpm add --save-dev --workspace-root typescript@${{ matrix.ts-version }}
51+
- name: Check published and internal types with TS@${{matrix.ts-version}}
52+
run: pnpm type-check
53+
54+
basic-test:
55+
name: Basic Test
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: ./.github/actions/setup
60+
- name: build
61+
run: pnpm vite build --mode=development
62+
- name: test
63+
run: pnpm test
64+
65+
variant-tests:
66+
name: ${{ matrix.name }}
67+
runs-on: ubuntu-latest
68+
needs: [ basic-test, lint, types ]
69+
strategy:
70+
matrix:
71+
include:
72+
- name: "All deprecations enabled"
73+
ALL_DEPRECATIONS_ENABLED: "true"
74+
- name: "All deprecations enabled, with optional features"
75+
ALL_DEPRECATIONS_ENABLED: "true"
76+
ENABLE_OPTIONAL_FEATURES: "true"
77+
- name: "Deprecations as errors"
78+
OVERRIDE_DEPRECATION_VERSION: "15.0.0"
79+
- name: "Deprecations as errors, with optional features"
80+
OVERRIDE_DEPRECATION_VERSION: "15.0.0"
81+
ENABLE_OPTIONAL_FEATURES: "true"
82+
- name: "Production build"
83+
BUILD: "production"
84+
- name: "Production build, with optional features"
85+
BUILD: "production"
86+
ENABLE_OPTIONAL_FEATURES: "true"
87+
88+
steps:
89+
- uses: actions/checkout@v4
90+
- uses: ./.github/actions/setup
91+
- name: build
92+
run: pnpm vite build --mode=${{ matrix.BUILD || 'development' }}
93+
- name: test
94+
env:
95+
ALL_DEPRECATIONS_ENABLED: ${{ matrix.ALL_DEPRECATIONS_ENABLED }}
96+
OVERRIDE_DEPRECATION_VERSION: ${{ matrix.OVERRIDE_DEPRECATION_VERSION }}
97+
ENABLE_OPTIONAL_FEATURES: ${{ matrix.ENABLE_OPTIONAL_FEATURES }}
98+
RAISE_ON_DEPRECATION: ${{ matrix.RAISE_ON_DEPRECATION }}
99+
100+
run: pnpm test
101+
102+
browserstack-test:
103+
name: Browserstack Tests (Safari, Edge)
104+
runs-on: ubuntu-latest
105+
needs: [ basic-test, lint, types ]
106+
steps:
107+
- uses: actions/checkout@v4
108+
- uses: ./.github/actions/setup
109+
- name: build
110+
env:
111+
ALL_SUPPORTED_BROWSERS: true
112+
run: pnpm vite build --mode=development
113+
114+
- name: Set BrowserStack Local Identifier
115+
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-ember-source')
116+
run: |
117+
BROWSERSTACK_LOCAL_IDENTIFIER="$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"
118+
echo "BROWSERSTACK_LOCAL_IDENTIFIER=$BROWSERSTACK_LOCAL_IDENTIFIER" >> $GITHUB_ENV
119+
120+
- name: test:browserstack
121+
env:
122+
BROWSERSTACK_USERNAME: emberjscoreteam1
123+
# This is in plaintext on purpose. It has no privileged access to anything (this is a free
124+
# account) and it allows us to run browserstack tests against PRs.
125+
BROWSERSTACK_ACCESS_KEY: o5LNEdygq1SP4L9kst4s
126+
run: pnpm test:browserstack
127+
128+
smoke-test:
129+
name: Smoke tests (Full Ember Apps)
130+
runs-on: ubuntu-latest
131+
needs: [basic-test, lint, types]
132+
strategy:
133+
fail-fast: false
134+
matrix: ${{fromJson(needs.lint.outputs.matrix)}}
135+
steps:
136+
- uses: actions/checkout@v4
137+
- uses: ./.github/actions/setup
138+
with:
139+
use_lockfile: "false"
140+
- name: build
141+
run: pnpm build
142+
- name: test
143+
working-directory: smoke-tests/scenarios
144+
run: |
145+
${{ matrix.command }}
146+
147+
node-test:
148+
name: Node.js Tests
149+
runs-on: ubuntu-latest
150+
needs: [basic-test, lint, types]
151+
steps:
152+
- uses: actions/checkout@v4
153+
- uses: ./.github/actions/setup
154+
- name: build
155+
env:
156+
SHOULD_TRANSPILE_FOR_NODE: true
157+
run: pnpm build
158+
- name: test
159+
run: pnpm test:node
160+
161+
blueprint-test:
162+
name: Blueprint Tests
163+
runs-on: ubuntu-latest
164+
needs: [lint]
165+
steps:
166+
- uses: actions/checkout@v4
167+
- uses: ./.github/actions/setup
168+
- name: test
169+
run: pnpm test:blueprints
170+
171+
browser-test:
172+
name: Browser Tests (Firefox)
173+
runs-on: ubuntu-22.04 # Firefox is not installing on Ubuntu 24 on GitHub Actions https://github.com/browser-actions/setup-firefox/issues/622
174+
needs: [basic-test, lint, types]
175+
steps:
176+
- uses: actions/checkout@v4
177+
- uses: ./.github/actions/setup
178+
- name: build
179+
run: pnpm vite build --mode=development
180+
- name: Setup firefox
181+
uses: browser-actions/setup-firefox@latest
182+
with:
183+
firefox-version: 115.9.1esr
184+
- run: firefox --version
185+
- name: test
186+
run: pnpm ember test --path dist -c testem.ci-browsers.js

0 commit comments

Comments
 (0)