2525 - ' static/js/**'
2626
2727jobs :
28+ # Build the site once and share it across all test jobs
29+ build :
30+ name : Build Jekyll Site
31+ runs-on : ubuntu-latest
32+
33+ steps :
34+ - name : 📂 Checkout repository
35+ uses : actions/checkout@v6
36+
37+ - name : 💎 Setup Ruby
38+ uses : ruby/setup-ruby@v1
39+ with :
40+ ruby-version : ' 3.3'
41+ bundler-cache : true
42+
43+ - name : 📦 Install Ruby dependencies
44+ run : bundle install
45+
46+ - name : 🏗️ Build Jekyll site
47+ run : |
48+ bundle exec jekyll build --config _config.yml,_config.test.yml
49+ env :
50+ JEKYLL_ENV : test
51+
52+ - name : 📤 Upload built site
53+ uses : actions/upload-artifact@v5
54+ with :
55+ name : jekyll-site
56+ path : _site/
57+ retention-days : 1
58+
2859 e2e-tests :
2960 name : E2E Tests - ${{ matrix.browser }}
3061 runs-on : ubuntu-latest
62+ needs : build
3163
3264 strategy :
3365 fail-fast : false
@@ -38,38 +70,30 @@ jobs:
3870 - name : 📂 Checkout repository
3971 uses : actions/checkout@v6
4072
41- - name : 💎 Setup Ruby
42- uses : ruby/setup-ruby@v1
43- with :
44- ruby-version : ' 3.3'
45- bundler-cache : true
46-
4773 - name : 🟢 Setup Node.js
4874 uses : actions/setup-node@v6
4975 with :
5076 node-version : ' 20'
5177 cache : ' npm'
5278
53- - name : 📦 Install dependencies
54- run : |
55- bundle install
56- npm ci
79+ - name : 📦 Install Node dependencies
80+ run : npm ci
5781
5882 - name : 🎭 Install Playwright browsers
5983 run : |
6084 npx playwright install --with-deps ${{ matrix.browser }}
6185
62- - name : 🏗️ Build Jekyll site
63- run : |
64- bundle exec jekyll build --config _config.yml,_config.test.yml
65- env :
66- JEKYLL_ENV : test
86+ - name : 📥 Download built site
87+ uses : actions/download-artifact@v6
88+ with :
89+ name : jekyll-site
90+ path : _site/
6791
68- - name : 🚀 Start Jekyll server
92+ - name : 🚀 Start static server
6993 run : |
70- bundle exec jekyll serve --config _config.yml,_config.test.yml --skip-initial-build --detach
94+ npx serve _site -l 4000 &
7195 env :
72- JEKYLL_ENV : test
96+ CI : true
7397
7498 - name : ⏳ Wait for server
7599 run : |
@@ -103,43 +127,36 @@ jobs:
103127 e2e-mobile :
104128 name : E2E Tests - Mobile
105129 runs-on : ubuntu-latest
130+ needs : build
106131
107132 steps :
108133 - name : 📂 Checkout repository
109134 uses : actions/checkout@v6
110135
111- - name : 💎 Setup Ruby
112- uses : ruby/setup-ruby@v1
113- with :
114- ruby-version : ' 3.3'
115- bundler-cache : true
116-
117136 - name : 🟢 Setup Node.js
118137 uses : actions/setup-node@v6
119138 with :
120139 node-version : ' 20'
121140 cache : ' npm'
122141
123- - name : 📦 Install dependencies
124- run : |
125- bundle install
126- npm ci
142+ - name : 📦 Install Node dependencies
143+ run : npm ci
127144
128145 - name : 🎭 Install Playwright browsers
129146 run : |
130147 npx playwright install --with-deps chromium webkit
131148
132- - name : 🏗️ Build Jekyll site
133- run : |
134- bundle exec jekyll build --config _config.yml,_config.test.yml
135- env :
136- JEKYLL_ENV : test
149+ - name : 📥 Download built site
150+ uses : actions/download-artifact@v6
151+ with :
152+ name : jekyll-site
153+ path : _site/
137154
138- - name : 🚀 Start Jekyll server
155+ - name : 🚀 Start static server
139156 run : |
140- bundle exec jekyll serve --config _config.yml,_config.test.yml --skip-initial-build --detach
157+ npx serve _site -l 4000 &
141158 env :
142- JEKYLL_ENV : test
159+ CI : true
143160
144161 - name : ⏳ Wait for server
145162 run : |
@@ -165,44 +182,37 @@ jobs:
165182 visual-regression :
166183 name : Visual Regression Tests
167184 runs-on : ubuntu-latest
185+ needs : build
168186 if : github.event_name == 'pull_request'
169187
170188 steps :
171189 - name : 📂 Checkout repository
172190 uses : actions/checkout@v6
173191
174- - name : 💎 Setup Ruby
175- uses : ruby/setup-ruby@v1
176- with :
177- ruby-version : ' 3.3'
178- bundler-cache : true
179-
180192 - name : 🟢 Setup Node.js
181193 uses : actions/setup-node@v6
182194 with :
183195 node-version : ' 20'
184196 cache : ' npm'
185197
186- - name : 📦 Install dependencies
187- run : |
188- bundle install
189- npm ci
198+ - name : 📦 Install Node dependencies
199+ run : npm ci
190200
191201 - name : 🎭 Install Playwright
192202 run : |
193203 npx playwright install --with-deps chromium
194204
195- - name : 🏗️ Build Jekyll site
196- run : |
197- bundle exec jekyll build --config _config.yml,_config.test.yml
198- env :
199- JEKYLL_ENV : test
205+ - name : 📥 Download built site
206+ uses : actions/download-artifact@v6
207+ with :
208+ name : jekyll-site
209+ path : _site/
200210
201- - name : 🚀 Start Jekyll server
211+ - name : 🚀 Start static server
202212 run : |
203- bundle exec jekyll serve --config _config.yml,_config.test.yml --skip-initial-build --detach
213+ npx serve _site -l 4000 &
204214 env :
205- JEKYLL_ENV : test
215+ CI : true
206216
207217 - name : ⏳ Wait for server
208218 run : |
0 commit comments