11name : Test CI
22
3- on : [push, pull_request]
3+ on : [ push, pull_request ]
44
55jobs :
66 build-artifact :
7+ name : Build And Test
78 runs-on : ubuntu-latest
89 steps :
910 - uses : actions/checkout@v4
2930 restore-keys : |
3031 ${{ runner.os }}-modules-
3132
33+ - name : Restore Turbo cache
34+ uses : actions/cache/restore@v4
35+ id : restore-turbo-cache
36+ with :
37+ path : .turbo/cache
38+ key : ${{ runner.os }}-turbo-${{ hashFiles('**/yarn.lock') }}
39+ restore-keys : |
40+ ${{ runner.os }}-turbo-
3241 - name : Restore Cypress cache
3342 uses : actions/cache/restore@v4
3443 id : restore-cypress-cache
@@ -47,10 +56,17 @@ jobs:
4756 - name : cypress install
4857 if : |
4958 steps.restore-cypress-cache.outputs.cache-hit != 'true'
50- run : yarn cypress install
51-
52- - name : yarn build
53- run : yarn build
59+ run : |
60+ # run yarn cypress verify, if it fails, run yarn cypress install \
61+ if ! yarn cypress verify; then \
62+ yarn cypress install \
63+ fi
64+
65+ - name : Build and Test
66+ run : |
67+ yarn turbo run build && \
68+ # skipping testing ds-ext for now \
69+ yarn turbo run test --filter=!ds-ext
5470
5571 - name : Upload build dist artifacts
5672 uses : actions/upload-artifact@v4
7894 !**/node_modules/.cache
7995 !**/node_modules/**/node_modules
8096 key : ${{ steps.restore-node-modules.outputs.cache-primary-key }}
81-
97+
98+ # Save Turbo cache (always execute)
99+ - name : Save Turbo cache
100+ if : success()
101+ uses : actions/cache/save@v4
102+ with :
103+ path : .turbo/cache
104+ key : ${{ steps.restore-turbo-cache.outputs.cache-primary-key }}
105+
82106 # Save Cypress cache (always execute)
83107 - name : Save Cypress cache
84108 if : success()
@@ -90,95 +114,3 @@ jobs:
90114 - name : Cleanup
91115 if : always()
92116 run : yarn cache clean
93-
94- unit-test :
95- needs : build-artifact
96- runs-on : ubuntu-latest
97- steps :
98- - uses : actions/checkout@v4
99-
100- - name : Use Node.js
101- uses : actions/setup-node@v4
102- with :
103- node-version : ' 21.x'
104- registry-url : ' https://registry.npmjs.org'
105-
106- - name : Restore node_modules
107- uses : actions/cache/restore@v4
108- id : restore-node-modules
109- with :
110- path : |
111- node_modules
112- packages/**/node_modules
113- !node_modules/@data-story
114- !packages/*/node_modules/@data-story
115- !**/node_modules/.cache
116- !**/node_modules/**/node_modules
117-
118- key : ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
119- restore-keys : |
120- ${{ runner.os }}-modules-
121-
122- - name : Restore Cypress cache
123- uses : actions/cache/restore@v4
124- id : restore-cypress-cache
125- with :
126- path : /home/runner/.cache/Cypress
127- key : ${{ runner.os }}-cypress-${{ hashFiles('**/yarn.lock') }}
128- restore-keys : |
129- ${{ runner.os }}-cypress-
130-
131- - name : Download dist artifacts
132- uses : actions/download-artifact@v4
133- with :
134- name : dist-artifacts
135- path : packages
136-
137- - name : Run @data-story/core, @data-story/ui, @data-story/docs tests
138- run : yarn run ci:test-packages
139-
140- e2e-test :
141- needs : build-artifact
142- runs-on : ubuntu-latest
143- steps :
144- - uses : actions/checkout@v4
145-
146- - name : Use Node.js
147- uses : actions/setup-node@v4
148- with :
149- node-version : ' 21.x'
150- registry-url : ' https://registry.npmjs.org'
151-
152- - name : Restore node_modules
153- uses : actions/cache/restore@v4
154- id : restore-node-modules
155- with :
156- path : |
157- node_modules
158- packages/**/node_modules
159- !node_modules/@data-story
160- !packages/*/node_modules/@data-story
161- !**/node_modules/.cache
162- !**/node_modules/**/node_modules
163-
164- key : ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
165- restore-keys : |
166- ${{ runner.os }}-modules-
167-
168- - name : Restore Cypress cache
169- uses : actions/cache/restore@v4
170- id : restore-cypress-cache
171- with :
172- path : /home/runner/.cache/Cypress
173- key : ${{ runner.os }}-cypress-${{ hashFiles('**/yarn.lock') }}
174- restore-keys : |
175- ${{ runner.os }}-cypress-
176-
177- - name : Download build artifacts
178- uses : actions/download-artifact@v4
179- with :
180- name : dist-artifacts
181- path : packages
182-
183- - name : Run e2e tests
184- run : yarn run ci:e2e
0 commit comments