From 157b6f91c2a8c80e9508196f18ef9d0dc74c8322 Mon Sep 17 00:00:00 2001 From: Yasir Date: Mon, 25 Nov 2024 16:43:42 +0300 Subject: [PATCH] refactor: update iota-private-network setup and remove tear-down action --- .../iota-rebase-sandbox/setup/action.yml | 65 ++++++++----------- .../iota-rebase-sandbox/tear-down/action.yml | 12 ---- .github/workflows/build-and-test.yml | 23 ++----- 3 files changed, 32 insertions(+), 68 deletions(-) delete mode 100644 .github/actions/iota-rebase-sandbox/tear-down/action.yml diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index ea5531fb5..8d20a1ae3 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -1,48 +1,39 @@ name: "iota-private-network setup" description: "Setup IOTA Sandbox" +inputs: + platform: + description: "Platform to download binary for (linux or macos)" + required: true + default: "linux" + runs: using: composite steps: - - name: Checkout IOTA repository - uses: actions/checkout@v3 - with: - repository: "iotaledger/iota" - ref: "develop" - path: "iota" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: list files - shell: bash - run: ls -la docker/iota-private-network - - - name: build docker images + - name: Set up IOTA Node shell: bash run: | - cd docker/iota-private-network - ../iota-node/build.sh -t iota-node --no-cache - ../iota-indexer/build.sh -t iota-indexer --no-cache - ../iota-tools/build.sh -t iota-tools --no-cache - - - name: Bootstrap the network - shell: bash - run: ./bootstrap.sh - working-directory: iota/docker/iota-private-network + # Install dependencies + mkdir -p iota + cd iota + + # Select platform-specific asset + if [ "${{ inputs.platform }}" = "linux" ]; then + PLATFORM_FILTER="contains(\"linux\")" + else + PLATFORM_FILTER="contains(\"macos\")" + fi + + # Get download URL for specified platform + DOWNLOAD_URL=$(curl "https://api.github.com/repos/iotaledger/iota/releases" | \ + jq -r --arg filter "$PLATFORM_FILTER" \ + '.[0].assets[] | select(.name | contains("iota") and ($filter | eval)) | .browser_download_url') + + # Download and extract + curl -L -o iota.tar.gz $DOWNLOAD_URL + tar -xzf iota.tar.gz - name: Start the Network shell: bash - run: ./run.sh faucet - working-directory: iota/docker/iota-private-network - - - name: Wait for iota network to start - shell: bash - run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://127.0.0.1:9000 -- echo "IOTA full node 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://127.0.0.1:5003 -- echo "Faucet is up" - env: - WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3 - + working-directory: iota + run: ./iota start --with-faucet --force-regenesis & diff --git a/.github/actions/iota-rebase-sandbox/tear-down/action.yml b/.github/actions/iota-rebase-sandbox/tear-down/action.yml deleted file mode 100644 index 383adf39a..000000000 --- a/.github/actions/iota-rebase-sandbox/tear-down/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: "iota-private-network-tear-down" -description: "tear-down a iota private network" -runs: - using: "composite" - steps: - - name: Tear down iota sandbox - shell: bash - run: | - cd iota/docker/iota-private-network - docker compose down - cd ../.. - sudo rm -rf iota diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 721991934..4f1993f2c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -130,17 +130,19 @@ jobs: run: cargo build --workspace --tests --examples --release - name: Start iota sandbox - if: matrix.os == 'ubuntu-latest' + if: matrix.os != 'windows-latest' uses: './.github/actions/iota-rebase-sandbox/setup' + with: + platform: ${{ matrix.os == 'ubuntu-latest' && 'linux' || 'macos' }} - name: Run tests excluding `custom_time` feature + if: matrix.os != 'windows-latest' run: cargo test --workspace --release - name: Run tests with `custom_time` feature run: cargo test --test custom_time --features="custom_time" - name: Run Rust examples - # run examples only on ubuntu for now if: matrix.os == 'ubuntu-latest' run: | cargo metadata --format-version 1 --manifest-path ./examples/Cargo.toml | \ @@ -150,17 +152,12 @@ jobs: cat report.log - name: Run Rust Readme examples - # run examples only on ubuntu for now if: matrix.os == 'ubuntu-latest' run: | cd bindings/wasm npm ci npm run test:readme:rust - - name: Tear down iota sandbox - if: matrix.os == 'ubuntu-latest' && always() - uses: './.github/actions/iota-rebase-sandbox/tear-down' - - name: Stop sccache uses: './.github/actions/rust/sccache/stop-sccache' with: @@ -210,10 +207,6 @@ jobs: run: npm run test:readme && npm run test:node working-directory: bindings/wasm - - name: Tear down iota sandbox - if: always() - uses: './.github/actions/iota-rebase-sandbox/tear-down' - test-wasm-firefox: needs: build-wasm if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }} @@ -258,10 +251,6 @@ jobs: - name: Run cypress run: docker run --network host cypress-test test:browser:parallel:firefox - - name: Tear down iota sandbox - if: always() - uses: './.github/actions/iota-rebase-sandbox/tear-down' - test-wasm-chrome: needs: build-wasm if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' }} @@ -305,7 +294,3 @@ jobs: - name: Run cypress run: docker run --network host cypress-test test:browser:parallel:chrome - - - name: Tear down iota sandbox - if: always() - uses: './.github/actions/iota-rebase-sandbox/tear-down'