From 1dea4c02ae575101024541538156d3f86b4dcf65 Mon Sep 17 00:00:00 2001 From: Konstantinos Demartinos Date: Fri, 13 Dec 2024 11:55:13 +0200 Subject: [PATCH] fix(ci): use dedicated rosetta config dir (#4473) * fix(ci): use dedicated rosetta config dir * Add rosetta workflow and diff tag * dprint * validation --------- Co-authored-by: Chloe Martin --- .github/actions/diffs/action.yml | 3 ++ .github/scripts/rosetta/setup.sh | 8 +++-- .github/workflows/_rosetta.yml | 55 +++++++++++++++++++++++++++++++ .github/workflows/_rust_tests.yml | 33 ------------------- .github/workflows/hierarchy.yml | 12 +++++++ 5 files changed, 76 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/_rosetta.yml diff --git a/.github/actions/diffs/action.yml b/.github/actions/diffs/action.yml index c7bc240b392..f940c9b26d9 100644 --- a/.github/actions/diffs/action.yml +++ b/.github/actions/diffs/action.yml @@ -59,6 +59,9 @@ runs: - "examples/**" - "iota_programmability/**" - ".github/workflows/_move_tests.yml" + isRosetta: + - ".github/scripts/rosetta/**" + - "crates/iota-rosetta/**" isExternalCrates: - "external-crates/move/crates/**" isReleaseNotesEligible: diff --git a/.github/scripts/rosetta/setup.sh b/.github/scripts/rosetta/setup.sh index 6ad5bef07a6..308006ca289 100755 --- a/.github/scripts/rosetta/setup.sh +++ b/.github/scripts/rosetta/setup.sh @@ -7,11 +7,15 @@ echo "Install binaries" cargo install --locked --bin iota --path crates/iota cargo install --locked --bin iota-rosetta --path crates/iota-rosetta +echo "create dedicated config dir for IOTA genesis" +CONFIG_DIR="~/.iota/rosetta_config" +mkdir -p $CONFIG_DIR + echo "run IOTA genesis" -iota genesis +iota genesis -f --working-dir $CONFIG_DIR echo "generate rosetta configuration" iota-rosetta generate-rosetta-cli-config --online-url http://127.0.0.1:9002 --offline-url http://127.0.0.1:9003 echo "install rosetta-cli" -curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s \ No newline at end of file +curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s diff --git a/.github/workflows/_rosetta.yml b/.github/workflows/_rosetta.yml new file mode 100644 index 00000000000..423158a1f47 --- /dev/null +++ b/.github/workflows/_rosetta.yml @@ -0,0 +1,55 @@ +name: Rosetta validation + +on: workflow_call + +concurrency: + group: rosetta-validation-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }} + +env: + CARGO_TERM_COLOR: always + RUST_LOG: "error" + # Don't emit giant backtraces in the CI logs. + RUST_BACKTRACE: short + CARGO_INCREMENTAL: 0 + # Allow more retries for network requests in cargo (downloading crates) and + # rustup (installing toolchains). This should help to reduce flaky CI failures + # from transient network timeouts or other issues. + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + # RUSTFLAGS: -D warnings + RUSTDOCFLAGS: -D warnings + +jobs: + validation: + timeout-minutes: 45 + runs-on: [self-hosted] + steps: + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + + - name: Setup environment + run: .github/scripts/rosetta/setup.sh + shell: bash + + - name: Start local IOTA network + run: | + iota start --no-full-node & + shell: bash + + - name: Start Rosetta servers + run: .github/scripts/rosetta/start_rosetta.sh + shell: bash + + - name: Sleep for 20 seconds + run: sleep 20s + shell: bash + + - name: Run check:construction test + run: | + ./bin/rosetta-cli --configuration-file rosetta_cli.json check:construction + shell: bash + + - name: Run check:data test + run: | + ./bin/rosetta-cli --configuration-file rosetta_cli.json check:data + shell: bash diff --git a/.github/workflows/_rust_tests.yml b/.github/workflows/_rust_tests.yml index da2303c56e4..75a96614c06 100644 --- a/.github/workflows/_rust_tests.yml +++ b/.github/workflows/_rust_tests.yml @@ -159,39 +159,6 @@ jobs: eval ${command} - rosetta-validation: - timeout-minutes: 45 - runs-on: [self-hosted] - steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Setup environment - run: .github/scripts/rosetta/setup.sh - shell: bash - - - name: Start local IOTA network - run: | - iota start --no-full-node & - shell: bash - - - name: Start Rosetta servers - run: .github/scripts/rosetta/start_rosetta.sh - shell: bash - - - name: Sleep for 20 seconds - run: sleep 20s - shell: bash - - - name: Run check:construction test - run: | - ./bin/rosetta-cli --configuration-file rosetta_cli.json check:construction - shell: bash - - - name: Run check:data test - run: | - ./bin/rosetta-cli --configuration-file rosetta_cli.json check:data - shell: bash - graphql-rpc: name: graphql-rpc timeout-minutes: 45 diff --git a/.github/workflows/hierarchy.yml b/.github/workflows/hierarchy.yml index 9c61f02a77d..c5def7a8b1b 100644 --- a/.github/workflows/hierarchy.yml +++ b/.github/workflows/hierarchy.yml @@ -20,6 +20,7 @@ jobs: outputs: isRust: ${{ steps.diff.outputs.isRust }} isMove: ${{ steps.diff.outputs.isMove }} + isRosetta: ${{ steps.diff.outputs.isRosetta }} isDoc: ${{ steps.diff.outputs.isDoc }} isReleaseNotesEligible: ${{ steps.diff.outputs.isReleaseNotesEligible }} isExternalCrates: ${{ steps.diff.outputs.isExternalCrates }} @@ -107,6 +108,17 @@ jobs: with: isRust: ${{ needs.diff.outputs.isRust == 'true' }} + rosetta: + needs: + - diff + - dprint-format + - license-check + - typos + if: | + !cancelled() && !failure() && + (needs.diff.outputs.isRosetta == 'true' || needs.diff.outputs.isRust == 'true') + uses: ./.github/workflows/_rosetta.yml + e2e: if: (!cancelled() && !failure() && (!github.event.pull_request.draft || github.ref_name == 'develop')) needs: