Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit ed5a7f8

Browse files
authored
Improve Github Actions (#6100)
* init * move build types * combine lint and esm build * fix lint tests * separate lint * independ lint * testing lint ptoblem * test lint * fix lint * move to node 18. fix lint * 16 to 18 * fix .secrets * fix * 14 to 18 for esm tests * test black box * fix node version in all tests * fix yml * try e2e_network tests * test e2e fix * remove test e2e and blackbox * fix build web * fix e2e tests * fix in all imports * black box test * fix blockbox tests * test * test * fix * fix crypto * fix * fix * fix and test * fix * fix data test * remove running on PRs * mode fix to constant only. fix actions config * fix esm-types build * test blackbox * switch off bb tests
1 parent e0acbe6 commit ed5a7f8

File tree

12 files changed

+103
-49
lines changed

12 files changed

+103
-49
lines changed

.github/workflows/black_box_tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ on:
55
- release/**
66
tags:
77
- v4.*
8+
89
jobs:
910
build:
1011
strategy:
1112
matrix:
12-
node: [14, 16]
13+
node: [18, 16]
1314
name: Build Packages
1415
runs-on: ubuntu-latest
1516
steps:
1617
- uses: actions/checkout@v3
1718
- uses: actions/setup-node@v3
1819
with:
19-
node-version: 14
20-
cache: yarn
20+
node-version: ${{ matrix.mode }}
2121
- run: yarn
2222
- run: tar -czf /tmp/web3-${{ matrix.node }}.js.tar.gz --exclude="./.git" ./
2323
- uses: actions/upload-artifact@v3
@@ -36,10 +36,13 @@ jobs:
3636
strategy:
3737
fail-fast: false
3838
matrix:
39-
node: [14, 16]
39+
node: [18, 16]
4040
mode: ['http', 'ws']
4141
backend: ['geth', 'infura']
4242
steps:
43+
- uses: actions/setup-node@v3
44+
with:
45+
node-version: ${{ matrix.node }}
4346
- uses: actions/download-artifact@v3
4447
with:
4548
name: web3-${{ matrix.node }}.js.tar.gz

.github/workflows/build.yml

Lines changed: 67 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,69 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
node: [14, 16]
18-
name: Build Packages
17+
node: [18, 16]
18+
name: Build CJS
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v3
2222
- uses: actions/setup-node@v3
2323
with:
2424
node-version: ${{ matrix.node }}
2525
cache: yarn
26-
- run: yarn
26+
- run: yarn install --ignore-scripts
27+
- run: yarn prebuild
28+
- run: yarn build:cjs
2729
- run: tar -czf /tmp/web3-${{ matrix.node }}.js.tar.gz --exclude="./.git" ./
2830
- uses: actions/upload-artifact@v3
2931
with:
3032
name: web3-${{ matrix.node }}.js.tar.gz
3133
path: /tmp/web3-${{ matrix.node }}.js.tar.gz
32-
34+
build-esm-types:
35+
name: Build ESM & Types
36+
needs: build
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
node: [ 18, 16 ]
41+
steps:
42+
- uses: actions/setup-node@v3
43+
with:
44+
node-version: ${{ matrix.node }}
45+
- uses: actions/download-artifact@v3
46+
with:
47+
name: web3-${{ matrix.node }}.js.tar.gz
48+
path: /tmp
49+
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
50+
- run: yarn build:esm
51+
- run: yarn build:types
3352
lint:
34-
name: lint
35-
needs: build
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/download-artifact@v3
39-
with:
40-
name: web3-14.js.tar.gz
41-
path: /tmp
42-
- run: tar -xf /tmp/web3-14.js.tar.gz -C ./
43-
- run: yarn lint
53+
name: Lint
54+
needs: build
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/setup-node@v3
58+
with:
59+
node-version: 18
60+
- uses: actions/download-artifact@v3
61+
with:
62+
name: web3-18.js.tar.gz
63+
path: /tmp
64+
- run: tar -xf /tmp/web3-18.js.tar.gz -C ./
65+
- run: yarn lint
4466

4567
build-web:
4668
name: Build Web
4769
needs: build
4870
runs-on: ubuntu-latest
4971
steps:
72+
- uses: actions/setup-node@v3
73+
with:
74+
node-version: 18
5075
- uses: actions/download-artifact@v3
5176
with:
52-
name: web3-16.js.tar.gz
53-
path: /tmp
54-
- run: tar -xf /tmp/web3-16.js.tar.gz -C ./
77+
name: web3-18.js.tar.gz
78+
path: /tmp
79+
- run: tar -xf /tmp/web3-18.js.tar.gz -C ./
5580
- name: Restore default branch stats
5681
if: github.event_name != 'push'
5782
uses: actions/cache/restore@v3
@@ -82,8 +107,11 @@ jobs:
82107
runs-on: ubuntu-latest
83108
strategy:
84109
matrix:
85-
node: [14, 16]
110+
node: [18, 16]
86111
steps:
112+
- uses: actions/setup-node@v3
113+
with:
114+
node-version: ${{ matrix.node }}
87115
- uses: actions/download-artifact@v3
88116
with:
89117
name: web3-${{ matrix.node }}.js.tar.gz
@@ -95,7 +123,7 @@ jobs:
95123
with:
96124
flags: UnitTests
97125
token: ${{ secrets.CODECOV_TOKEN }}
98-
if: ${{ matrix.node == 16 }}
126+
if: ${{ matrix.node == 18 }}
99127

100128
integration:
101129
name: Integration
@@ -107,10 +135,13 @@ jobs:
107135
strategy:
108136
fail-fast: false
109137
matrix:
110-
node: [14, 16]
138+
node: [18, 16]
111139
backend: ['geth', 'ganache']
112140
mode: ['http', 'ws']
113141
steps:
142+
- uses: actions/setup-node@v3
143+
with:
144+
node-version: ${{ matrix.node }}
114145
- uses: actions/download-artifact@v3
115146
with:
116147
name: web3-${{ matrix.node }}.js.tar.gz
@@ -129,10 +160,13 @@ jobs:
129160
strategy:
130161
fail-fast: false
131162
matrix:
132-
node: [ 14, 16 ]
163+
node: [ 18, 16 ]
133164
backend: [ 'geth' ]
134165
mode: [ 'ipc' ]
135166
steps:
167+
- uses: actions/setup-node@v3
168+
with:
169+
node-version: ${{ matrix.node }}
136170
- uses: actions/download-artifact@v3
137171
with:
138172
name: web3-${{ matrix.node }}.js.tar.gz
@@ -148,10 +182,13 @@ jobs:
148182
strategy:
149183
fail-fast: false
150184
matrix:
151-
node: [ 16 ]
185+
node: [ 18 ]
152186
backend: [ 'geth' ]
153187
mode: [ 'ws','ipc' ]
154188
steps:
189+
- uses: actions/setup-node@v3
190+
with:
191+
node-version: ${{ matrix.node }}
155192
- uses: actions/download-artifact@v3
156193
with:
157194
name: web3-${{ matrix.node }}.js.tar.gz
@@ -167,9 +204,12 @@ jobs:
167204
strategy:
168205
fail-fast: false
169206
matrix:
170-
node: [14, 16]
207+
node: [18, 16]
171208
browser: ['electron', 'chrome', 'firefox']
172209
steps:
210+
- uses: actions/setup-node@v3
211+
with:
212+
node-version: ${{ matrix.node }}
173213
- uses: browser-actions/setup-firefox@latest
174214
if: matrix.browser == 'firefox'
175215
- uses: actions/download-artifact@v3
@@ -191,8 +231,11 @@ jobs:
191231
runs-on: ubuntu-latest
192232
strategy:
193233
matrix:
194-
node: [ 16 ]
234+
node: [ 18 ]
195235
steps:
236+
- uses: actions/setup-node@v3
237+
with:
238+
node-version: ${{ matrix.node }}
196239
- uses: actions/download-artifact@v3
197240
with:
198241
name: web3-${{ matrix.node }}.js.tar.gz

.github/workflows/e2e_network_tests.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,23 @@ on:
55
- release/**
66
tags:
77
- v4.*
8+
89
jobs:
910
build:
10-
strategy:
11-
matrix:
12-
node: [14]
1311
name: Build Packages
1412
runs-on: ubuntu-latest
1513
steps:
1614
- uses: actions/checkout@v3
1715
- uses: actions/setup-node@v3
1816
with:
19-
node-version: 14
17+
node-version: 16
2018
cache: yarn
2119
- run: yarn
22-
- run: tar -czf /tmp/web3-${{ matrix.node }}.js.tar.gz --exclude="./.git" ./
20+
- run: tar -czf /tmp/web3-16.js.tar.gz --exclude="./.git" ./
2321
- uses: actions/upload-artifact@v3
2422
with:
25-
name: web3-${{ matrix.node }}.js.tar.gz
26-
path: /tmp/web3-${{ matrix.node }}.js.tar.gz
23+
name: web3-16.js.tar.gz
24+
path: /tmp/web3-16.js.tar.gz
2725
e2e:
2826
name: E2E Network Tests
2927
needs: build
@@ -38,15 +36,17 @@ jobs:
3836
strategy:
3937
fail-fast: false
4038
matrix:
41-
node: [14]
4239
mode: ['http']
4340
network: ['sepolia', 'mainnet']
4441
steps:
42+
- uses: actions/setup-node@v3
43+
with:
44+
node-version: 16
4545
- uses: actions/download-artifact@v3
4646
with:
47-
name: web3-${{ matrix.node }}.js.tar.gz
47+
name: web3-16.js.tar.gz
4848
path: /tmp
49-
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
49+
- run: tar -xf /tmp/web3-16.js.tar.gz -C ./
5050
- run: |
5151
yarn test:e2e:${{ matrix.network }}:${{ matrix.mode }}
5252
shell: bash

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
"bootstrap": "lerna bootstrap",
3636
"prebuild": "yarn clean && ts-node scripts/init.ts",
3737
"build": "lerna run build --stream",
38+
"build:types": "lerna run build:types --stream",
39+
"build:cjs": "lerna run build:cjs --stream",
40+
"build:esm": "lerna run build:esm --stream",
3841
"build:web": "lerna run build:web --stream",
3942
"build:web:analyze": "lerna run build:web:analyze --stream",
4043
"build:docs": "cd docs && yarn install && yarn build",

packages/web3-eth-accounts/src/account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1818
import { decrypt as createDecipheriv, encrypt as createCipheriv } from 'ethereum-cryptography/aes';
1919
import { pbkdf2Sync } from 'ethereum-cryptography/pbkdf2';
2020
import { scryptSync } from 'ethereum-cryptography/scrypt';
21-
import { secp256k1 } from 'ethereum-cryptography/secp256k1';
2221
import {
2322
InvalidKdfError,
2423
InvalidPasswordError,
@@ -57,6 +56,7 @@ import {
5756
} from 'web3-utils';
5857

5958
import { isHexStrict, isNullish, isString, validator } from 'web3-validator';
59+
import { secp256k1 } from './tx/constants';
6060
import { keyStoreSchema } from './schemas';
6161
import { TransactionFactory } from './tx/transactionFactory';
6262
import type {

packages/web3-eth-accounts/src/common/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
1515
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717
import { isHexPrefixed, isHexString } from 'web3-validator';
18-
import { secp256k1 } from 'ethereum-cryptography/secp256k1';
1918
import { bytesToHex, hexToBytes, numberToHex } from 'web3-utils';
19+
import { secp256k1 } from '../tx/constants';
2020
import { Hardfork } from './enums';
2121
import { ToBytesInputTypes, TypeOutput, TypeOutputReturnType } from './types';
2222

packages/web3-eth-accounts/src/tx/address.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ GNU Lesser General Public License for more details.
1414
You should have received a copy of the GNU Lesser General Public License
1515
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
import { secp256k1 } from 'ethereum-cryptography/secp256k1';
1817
import { keccak256 } from 'ethereum-cryptography/keccak';
1918
import { bytesToHex, uint8ArrayEquals } from 'web3-utils';
19+
import { secp256k1 } from './constants';
2020
import { assertIsUint8Array, zeros } from '../common/utils';
2121

2222
export class Address {

packages/web3-eth-accounts/src/tx/baseTransaction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

1818
import { Numbers } from 'web3-types';
19-
import { secp256k1 } from 'ethereum-cryptography/secp256k1';
2019
import { bytesToHex } from 'web3-utils';
21-
import { MAX_INTEGER, MAX_UINT64, SECP256K1_ORDER_DIV_2 } from './constants';
20+
import { MAX_INTEGER, MAX_UINT64, SECP256K1_ORDER_DIV_2, secp256k1 } from './constants';
2221
import {
2322
Chain,
2423
Common,

packages/web3-eth-accounts/src/tx/constants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ GNU Lesser General Public License for more details.
1414
You should have received a copy of the GNU Lesser General Public License
1515
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
import { secp256k1 } from 'ethereum-cryptography/secp256k1';
17+
// eslint-disable-next-line import/extensions
18+
import * as ethereumCryptography from 'ethereum-cryptography/secp256k1.js';
1819

20+
export const secp256k1 = ethereumCryptography.secp256k1 ?? ethereumCryptography;
1921
/**
2022
* 2^64-1
2123
*/
@@ -29,4 +31,4 @@ export const MAX_INTEGER = BigInt(
2931
);
3032

3133
export const SECP256K1_ORDER = secp256k1.CURVE.n;
32-
export const SECP256K1_ORDER_DIV_2 = secp256k1.CURVE.n / BigInt(2);
34+
export const SECP256K1_ORDER_DIV_2 = SECP256K1_ORDER / BigInt(2);

packages/web3-eth-accounts/test/unit/tx/base.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ GNU Lesser General Public License for more details.
1414
You should have received a copy of the GNU Lesser General Public License
1515
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
import { secp256k1 } from 'ethereum-cryptography/secp256k1';
1817
import { bytesToUint8Array, hexToBytes, uint8ArrayEquals } from 'web3-utils';
1918
import {
2019
AccessListEIP2930Transaction,
@@ -23,7 +22,7 @@ import {
2322
Transaction,
2423
} from '../../../src';
2524
import { Chain, Common, Hardfork, toUint8Array, uint8ArrayToBigInt } from '../../../src/common';
26-
import { MAX_INTEGER, MAX_UINT64, SECP256K1_ORDER } from '../../../src/tx/constants';
25+
import { MAX_INTEGER, MAX_UINT64, SECP256K1_ORDER, secp256k1 } from '../../../src/tx/constants';
2726

2827
import type { BaseTransaction } from '../../../src/tx/baseTransaction';
2928
import eip1559Fixtures from '../../fixtures/json/eip1559txs.json';

0 commit comments

Comments
 (0)