Skip to content

Commit 13da8db

Browse files
author
mike dupont
committed
fixing the tests
1 parent a5910cf commit 13da8db

File tree

6 files changed

+2207
-164
lines changed

6 files changed

+2207
-164
lines changed

.github/workflows/build-action.yml

+109-30
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@ jobs:
3939

4040
- name: Build o1js
4141
if: steps.cache.outputs.cache-hit != 'true'
42+
shell: bash
4243
run: |
44+
#!/bin/bash
4345
npm ci
4446
npm run build
4547
4648
- name: Count tests
4749
id: count_tests
50+
shell: bash
4851
run: |
52+
#!/bin/bash
4953
TEST_COUNT=$(find ./dist/node -name "*.unit-test.js" | wc -l)
5054
echo "test_count=${TEST_COUNT}" >> "$GITHUB_OUTPUT"
5155
echo "Total test count: ${TEST_COUNT}"
@@ -58,22 +62,26 @@ jobs:
5862

5963
Build-And-Test-Server:
6064
needs: Prepare
61-
timeout-minutes: 210
65+
#timeout-minutes: 210
6266
runs-on: ubuntu-latest
6367
strategy:
6468
fail-fast: false
6569
matrix:
66-
test_type:
67-
[
68-
'Simple integration tests',
69-
'Reducer integration tests',
70-
'DEX integration tests',
71-
'DEX integration test with proofs',
72-
'Voting integration tests',
73-
'Verification Key Regression Check 1',
74-
'Verification Key Regression Check 2',
75-
'CommonJS test',
76-
]
70+
# prof, heap, cpu,
71+
perf: [ no, all]
72+
node_version: [ 18,20,22 ]
73+
74+
test_type:
75+
[
76+
'Simple integration tests',
77+
'Reducer integration tests',
78+
'DEX integration tests',
79+
'DEX integration test with proofs',
80+
'Voting integration tests',
81+
'Verification Key Regression Check 1',
82+
'Verification Key Regression Check 2',
83+
'CommonJS test',
84+
]
7785
steps:
7886
- name: Restore repository
7987
uses: actions/cache@v4
@@ -96,23 +104,64 @@ jobs:
96104
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.ts', '**/*.js') }}
97105

98106
- name: Prepare for tests
99-
run: touch profiling.md
107+
shell: bash
108+
run: |
109+
#!/bin/bash
110+
touch profiling.md
111+
112+
- name: Sets MODIFIED_BRANCH_NAME
113+
env:
114+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
115+
shell: bash
116+
run: |
117+
#!/bin/bash
118+
MODIFIED_BRANCH_NAME=${BRANCH_NAME/\//-}
119+
OUTPUT_DIR="profile/profile-data/${MODIFIED_BRANCH_NAME}"
120+
OUTPUT_TEST_DIR="${OUTPUT_DIR}/profile-data-${{matrix.test_type}}-${{ matrix.perf }}-${{ matrix.node_version }}"
121+
122+
echo "MODIFIED_BRANCH_NAME=${MODIFIED_BRANCH_NAME}" >> "$GITHUB_ENV"
123+
echo "OUTPUT_DIR=${OUTPUT_DIR}" >> "$GITHUB_ENV"
124+
echo "OUTPUT_TEST_DIR=${OUTPUT_TEST_DIR}" >> "$GITHUB_ENV"
125+
126+
- name: create dir
127+
shell: bash
128+
run: |
129+
#!/bin/bash
130+
mkdir -p "${{env.OUTPUT_TEST_DIR}}"
100131
101132
- name: Execute tests
102133
env:
103134
TEST_TYPE: ${{ matrix.test_type }}
104-
run: sh run-ci-tests.sh
135+
PERF_TYPE: ${{ matrix.perf }}
136+
shell: bash
137+
run: |
138+
#!/bin/bash
139+
sh run-ci-tests.sh || echo skip errors
140+
mv isolate-*-v8.log "${OUTPUT_TEST_DIR}" || echo ok
141+
mv Heap.*.heapprofile "${OUTPUT_TEST_DIR}" || echo ok
142+
mv CPU.*.cpuprofile "${OUTPUT_TEST_DIR}" || echo ok
143+
continue-on-error: true
144+
145+
- name: Upload test results
146+
if: always()
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: test-results-${{env.MODIFIED_BRANCH_NAME}}-${{ matrix.chunk }}-${{ matrix.perf }}-${{ matrix.node_version }}
150+
path: ${{env.OUTPUT_TEST_DIR}}
151+
105152

106153
- name: Add to job summary
107154
if: always()
155+
shell: bash
108156
run: |
157+
#!/bin/bash
109158
echo "### Test Results for ${{ matrix.test_type }}" >> "$GITHUB_STEP_SUMMARY"
110159
cat profiling.md >> "$GITHUB_STEP_SUMMARY"
111160
112161
Run-Unit-Tests:
113162
needs: Prepare
114163
name: Run unit tests parallel
115-
timeout-minutes: 60 # lets keep the individual jobs shorter
164+
#timeout-minutes: 60 # lets keep the individual jobs shorter
116165
runs-on: ubuntu-latest
117166
strategy:
118167
fail-fast: false
@@ -137,8 +186,7 @@ jobs:
137186

138187
- name: Setup Node
139188
uses: actions/setup-node@v4
140-
with:
141-
# FIXME change to use matrix
189+
with:
142190
node-version: ${{ matrix.node_version }}
143191

144192
- name: Restore cache
@@ -151,16 +199,24 @@ jobs:
151199
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.ts', '**/*.js') }}
152200

153201
- name: Prepare for tests
154-
run: touch profiling.md
202+
shell: bash
203+
run: |
204+
#!/bin/bash
205+
touch profiling.md
155206
- name: create dir
156-
run: mkdir -p profile/profile-data
207+
shell: bash
208+
run: |
209+
#!/bin/bash
210+
mkdir -p profile/profile-data
157211
#- name: create dirs
158212

159213
# from https://stackoverflow.com/questions/75985925/how-to-replace-slashes-with-dashes-and-set-it-an-environment-variable-in-github
160214
- name: Sets MODIFIED_BRANCH_NAME
161215
env:
162-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
216+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
217+
shell: bash
163218
run: |
219+
#!/bin/bash
164220
MODIFIED_BRANCH_NAME=${BRANCH_NAME/\//-}
165221
OUTPUT_DIR="profile/profile-data/${MODIFIED_BRANCH_NAME}"
166222
OUTPUT_TEST_DIR="${OUTPUT_DIR}/profile-data-${{matrix.chunk}}-${{ matrix.perf }}-${{ matrix.node_version }}"
@@ -170,15 +226,20 @@ jobs:
170226
echo "OUTPUT_TEST_DIR=${OUTPUT_TEST_DIR}" >> "$GITHUB_ENV"
171227
172228
- name: create dir
173-
run: mkdir -p ${{env.OUTPUT_TEST_DIR}}
229+
shell: bash
230+
run: |
231+
#!/bin/bash
232+
mkdir -p "${{env.OUTPUT_TEST_DIR}}"
174233
175234
- name: Run unit tests
176-
timeout-minutes: 30
235+
#timeout-minutes: 30
177236
env:
178237
TOTAL_TESTS: ${{ needs.Prepare.outputs.test_count }}
179238
CHUNK: ${{ matrix.chunk }}
180239
CHUNKS: 32
240+
shell: bash
181241
run: |
242+
#!/bin/bash
182243
echo "Total tests: $TOTAL_TESTS"
183244
echo "Current chunk: $CHUNK"
184245
echo "Total chunks: $CHUNKS"
@@ -228,7 +289,7 @@ jobs:
228289
# ALL
229290
if [ "${{ matrix.perf }}" == "all" ]; then
230291
echo all prof
231-
(node --prof --heap-prof --cpu-prof --expose-gc --enable-source-maps "${test_files[$i]}" | tee -a profiling.md) || echo skip errors
292+
(node "${test_files[$i]}" | tee -a profiling.md) || echo skip errors
232293
233294
fi
234295
@@ -250,7 +311,9 @@ jobs:
250311

251312
- name: Add to job summary
252313
if: always()
314+
shell: bash
253315
run: |
316+
#!/bin/bash
254317
echo "### Test Results for Unit Tests Chunk ${{ matrix.chunk }}" >> "$GITHUB_STEP_SUMMARY"
255318
cat profiling.md >> "$GITHUB_STEP_SUMMARY"
256319
@@ -259,11 +322,15 @@ jobs:
259322
needs: [Run-Unit-Tests]
260323
runs-on: ubuntu-latest
261324
steps:
262-
- run: echo "All unit tests completed successfully"
325+
326+
- run: |
327+
#!/bin/bash
328+
echo "All unit tests completed successfully"
329+
shell: bash
263330
264331
Build-And-Test-Web:
265332
needs: Prepare
266-
timeout-minutes: 90
333+
#timeout-minutes: 90
267334
runs-on: ubuntu-latest
268335
steps:
269336
- name: Restore repository
@@ -292,15 +359,23 @@ jobs:
292359

293360
- name: Install Playwright browsers
294361
if: steps.playwright-cache.outputs.cache-hit != 'true'
295-
run: npm run e2e:install
362+
run: |
363+
#!/bin/bash
364+
npm run e2e:install
365+
shell: bash
296366

297367
- name: Build o1js and prepare the web server
368+
shell: bash
298369
run: |
370+
#!/bin/bash
299371
npm run build:web
300372
npm run e2e:prepare-server
301373
302374
- name: Execute E2E tests
303-
run: npm run test:e2e
375+
shell: bash
376+
run: |
377+
#!/bin/bash
378+
npm run test:e2e
304379
- name: Upload E2E test artifacts
305380
uses: actions/upload-artifact@v4
306381
continue-on-error: true
@@ -314,7 +389,7 @@ jobs:
314389

315390
Release-on-NPM:
316391
if: github.ref == 'refs/heads/main'
317-
timeout-minutes: 180
392+
#timeout-minutes: 180
318393
runs-on: ubuntu-latest
319394
needs: [Build-And-Test-Server, Run-Unit-Tests, Build-And-Test-Web]
320395
steps:
@@ -330,7 +405,9 @@ jobs:
330405
node-version: '18'
331406

332407
- name: Build o1js
408+
shell: bash
333409
run: |
410+
#!/bin/bash
334411
npm ci
335412
npm run prepublishOnly
336413
@@ -344,7 +421,7 @@ jobs:
344421

345422
Release-mina-signer-on-NPM:
346423
if: github.ref == 'refs/heads/main'
347-
timeout-minutes: 180
424+
#timeout-minutes: 180
348425
runs-on: ubuntu-latest
349426
needs: [Build-And-Test-Server, Run-Unit-Tests, Build-And-Test-Web]
350427
steps:
@@ -360,9 +437,11 @@ jobs:
360437
node-version: '18'
361438

362439
- name: Build mina-signer
440+
shell: bash
363441
run: |
442+
#!/bin/bash
364443
npm ci
365-
cd src/mina-signer
444+
cd src/mina-signer || exit
366445
npm ci
367446
npm run prepublishOnly
368447

README-dev.md

+13
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,16 @@ To facilitate this process, use the provided script named `run-debug`. To use th
227227
This script initializes a Node.js process with the `--inspect-brk` flag that starts the Node.js inspector and breaks before the user script starts (i.e., it pauses execution until a debugger is attached). The `--enable-source-maps` flag ensures that source maps are used to allow easy debugging of o1js code directly.
228228

229229
After the Node.js process is running, open the Chrome browser and navigate to `chrome://inspect` to attach the Chrome Debugger to the Node.js process. You can set breakpoints, inspect variables, and profile the performance of your zkApp or o1js. For more information on using the Chrome Debugger, see the [DevTools documentation](https://developer.chrome.com/docs/devtools/).
230+
231+
# Profiling
232+
233+
## Github Actions
234+
235+
### Build o1js
236+
Source .github/workflows/build-action.yml
237+
238+
#### Feature Matrix
239+
240+
prof :
241+
node :
242+
test :

0 commit comments

Comments
 (0)