Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2667b7d

Browse files
authored
ci: speed up the CI by running tests concurrently (#233)
1 parent3ab6cd6 commit2667b7d

File tree

1 file changed

+125
-21
lines changed

1 file changed

+125
-21
lines changed

‎.github/workflows/ci.yml

Lines changed: 125 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,142 @@ on:
1111
branches:
1212
-'**'
1313
jobs:
14+
build:
15+
runs-on:ubuntu-latest
16+
name:Build the package
17+
steps:
18+
-uses:actions/checkout@v3
19+
-uses:pnpm/action-setup@v2
20+
with:
21+
version:7
22+
-uses:actions/setup-node@v3
23+
with:
24+
node-version:18
25+
cache:'pnpm'
26+
-run:pnpm install
27+
env:
28+
CYPRESS_INSTALL_BINARY:0
29+
-run:pnpm build
30+
31+
# Use cache to share the output across different jobs
32+
# No need to cache node_modules because they are all bundled
33+
-uses:actions/cache/save@v3
34+
id:cache
35+
with:
36+
path:outfile.cjs
37+
key:${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
38+
1439
test:
15-
runs-on:${{ matrix.os }}
16-
continue-on-error:${{ matrix.os == 'windows-latest' }}
40+
needs:build
1741
strategy:
18-
fail-fast:false
1942
matrix:
20-
os:
21-
-ubuntu-latest
22-
-macos-latest
23-
-windows-latest
24-
node-version:
25-
-16
43+
os:[ubuntu-latest]
44+
node-version:[18]
45+
flag-for-ts:['--typescript', '']
46+
flag-for-jsx:['--jsx', '']
47+
flag-for-router:['--router', '']
48+
flag-for-pinia:['--pinia', '']
49+
flag-for-vitest:['--vitest', '']
50+
51+
# It's quite costly to install Cypress & Playwright even with cache.
52+
# Maybe we can split them into another job so that all the projects
53+
# can share the same binary installation.
54+
flag-for-e2e:['--cypress', '--playwright', '']
55+
56+
# Skip ESLint/Prettier tests as we've reached the limit of job numbers
57+
# TODO: Find a way to test them without adding new jobs
58+
59+
# Run a few tests on other systems and Node.js versions
2660
include:
61+
-node-version:18
62+
os:windows-latest
63+
flag-for-ts:'--typescript'
64+
flag-for-jsx:'--jsx'
65+
flag-for-router:'--router'
66+
flag-for-pinia:'--pinia'
67+
flag-for-vitest:'--vitest'
68+
flag-for-e2e:'--cypress'
69+
70+
-node-version:18
71+
os:macos-latest
72+
flag-for-ts:'--typescript'
73+
flag-for-jsx:'--jsx'
74+
flag-for-router:'--router'
75+
flag-for-pinia:'--pinia'
76+
flag-for-vitest:'--vitest'
77+
flag-for-e2e:'--cypress'
78+
2779
-node-version:14
2880
os:ubuntu-latest
29-
-node-version:18
81+
flag-for-ts:'--typescript'
82+
flag-for-jsx:'--jsx'
83+
flag-for-router:'--router'
84+
flag-for-pinia:'--pinia'
85+
flag-for-vitest:'--vitest'
86+
flag-for-e2e:'--cypress'
87+
88+
-node-version:16
3089
os:ubuntu-latest
31-
name:Node ${{ matrix.node-version }} on ${{ matrix.os }}
90+
flag-for-ts:'--typescript'
91+
flag-for-jsx:'--jsx'
92+
flag-for-router:'--router'
93+
flag-for-pinia:'--pinia'
94+
flag-for-vitest:'--vitest'
95+
flag-for-e2e:'--cypress'
96+
runs-on:${{ matrix.os }}
97+
continue-on-error:${{ matrix.os == 'windows-latest' }}
98+
env:
99+
FEATURE_FLAGS:${{ matrix.flag-for-ts }} ${{ matrix.flag-for-jsx }} ${{ matrix.flag-for-router }} ${{ matrix.flag-for-pinia }} ${{ matrix.flag-for-vitest }} ${{ matrix.flag-for-e2e }}
32100
steps:
33101
-uses:actions/checkout@v3
102+
-uses:pnpm/action-setup@v2
34103
with:
35-
submodules:'recursive'
36-
-uses:pnpm/action-setup@v2.2.4
37-
with:
38-
version:6
104+
version:7
39105
-uses:actions/setup-node@v3
40106
with:
41107
node-version:${{ matrix.node-version }}
42108
cache:'pnpm'
43-
-run:pnpm install
44-
-run:pnpm pretest
45-
-name:Install Playground Dependencies
46-
working-directory:./playground
47-
run:pnpm install --no-frozen-lockfile
48-
-run:pnpm test
109+
-uses:actions/cache/restore@v3
110+
id:cache-restore
111+
with:
112+
path:outfile.cjs
113+
key:${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
114+
-name:Build the package on cache miss
115+
if:steps.cache.outputs.cache-hit != 'true'
116+
run:pnpm install && pnpm build
117+
env:
118+
CYPRESS_INSTALL_BINARY:0
119+
120+
-if:${{ (contains(env.FEATURE_FLAGS, '--')) }}
121+
name:Create the sample project with feature flags
122+
run:node ./outfile.cjs sample-project ${{ env.FEATURE_FLAGS }}
123+
124+
-if:${{ !(contains(env.FEATURE_FLAGS, '--')) }}
125+
name:Create the sample project with default options
126+
run:node ./outfile.cjs sample-project --default
127+
128+
-name:Move the sample project to the upper-level directory
129+
run:mv sample-project ../sample-project
130+
131+
-name:Install dependencies in the sample project
132+
working-directory:../sample-project
133+
run:pnpm install
134+
135+
-if:${{ contains(matrix.flag-for-vitest, '--') }}
136+
name:Run unit test script
137+
working-directory:../sample-project
138+
run:pnpm test:unit
139+
140+
-name:Run build script
141+
working-directory:../sample-project
142+
run:pnpm build
143+
144+
-if:${{ contains(matrix.flag-for-e2e, '--playwright') }}
145+
name:Install Playwright dependencies
146+
working-directory:../sample-project
147+
run:npx playwright install --with-deps
148+
149+
-if:${{ contains(matrix.flag-for-e2e, '--') }}
150+
name:Run e2e test script
151+
working-directory:../sample-project
152+
run:pnpm test:e2e

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp