Skip to content

Commit ed1e8a7

Browse files
authored
Merge pull request #1653 from PhilippeR26/CI/release
Ci/release
2 parents e86e37a + 06235ce commit ed1e8a7

11 files changed

Lines changed: 208 additions & 140 deletions

File tree

.github/workflows/_test.yml

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ on:
1818
# vX_Y
1919
type: string
2020
secrets:
21-
TEST_NODE_URL:
22-
required: false
23-
TEST_WS_JUNO:
21+
# Base domain of the Starknet Foundation nodes (bare host, no scheme or path).
22+
# Not needed when use-devnet is set.
23+
SNF_NODE_URL:
2424
required: false
2525
TEST_ACCOUNT_PRIVATE_KEY:
2626
required: false
@@ -40,11 +40,12 @@ jobs:
4040
- 5050:5050
4141

4242
env:
43-
PROTOCOL: ${{ inputs.protocol == 'WS' && 'wss' || 'https' }}
43+
USE_DEVNET: ${{ inputs.use-devnet }}
44+
IS_WS: ${{ inputs.protocol == 'WS' }}
4445
NODE: ${{ inputs.node == 'Juno' && 'juno' || inputs.node == 'Pathfinder' && 'pathfinder' || '' }}
4546
VERSION: ${{ inputs.version }}
4647

47-
NODE_URL: ${{ secrets.TEST_NODE_URL }}
48+
SNF_NODE_URL: ${{ secrets.SNF_NODE_URL }}
4849
TEST_ACCOUNT_PRIVATE_KEY: ${{ secrets.TEST_ACCOUNT_PRIVATE_KEY }}
4950
TEST_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS }}
5051

@@ -57,21 +58,43 @@ jobs:
5758
- run: npm ci --ignore-scripts
5859
- run: npm run pretest && npm run posttest
5960
if: ${{ !inputs.ignore-scripts }}
60-
- id: env-modification
61-
name: env modification
61+
- id: node-url
62+
name: resolve node urls
63+
# Against the devnet service started above, the url is fixed. Otherwise the
64+
# urls are built from the Starknet Foundation base domain:
65+
# https://sepolia.<domain>/<node>/rpc/<version>
66+
# wss://sepolia.<domain>/<node>/ws/<version>
67+
# The WS suites also drive an account, so an rpc url is always needed.
6268
run: |
63-
echo "::add-mask::$FORMATED_URL"
64-
echo "NODE_URL=$FORMATED_URL" >> "$GITHUB_OUTPUT"
65-
env:
66-
FORMATED_URL: ${{ format(env.NODE_URL, env.PROTOCOL, env.NODE, env.VERSION) }}
69+
if [ "$USE_DEVNET" = 'true' ]; then
70+
rpc_url='http://127.0.0.1:5050/rpc'
71+
elif [ -n "$SNF_NODE_URL" ] && [ -n "$NODE" ] && [ -n "$VERSION" ]; then
72+
base="sepolia.$SNF_NODE_URL/$NODE"
73+
rpc_url="https://$base/rpc/$VERSION"
74+
echo "::add-mask::$rpc_url"
75+
if [ "$IS_WS" = 'true' ]; then
76+
ws_url="wss://$base/ws/$VERSION"
77+
echo "::add-mask::$ws_url"
78+
fi
79+
else
80+
echo "::error::No node url available: set use-devnet, or provide the node and version inputs together with the SNF_NODE_URL secret."
81+
exit 1
82+
fi
83+
echo "rpc-url=$rpc_url" >> "$GITHUB_OUTPUT"
84+
echo "ws-url=$ws_url" >> "$GITHUB_OUTPUT"
6785
- id: run-tests
6886
name: run tests
6987
run: |
7088
args=()
71-
[[ "${{ inputs.protocol }}" == "WS" ]] && args+=( '__tests__/WebSocket' )
72-
npm run test:coverage "${args[@]}"
89+
# --forceExit: the WebSocket suite exercises auto-reconnection against a
90+
# live gateway that (on Pathfinder) never completes the closing handshake
91+
# of a still-subscribed socket, leaving an open handle that would keep
92+
# Jest from exiting after the run completes. The `--` lets npm forward the
93+
# flag through to Jest.
94+
[[ "${{ inputs.protocol }}" == "WS" ]] && args+=( '--forceExit' '__tests__/WebSocket' )
95+
npm run test:coverage -- "${args[@]}"
7396
env:
74-
TEST_RPC_URL: ${{ inputs.protocol != 'WS' && steps.env-modification.outputs.NODE_URL || null }}
75-
TEST_WS_URL: ${{ inputs.protocol == 'WS' && (env.NODE == 'juno' && secrets.TEST_WS_JUNO || steps.env-modification.outputs.NODE_URL) || null }}
97+
TEST_RPC_URL: ${{ steps.node-url.outputs.rpc-url }}
98+
TEST_WS_URL: ${{ steps.node-url.outputs.ws-url }}
7699
TEST_ACCOUNT_PRIVATE_KEY: ${{ secrets.TEST_ACCOUNT_PRIVATE_KEY }}
77100
TEST_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS }}

.github/workflows/manual-tests-devnet.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,9 @@ on:
99

1010
jobs:
1111
tests:
12-
name: Run test on ${{ matrix.name }}
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
include:
17-
- name: rpc-devnet
18-
TEST_NODE_URL: http://127.0.0.1:5050/rpc
12+
name: Run test on rpc-devnet
1913

2014
uses: ./.github/workflows/_test.yml
2115
with:
22-
use-devnet: ${{ matrix.TEST_NODE_URL != '' }}
16+
use-devnet: true
2317
ignore-scripts: ${{ inputs.ignore-scripts }}
24-
secrets:
25-
TEST_NODE_URL: ${{ matrix.TEST_NODE_URL }}

.github/workflows/release.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,14 @@ concurrency:
4747

4848
jobs:
4949
tests-dev:
50-
name: Run test on ${{ matrix.name }}
50+
name: Run test on rpc-devnet
5151
if: |
5252
github.event_name != 'workflow_dispatch'
5353
&& contains(fromJSON('["beta","develop","next-version"]'), github.base_ref || github.ref_name)
54-
strategy:
55-
fail-fast: false
56-
matrix:
57-
include:
58-
- name: rpc-devnet
59-
TEST_NODE_URL: http://127.0.0.1:5050/rpc
6054
6155
uses: ./.github/workflows/_test.yml
6256
with:
63-
use-devnet: ${{ matrix.TEST_NODE_URL != '' }}
64-
secrets:
65-
TEST_NODE_URL: ${{ matrix.TEST_NODE_URL }}
57+
use-devnet: true
6658

6759
tests-main:
6860
name: Run test on ${{ matrix.node }} ${{ matrix.protocol }} ${{ matrix.version }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ node_modules
1313
npm-debug.log
1414
package
1515
yarn.lock
16+
target

__mocks__/cairo/cairo2170/proofResult.json

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)