Skip to content

Commit

Permalink
refactor: update iota-private-network setup and remove tear-down action
Browse files Browse the repository at this point in the history
  • Loading branch information
itsyaasir committed Nov 25, 2024
1 parent 88a8e00 commit 157b6f9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 68 deletions.
65 changes: 28 additions & 37 deletions .github/actions/iota-rebase-sandbox/setup/action.yml
Original file line number Diff line number Diff line change
@@ -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 &
12 changes: 0 additions & 12 deletions .github/actions/iota-rebase-sandbox/tear-down/action.yml

This file was deleted.

23 changes: 4 additions & 19 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 | \
Expand All @@ -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:
Expand Down Expand Up @@ -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' }}
Expand Down Expand Up @@ -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' }}
Expand Down Expand Up @@ -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'

0 comments on commit 157b6f9

Please sign in to comment.