From 72c23193dc6864d372664df12c5869de50cf7884 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 15:04:21 +0200 Subject: [PATCH 01/17] fix: broken examples Signed-off-by: Ivaylo Nikolov --- examples/create-contract-with-value.js | 4 ++-- examples/create-simple-contract.js | 2 +- examples/create-stateful-contract.js | 6 +++--- examples/exempt-custom-fees.js | 6 +++--- examples/long-term-schedule-transaction.js | 1 + examples/mint-big-number-of-units-of-token.js | 2 +- examples/mirror-node-contract-queries-example.js | 2 ++ examples/solidity-precompile-example.js | 10 +++++----- examples/zeroTokenOperations.js | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/examples/create-contract-with-value.js b/examples/create-contract-with-value.js index 58b871033..c293a505e 100644 --- a/examples/create-contract-with-value.js +++ b/examples/create-contract-with-value.js @@ -13,7 +13,7 @@ import dotenv from "dotenv"; dotenv.config(); // Import the compiled contract -import payableContract from "./payable.json" assert { type: "json" }; +import payableContract from "./payable.json" with { type: "json" }; async function main() { if ( @@ -126,7 +126,7 @@ async function main() { .freezeWithSigner(wallet); await contractDeleteTransaction.signWithSigner(wallet); const contractDeleteResult = - await transaction.executeWithSigner(wallet); + await contractDeleteTransaction.executeWithSigner(wallet); // Delete the contract // Note: The admin key of the contract needs to sign the transaction diff --git a/examples/create-simple-contract.js b/examples/create-simple-contract.js index 0d2afc15e..e7e74d943 100644 --- a/examples/create-simple-contract.js +++ b/examples/create-simple-contract.js @@ -13,7 +13,7 @@ import dotenv from "dotenv"; dotenv.config(); // Import the compiled contract -import helloWorld from "./hello_world.json" assert { type: "json" }; +import helloWorld from "./hello_world.json" with { type: "json" }; async function main() { if ( diff --git a/examples/create-stateful-contract.js b/examples/create-stateful-contract.js index 057238a81..16b3cedf0 100644 --- a/examples/create-stateful-contract.js +++ b/examples/create-stateful-contract.js @@ -14,7 +14,7 @@ import dotenv from "dotenv"; dotenv.config(); // Import the compiled contract -import stateful from "./stateful.json" assert { type: "json" }; +import stateful from "./stateful.json" with { type: "json" }; async function main() { if ( @@ -70,7 +70,7 @@ async function main() { ), ) // Set gas to create the contract - .setGas(100000) + .setGas(150000) // The contract bytecode must be set to the file ID containing the contract bytecode .setBytecodeFileId(fileId) // Set the admin key on the contract in case the contract should be deleted or @@ -150,7 +150,7 @@ async function main() { .freezeWithSigner(wallet); await contractExecuteTransaction.signWithSigner(wallet); const contractExecTransactionResponse = - await transaction.executeWithSigner(wallet); + await contractExecuteTransaction.executeWithSigner(wallet); await contractExecTransactionResponse.getReceiptWithSigner(wallet); diff --git a/examples/exempt-custom-fees.js b/examples/exempt-custom-fees.js index 75db4e55b..5351307b5 100644 --- a/examples/exempt-custom-fees.js +++ b/examples/exempt-custom-fees.js @@ -74,7 +74,7 @@ async function main() { const firstAccountWallet = new Wallet( firstAccountId, firstAccountPrivateKey, - new LocalProvider(), + provider, ); let secondAccountPrivateKey = PrivateKey.generateED25519(); @@ -93,7 +93,7 @@ async function main() { const secondAccountWallet = new Wallet( secondAccountId, secondAccountPrivateKey, - new LocalProvider(), + provider, ); let thirdAccountPrivateKey = PrivateKey.generateED25519(); @@ -112,7 +112,7 @@ async function main() { const thirdAccountWallet = new Wallet( thirdAccountId, thirdAccountPrivateKey, - new LocalProvider(), + provider, ); /** diff --git a/examples/long-term-schedule-transaction.js b/examples/long-term-schedule-transaction.js index 62aa27913..ec1d2f28c 100644 --- a/examples/long-term-schedule-transaction.js +++ b/examples/long-term-schedule-transaction.js @@ -204,6 +204,7 @@ async function main() { ); console.log("Long Term Scheduled Transaction Example Complete!"); + client.close(); } main().catch(console.error); diff --git a/examples/mint-big-number-of-units-of-token.js b/examples/mint-big-number-of-units-of-token.js index 40c0caf84..bf244fec6 100644 --- a/examples/mint-big-number-of-units-of-token.js +++ b/examples/mint-big-number-of-units-of-token.js @@ -14,7 +14,7 @@ import dotenv from "dotenv"; dotenv.config(); async function main() { - const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); const operatorId = AccountId.fromString(process.env.OPERATOR_ID); const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( diff --git a/examples/mirror-node-contract-queries-example.js b/examples/mirror-node-contract-queries-example.js index 0e3200685..8190cf793 100644 --- a/examples/mirror-node-contract-queries-example.js +++ b/examples/mirror-node-contract-queries-example.js @@ -93,6 +93,8 @@ async function main() { const decodedStringMessage = decodedSimulationResult[0]; console.log("Simulation result: " + decodedStringMessage); console.log("Contract call result: " + result.getString(0)); + + client.close(); } void main(); diff --git a/examples/solidity-precompile-example.js b/examples/solidity-precompile-example.js index 90be64ef2..7e294f89e 100644 --- a/examples/solidity-precompile-example.js +++ b/examples/solidity-precompile-example.js @@ -1,6 +1,6 @@ import * as hashgraph from "@hashgraph/sdk"; import ContractHelper from "./ContractHelper.js"; -import contract from "./precompile-example/PrecompileExample.json" assert { type: "json" }; +import contract from "./precompile-example/PrecompileExample.json" with { type: "json" }; import dotenv from "dotenv"; dotenv.config(); @@ -24,7 +24,7 @@ async function main() { provider, ); - const operatorPrivateKey = hashgraph.PrivateKey.fromStringDer( + const operatorPrivateKey = hashgraph.PrivateKey.fromStringED25519( process.env.OPERATOR_KEY, ); const operatorPublicKey = operatorPrivateKey.publicKey; @@ -50,7 +50,7 @@ async function main() { const walletWithAlice = new hashgraph.Wallet( aliceAccountId, alicePrivateKey, - new hashgraph.LocalProvider(), + provider, ); // Instantiate ContractHelper @@ -207,9 +207,9 @@ async function main() { console.log("All steps completed with valid results."); } catch (error) { console.error(error); + } finally { + provider.close(); } - - provider.close(); } void main(); diff --git a/examples/zeroTokenOperations.js b/examples/zeroTokenOperations.js index 4f390a661..987029a9d 100644 --- a/examples/zeroTokenOperations.js +++ b/examples/zeroTokenOperations.js @@ -2,7 +2,7 @@ import * as hashgraph from "@hashgraph/sdk"; import ContractHelper from "./ContractHelper.js"; -import contract from "./precompile-example/ZeroTokenOperations.json" assert { type: "json" }; +import contract from "./precompile-example/ZeroTokenOperations.json" with { type: "json" }; import dotenv from "dotenv"; dotenv.config(); From dce7796fe020968cf87af12edaabc74b8304e3a0 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 15:05:02 +0200 Subject: [PATCH 02/17] exclude broken examples Signed-off-by: Ivaylo Nikolov --- examples/run-all-examples.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/run-all-examples.js b/examples/run-all-examples.js index da0182d71..a01be874b 100644 --- a/examples/run-all-examples.js +++ b/examples/run-all-examples.js @@ -12,7 +12,11 @@ const excludedDirectories = [ "./react-native-example", "./simple_rest_signature_provider", ]; -const excludedJSFile = "run-all-examples.js"; +const excludedJSFile = [ + "run-all-examples.js", + "consensus-pub-sub.js", + "create-update-delete-node.js", +]; const cmd = process.env.NODE_COMMAND; fs.readdir(examplesDirectory, (err, files) => { @@ -36,7 +40,7 @@ fs.readdir(examplesDirectory, (err, files) => { const examples = files.filter( (file) => file.endsWith(".js") && - file !== excludedJSFile && + !excludedJSFile.includes(file) && excludedDirectories.some( (directory) => !isPathStartsWith(directory, file), ), @@ -57,7 +61,7 @@ fs.readdir(examplesDirectory, (err, files) => { console.log(`✅ Successfully executed.`); } else { failed += 1; - console.error(`❌ Failed.`); + throw new Error("Task failed"); } }); From 8a1e9cad70e50788c796be72347f9f506164e1c4 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 15:05:26 +0200 Subject: [PATCH 03/17] ci: run examples on push/new pr Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4ff739f5..f67e1ad70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -173,3 +173,6 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true + + - name: Run all еxamples + run: task run:examples \ No newline at end of file From 093ef6ceb27f90c6e8e705e6e7dd1d88dacd69ba Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 15:39:26 +0200 Subject: [PATCH 04/17] ci: run examples Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f67e1ad70..59768ab24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,5 +174,48 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - - name: Run all еxamples - run: task run:examples \ No newline at end of file + run-examples: + name: Run examples using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-medium + strategy: + matrix: + node: [ "20" ] + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Start the local node + id: start-local-node + if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} + run: | + ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 + sleep 30 + + - name: Run all еxamples + run: task run:examples + + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + + - name: Stop the local node + id: stop-local-node + if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop \ No newline at end of file From 5874654668b50635a3f8893c4c57b7a5a34ad5fc Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 15:43:41 +0200 Subject: [PATCH 05/17] ci: job fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 84 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59768ab24..d96638194 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,48 +174,48 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - run-examples: - name: Run examples using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-medium - strategy: - matrix: - node: [ "20" ] - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit - - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + examples: + name: Run examples using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-medium + strategy: + matrix: + node: [ "20" ] + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 with: - submodules: recursive + egress-policy: audit - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 - - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 - - - name: Start the local node - id: start-local-node - if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} - run: | - ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 - sleep 30 - - - name: Run all еxamples - run: task run:examples - - - name: Build @hashgraph/sdk - id: build-sdk - run: task build + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Start the local node + id: start-local-node + if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} + run: | + ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 + sleep 30 + + - name: Run all еxamples + run: task run:examples - - name: Stop the local node - id: stop-local-node - if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop \ No newline at end of file + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + + - name: Stop the local node + id: stop-local-node + if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop \ No newline at end of file From db627ecc2e979db7a15a329e679be9b96a843bcf Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 15:51:01 +0200 Subject: [PATCH 06/17] ci: fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d96638194..17094cebf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,9 +182,9 @@ jobs: node: [ "20" ] steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From 29755d88d79894cc9d8d9da5b2e41e041eb2be7b Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 16:40:46 +0200 Subject: [PATCH 07/17] ci: fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17094cebf..63155d6b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,8 +178,8 @@ jobs: name: Run examples using Node ${{ matrix.node }} runs-on: hiero-client-sdk-linux-medium strategy: - matrix: - node: [ "20" ] + matrix: + node: [ "20" ] steps: - name: Harden Runner uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 From 2003ea48ab87e63ddef47fb19f3de91c235a6578 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 16:41:56 +0200 Subject: [PATCH 08/17] ci: fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63155d6b7..16a2590e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,7 +184,7 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 with: - egress-policy: audit + egress-policy: audit - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From 9645262a4d3c9726d9cdd566d2242ca8059049ff Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 16:46:06 +0200 Subject: [PATCH 09/17] ci: add node Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16a2590e9..a3ddd7a22 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -191,6 +191,12 @@ jobs: with: submodules: recursive + - name: Setup Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm + - name: Install Task uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 with: From 59f025261923659b6d0bfbfe4ad59debdcc869ac Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 16:47:28 +0200 Subject: [PATCH 10/17] ci: reorder pnpm and node Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3ddd7a22..64af55ee3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -191,12 +191,6 @@ jobs: with: submodules: recursive - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - name: Install Task uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 with: @@ -206,6 +200,12 @@ jobs: uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 with: version: 8.15.4 + + - name: Setup Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm - name: Start the local node id: start-local-node From 77ed96049c38f75469bdeb4904357260368502e0 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 16:50:42 +0200 Subject: [PATCH 11/17] ci: install deps in examples Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64af55ee3..94cd74bb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -214,6 +214,11 @@ jobs: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 sleep 30 + - name: Install dependencies + run: | + pnpm i + working-directory: examples + - name: Run all еxamples run: task run:examples From 8f29ae3e58b2aa9454c6db30f39554d0623a9dee Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 17:03:24 +0200 Subject: [PATCH 12/17] ci: fixes Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 444 ++++++++++++++++++------------------ 1 file changed, 222 insertions(+), 222 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94cd74bb1..e9764ad47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,232 +1,232 @@ name: Build & Test on: - push: - branches: - - main - - develop - - release/* - - integration-test-workflow - pull_request: - branches: - - main - - develop - - release/* + push: + branches: + - main + - develop + - release/* + - integration-test-workflow + pull_request: + branches: + - main + - develop + - release/* defaults: - run: - shell: bash + run: + shell: bash permissions: - contents: read - pull-requests: write + contents: read + pull-requests: write env: - CG_EXEC: ionice -c 2 -n 2 nice -n 19 + CG_EXEC: ionice -c 2 -n 2 nice -n 19 jobs: - build: - name: Build using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-medium - strategy: - matrix: - node: [ "20", "22" ] - - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit - - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: true - - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 - - # Note: After Step-Security is enabled return to step-security/action-setup version - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 - - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - - name: Build @hashgraph/sdk - run: task -v build - - test: - name: Test using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-large - strategy: - matrix: - node: [ "20" ] - - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit - - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive - - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 - - - name: "Create env file" - run: | - touch .env - echo OPERATOR_KEY="302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> .env - echo OPERATOR_ID="0.0.2" >> .env - echo HEDERA_NETWORK="local-node" >> .env - cat .env - - # Note: After Step-Security is enabled return to step-security/action-setup version - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 - - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - - name: Build @hashgraph/sdk - id: build-sdk - run: task build - - - name: Install Playwright Dependencies - id: playwright-deps - if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} - run: sudo npx playwright install-deps - - - name: Start the local node - id: start-local-node - if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} - run: | - ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 - # Wait for the network to fully start - sleep 30 - - - name: Run Hedera SDK Integration Tests - if: ${{ steps.build-sdk.conclusion == 'success' && steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:integration:codecov - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage/lcov.info - fail_ci_if_error: false - - - name: Stop the local node - id: stop-local-node - if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop - - - name: Build @hashgraph/cryptography - working-directory: packages/cryptography - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task build - - - name: Unit Test @hashgraph/cryptography - working-directory: packages/cryptography - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit - - - name: Codecov @hashgraph/cryptography - working-directory: packages/cryptography - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit:codecov - - - name: Upload @hashgraph/cryptography coverage to Codecov - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/cryptography/coverage/lcov.info - fail_ci_if_error: false - - - name: Unit Test @hashgraph/sdk - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && steps.playwright-deps.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit - - - name: Codecov @hashgraph/sdk - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit:codecov - - - name: Upload @hashgraph/sdk coverage to Codecov - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - - examples: - name: Run examples using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-medium - strategy: - matrix: - node: [ "20" ] - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit - - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive - - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 - - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 - - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - - name: Start the local node - id: start-local-node - if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} - run: | - ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 - sleep 30 - - - name: Install dependencies - run: | - pnpm i - working-directory: examples - - - name: Run all еxamples - run: task run:examples - - - name: Build @hashgraph/sdk - id: build-sdk - run: task build - - - name: Stop the local node - id: stop-local-node - if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop \ No newline at end of file + build: + name: Build using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-medium + strategy: + matrix: + node: ["20", "22"] + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + # Note: After Step-Security is enabled return to step-security/action-setup version + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Setup Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm + + - name: Build @hashgraph/sdk + run: task -v build + + test: + name: Test using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-large + strategy: + matrix: + node: ["20"] + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + - name: "Create env file" + run: | + touch .env + echo OPERATOR_KEY="302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> .env + echo OPERATOR_ID="0.0.2" >> .env + echo HEDERA_NETWORK="local-node" >> .env + cat .env + + # Note: After Step-Security is enabled return to step-security/action-setup version + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Setup Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm + + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + + - name: Install Playwright Dependencies + id: playwright-deps + if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} + run: sudo npx playwright install-deps + + - name: Start the local node + id: start-local-node + if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} + run: | + ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 + # Wait for the network to fully start + sleep 30 + + - name: Run Hedera SDK Integration Tests + if: ${{ steps.build-sdk.conclusion == 'success' && steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:integration:codecov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info + fail_ci_if_error: false + + - name: Stop the local node + id: stop-local-node + if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop + + - name: Build @hashgraph/cryptography + working-directory: packages/cryptography + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task build + + - name: Unit Test @hashgraph/cryptography + working-directory: packages/cryptography + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit + + - name: Codecov @hashgraph/cryptography + working-directory: packages/cryptography + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit:codecov + + - name: Upload @hashgraph/cryptography coverage to Codecov + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./packages/cryptography/coverage/lcov.info + fail_ci_if_error: false + + - name: Unit Test @hashgraph/sdk + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && steps.playwright-deps.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit + + - name: Codecov @hashgraph/sdk + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit:codecov + + - name: Upload @hashgraph/sdk coverage to Codecov + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + + examples: + name: Run examples using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-medium + strategy: + matrix: + node: ["20"] + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Setup Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm + + - name: Start the local node + id: start-local-node + if: ${{ !cancelled() && always() }} + run: | + cd examples + ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 + sleep 30 + + - name: Install dependencies + run: | + pnpm i + + - name: Run all еxamples + run: task run:examples + + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + + - name: Stop the local node + id: stop-local-node + if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop From c7b4849c920553664569c185f823133eb4ea065c Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 17:20:19 +0200 Subject: [PATCH 13/17] ci: build sdk Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9764ad47..65b2e3313 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -207,25 +207,25 @@ jobs: node-version: ${{ matrix.node }} cache: pnpm + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + - name: Start the local node id: start-local-node if: ${{ !cancelled() && always() }} run: | - cd examples ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 sleep 30 - name: Install dependencies run: | + cd examples pnpm i - name: Run all еxamples run: task run:examples - - name: Build @hashgraph/sdk - id: build-sdk - run: task build - - name: Stop the local node id: stop-local-node if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} From ac61f1eb04e2f37d49f8646a65c941004e10bb4f Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Tue, 28 Jan 2025 17:49:17 +0200 Subject: [PATCH 14/17] style: formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 99 ++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65b2e3313..b336da028 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,59 +174,58 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - examples: - name: Run examples using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-medium - strategy: - matrix: - node: ["20"] - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit + examples: + name: Run examples using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-medium + strategy: + matrix: + node: [ "20" ] + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: recursive - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 - - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 - - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - - name: Build @hashgraph/sdk - id: build-sdk - run: task build - - - name: Start the local node - id: start-local-node - if: ${{ !cancelled() && always() }} - run: | - ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 - sleep 30 - - - name: Install dependencies - run: | - cd examples - pnpm i - - - name: Run all еxamples - run: task run:examples - - - name: Stop the local node - id: stop-local-node - if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Setup Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm + + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + + - name: Start the local node + id: start-local-node + if: ${{ !cancelled() && always() }} + run: | + ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 + sleep 30 + + - name: Install dependencies + run: | + cd examples + pnpm i + + - name: Run all еxamples + run: task run:examples + - name: Stop the local node + id: stop-local-node + if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop From b6e35a791251ae658b586b27a57c528081d55d86 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Wed, 29 Jan 2025 11:28:00 +0200 Subject: [PATCH 15/17] style: fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 310 ++++++++++++++++++------------------ 1 file changed, 155 insertions(+), 155 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b336da028..c16fcaa7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,179 +1,179 @@ name: Build & Test on: - push: - branches: - - main - - develop - - release/* - - integration-test-workflow - pull_request: - branches: - - main - - develop - - release/* + push: + branches: + - main + - develop + - release/* + - integration-test-workflow + pull_request: + branches: + - main + - develop + - release/* defaults: - run: - shell: bash + run: + shell: bash permissions: - contents: read - pull-requests: write + contents: read + pull-requests: write env: - CG_EXEC: ionice -c 2 -n 2 nice -n 19 + CG_EXEC: ionice -c 2 -n 2 nice -n 19 jobs: - build: - name: Build using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-medium - strategy: - matrix: - node: ["20", "22"] - - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit + build: + name: Build using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-medium + strategy: + matrix: + node: [ "20", "22" ] - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: true + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true - # Note: After Step-Security is enabled return to step-security/action-setup version - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - - name: Build @hashgraph/sdk - run: task -v build - - test: - name: Test using Node ${{ matrix.node }} - runs-on: hiero-client-sdk-linux-large - strategy: - matrix: - node: ["20"] - - steps: - - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 - with: - egress-policy: audit + # Note: After Step-Security is enabled return to step-security/action-setup version + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive + - name: Setup Node + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - version: 3.35.1 - - - name: "Create env file" - run: | - touch .env - echo OPERATOR_KEY="302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> .env - echo OPERATOR_ID="0.0.2" >> .env - echo HEDERA_NETWORK="local-node" >> .env - cat .env - - # Note: After Step-Security is enabled return to step-security/action-setup version - - name: Install PNPM - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 - with: - version: 8.15.4 + - name: Build @hashgraph/sdk + run: task -v build - - name: Setup Node - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - - name: Build @hashgraph/sdk - id: build-sdk - run: task build - - - name: Install Playwright Dependencies - id: playwright-deps - if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} - run: sudo npx playwright install-deps - - - name: Start the local node - id: start-local-node - if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} - run: | - ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 - # Wait for the network to fully start - sleep 30 - - - name: Run Hedera SDK Integration Tests - if: ${{ steps.build-sdk.conclusion == 'success' && steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:integration:codecov - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage/lcov.info - fail_ci_if_error: false - - - name: Stop the local node - id: stop-local-node - if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop - - - name: Build @hashgraph/cryptography - working-directory: packages/cryptography - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task build - - - name: Unit Test @hashgraph/cryptography - working-directory: packages/cryptography - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit - - - name: Codecov @hashgraph/cryptography - working-directory: packages/cryptography - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit:codecov - - - name: Upload @hashgraph/cryptography coverage to Codecov - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/cryptography/coverage/lcov.info - fail_ci_if_error: false + test: + name: Test using Node ${{ matrix.node }} + runs-on: hiero-client-sdk-linux-large + strategy: + matrix: + node: [ "20" ] - - name: Unit Test @hashgraph/sdk - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && steps.playwright-deps.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit - - name: Codecov @hashgraph/sdk - if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} - run: ${{ env.CG_EXEC }} task test:unit:codecov + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive - - name: Upload @hashgraph/sdk coverage to Codecov - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.35.1 + + - name: "Create env file" + run: | + touch .env + echo OPERATOR_KEY="302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> .env + echo OPERATOR_ID="0.0.2" >> .env + echo HEDERA_NETWORK="local-node" >> .env + cat .env + + # Note: After Step-Security is enabled return to step-security/action-setup version + - name: Install PNPM + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + with: + version: 8.15.4 + + - name: Setup Node + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: ${{ matrix.node }} + cache: pnpm + + - name: Build @hashgraph/sdk + id: build-sdk + run: task build + + - name: Install Playwright Dependencies + id: playwright-deps + if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} + run: sudo npx playwright install-deps + + - name: Start the local node + id: start-local-node + if: ${{ steps.build-sdk.conclusion == 'success' && !cancelled() && always() }} + run: | + ${{ env.CG_EXEC }} npx @hashgraph/hedera-local start -d -—network local --balance=100000 --network-tag=0.57.0 + # Wait for the network to fully start + sleep 30 + + - name: Run Hedera SDK Integration Tests + if: ${{ steps.build-sdk.conclusion == 'success' && steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:integration:codecov + - name: Upload coverage to Codecov + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info + fail_ci_if_error: false + + - name: Stop the local node + id: stop-local-node + if: ${{ steps.start-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} npx @hashgraph/hedera-local stop + + - name: Build @hashgraph/cryptography + working-directory: packages/cryptography + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task build + + - name: Unit Test @hashgraph/cryptography + working-directory: packages/cryptography + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit + + - name: Codecov @hashgraph/cryptography + working-directory: packages/cryptography + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit:codecov + + - name: Upload @hashgraph/cryptography coverage to Codecov + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./packages/cryptography/coverage/lcov.info + fail_ci_if_error: false + + - name: Unit Test @hashgraph/sdk + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && steps.playwright-deps.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit + + - name: Codecov @hashgraph/sdk + if: ${{ steps.build-sdk.conclusion == 'success' && steps.stop-local-node.conclusion == 'success' && !cancelled() && always() }} + run: ${{ env.CG_EXEC }} task test:unit:codecov + + - name: Upload @hashgraph/sdk coverage to Codecov + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + examples: name: Run examples using Node ${{ matrix.node }} runs-on: hiero-client-sdk-linux-medium From 3a6c654c31dab302dd3fd94085791dcefa93efd7 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Wed, 29 Jan 2025 11:33:56 +0200 Subject: [PATCH 16/17] style: fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c16fcaa7b..419096d1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,10 +186,10 @@ jobs: with: egress-policy: audit - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive - name: Install Task uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 From cf82867c0c167c0d5afd19833f28a9dfc185d684 Mon Sep 17 00:00:00 2001 From: Ivaylo Nikolov Date: Wed, 29 Jan 2025 11:35:24 +0200 Subject: [PATCH 17/17] style: fix formatting Signed-off-by: Ivaylo Nikolov --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 419096d1b..a4d7473da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -189,7 +189,7 @@ jobs: - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - submodules: recursive + submodules: recursive - name: Install Task uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 @@ -204,8 +204,8 @@ jobs: - name: Setup Node uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 with: - node-version: ${{ matrix.node }} - cache: pnpm + node-version: ${{ matrix.node }} + cache: pnpm - name: Build @hashgraph/sdk id: build-sdk