From 32b8e30c450c68553be7b429919c623de920faf2 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Mon, 25 Mar 2024 17:02:04 +0100 Subject: [PATCH] Use sandbox action --- .../actions/private-tangle/setup/action.yml | 47 ------------------- .../private-tangle/tear-down/action.yml | 14 ------ .github/workflows/bindings-wasm.yml | 17 +++++-- .github/workflows/coverage.yml | 18 +++++-- .github/workflows/private-tangle-tests.yml | 17 +++++-- .github/workflows/protocol_parameters.json | 13 +++++ sdk/tests/client/common/constants.rs | 4 +- sdk/tests/wallet/common/constants.rs | 4 +- 8 files changed, 56 insertions(+), 78 deletions(-) delete mode 100644 .github/actions/private-tangle/setup/action.yml delete mode 100644 .github/actions/private-tangle/tear-down/action.yml create mode 100644 .github/workflows/protocol_parameters.json diff --git a/.github/actions/private-tangle/setup/action.yml b/.github/actions/private-tangle/setup/action.yml deleted file mode 100644 index 5061735206..0000000000 --- a/.github/actions/private-tangle/setup/action.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: 'private-tangle-setup' -description: 'Setup a private tangle' -runs: - using: "composite" - steps: - - name: Clone private tangle files - uses: actions/checkout@v3 - with: - repository: iotaledger/hornet - path: hornet - - - name: Setup private tangle - shell: bash - run: | - # TODO: use next lines when a working hornet release is published - # # Download the private_tangle setup from the hornet repo. - # mkdir private_tangle - # cd private_tangle - # # Use the output of https://api.github.com/repos/iotaledger/hornet/releases/latest once there's a 2.0 Hornet release. - # DOWNLOAD_URL=$(curl "https://api.github.com/repos/iotaledger/hornet/releases" | jq -r '.[0].assets[] | select(.name | contains("private_tangle")) | .browser_download_url') - # echo "Downloading private tangle from $DOWNLOAD_URL" - # curl -L -o private_tangle.tar.gz $DOWNLOAD_URL - # tar -xf private_tangle.tar.gz - # TODO: remove next lines when a working hornet release is published - # Set protocol_parameters to the same values as in the shimmer network - jq '.tokenSupply="1813620509061365" | .rentStructure.vByteCost=100 | .bech32HRP="rms"' protocol_parameters.json > tmp.json && mv tmp.json protocol_parameters.json - jq --color-output . protocol_parameters.json - - # Reduce milestone interval to 1 second - yq eval '.services.inx-coordinator.command += "--coordinator.interval=1s"' docker-compose.yml > tmp.yml && mv tmp.yml docker-compose.yml - jq --color-output . config_private_tangle.json - # Start Tangle - sudo ./cleanup.sh - sudo ./bootstrap.sh - sudo ./run.sh -d --quiet-pull - working-directory: hornet/private_tangle - - - name: Wait for tangle to start - shell: bash - run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost:14265/health -- echo "Tangle is up" - env: - WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3 - - name: Wait for faucet to start - shell: bash - run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost:8091/api/info -- echo "Faucet is up" - env: - WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3 diff --git a/.github/actions/private-tangle/tear-down/action.yml b/.github/actions/private-tangle/tear-down/action.yml deleted file mode 100644 index cf46081319..0000000000 --- a/.github/actions/private-tangle/tear-down/action.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'private-tangle-tear-down' -description: 'tear-down a private tangle' -runs: - using: "composite" - steps: - - name: Tear down private tangle - shell: bash - run: | - # TODO: use next line when a working hornet release is published - #cd private_tangle - - # TODO: remove next line when a working hornet release is published - sudo ./cleanup.sh - working-directory: hornet/private_tangle diff --git a/.github/workflows/bindings-wasm.yml b/.github/workflows/bindings-wasm.yml index 98404b019b..ca14887e7f 100644 --- a/.github/workflows/bindings-wasm.yml +++ b/.github/workflows/bindings-wasm.yml @@ -44,6 +44,9 @@ jobs: name: Test if: ${{ ! github.event.schedule }} runs-on: ${{ matrix.os }} + env: + # Set env for Sandbox action + COMPOSE_PROFILES: inx-faucet,inx-indexer,inx-mqtt strategy: fail-fast: false matrix: @@ -82,9 +85,13 @@ jobs: working-directory: bindings/wasm/ run: yarn build - - name: Start private tangle + - name: Start Sandbox if: ${{ startsWith(matrix.os, 'ubuntu') }} - uses: "./.github/actions/private-tangle/setup" + uses: 'iotaledger/iota-sandbox/.github/actions/setup@add-action' + with: + branch: add-action + protocol_parameters: .github/workflows/protocol_parameters.json + milestone_interval: 1s - name: Run Yarn Test if: ${{ startsWith(matrix.os, 'ubuntu') }} @@ -97,9 +104,11 @@ jobs: # Only run test that doesn't require a node because we can't use the private tangle script on macos and windows run: yarn test -t 'Wallet methods' - - name: Tear down private tangle + - name: Tear down Sandbox if: ${{ startsWith(matrix.os, 'ubuntu') }} - uses: "./.github/actions/private-tangle/tear-down" + uses: 'iotaledger/iota-sandbox/.github/actions/tear-down@add-action' + with: + branch: add-action lint: name: Lint diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index af6926267c..520e29354f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,7 +22,9 @@ concurrency: jobs: collect-coverage: runs-on: ubuntu-latest - + env: + # Set env for Sandbox action + COMPOSE_PROFILES: inx-faucet,inx-indexer,inx-mqtt steps: - uses: actions/checkout@v3 @@ -48,8 +50,12 @@ jobs: - name: Install nextest uses: taiki-e/install-action@nextest - - name: Start private tangle - uses: "./.github/actions/private-tangle/setup" + - name: Start Sandbox + uses: 'iotaledger/iota-sandbox/.github/actions/setup@add-action' + with: + branch: add-action + protocol_parameters: .github/workflows/protocol_parameters.json + milestone_interval: 1s - name: Start ledger nano uses: "./.github/actions/ledger-nano" @@ -57,9 +63,11 @@ jobs: - name: Collect coverage data run: cargo ci-coverage - - name: Tear down private tangle + - name: Tear down Sandbox if: always() - uses: "./.github/actions/private-tangle/tear-down" + uses: 'iotaledger/iota-sandbox/.github/actions/tear-down@add-action' + with: + branch: add-action - name: Upload coverage data to Coveralls uses: coverallsapp/github-action@v2.2.1 diff --git a/.github/workflows/private-tangle-tests.yml b/.github/workflows/private-tangle-tests.yml index e38b3f5866..0005ad454d 100644 --- a/.github/workflows/private-tangle-tests.yml +++ b/.github/workflows/private-tangle-tests.yml @@ -36,6 +36,9 @@ env: jobs: crate: runs-on: ${{ matrix.os }} + env: + # Set env for Sandbox action + COMPOSE_PROFILES: inx-faucet,inx-indexer,inx-mqtt strategy: fail-fast: false matrix: @@ -58,8 +61,12 @@ jobs: - name: Cache dependencies uses: Swatinem/rust-cache@v2 - - name: Start private tangle - uses: "./.github/actions/private-tangle/setup" + - name: Start Sandbox + uses: 'iotaledger/iota-sandbox/.github/actions/setup@add-action' + with: + branch: add-action + protocol_parameters: .github/workflows/protocol_parameters.json + milestone_interval: 1s - name: Start ledger nano uses: "./.github/actions/ledger-nano" @@ -67,6 +74,8 @@ jobs: - name: Run tests run: cargo ci-tangle-test - - name: Tear down private tangle + - name: Tear down Sandbox if: always() - uses: "./.github/actions/private-tangle/tear-down" + uses: 'iotaledger/iota-sandbox/.github/actions/tear-down@add-action' + with: + branch: add-action diff --git a/.github/workflows/protocol_parameters.json b/.github/workflows/protocol_parameters.json new file mode 100644 index 0000000000..996df0565b --- /dev/null +++ b/.github/workflows/protocol_parameters.json @@ -0,0 +1,13 @@ +{ + "version": 2, + "networkName": "sandbox1", + "bech32HRP": "snd", + "minPoWScore": 0, + "belowMaxDepth": 15, + "rentStructure": { + "vByteCost": 100, + "vByteFactorData": 1, + "vByteFactorKey": 10 + }, + "tokenSupply": "1813620509061365" +} \ No newline at end of file diff --git a/sdk/tests/client/common/constants.rs b/sdk/tests/client/common/constants.rs index 73f3acba5a..40f71b7888 100644 --- a/sdk/tests/client/common/constants.rs +++ b/sdk/tests/client/common/constants.rs @@ -1,6 +1,6 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -pub static NODE_LOCAL: &str = "http://localhost:14265"; +pub static NODE_LOCAL: &str = "http://localhost"; -pub static FAUCET_URL: &str = "http://localhost:8091/api/enqueue"; +pub static FAUCET_URL: &str = "http://localhost/faucet/api/enqueue"; diff --git a/sdk/tests/wallet/common/constants.rs b/sdk/tests/wallet/common/constants.rs index d6f42ee747..e45c7138af 100644 --- a/sdk/tests/wallet/common/constants.rs +++ b/sdk/tests/wallet/common/constants.rs @@ -3,9 +3,9 @@ #![allow(dead_code)] -pub static NODE_LOCAL: &str = "http://localhost:14265"; +pub static NODE_LOCAL: &str = "http://localhost"; pub static NODE_OTHER: &str = "http://some.not.default.node:14265"; pub static DEFAULT_MNEMONIC: &str = "inhale gorilla deny three celery song category owner lottery rent author wealth penalty crawl hobby obtain glad warm early rain clutch slab august bleak"; -pub static FAUCET_URL: &str = "http://localhost:8091/api/enqueue"; +pub static FAUCET_URL: &str = "http://localhost/faucet/api/enqueue";