Skip to content

Commit

Permalink
ci: Build executor.wasm in CI (#4931)
Browse files Browse the repository at this point in the history
* ci: Build executor.wasm in CI
* ci: update build executor workflows
* feat(swarm): map genesis and client configs
* ci: remove executor build from TESTS::UI
---------
Signed-off-by: BAStos525 <[email protected]>
Signed-off-by: Nurzhan Sakén <[email protected]>
Signed-off-by: BAStos525 <[email protected]>
Co-authored-by: Nurzhan Sakén <[email protected]>
  • Loading branch information
BAStos525 authored Aug 26, 2024
1 parent c3b6815 commit 3506d31
Show file tree
Hide file tree
Showing 18 changed files with 377 additions and 120 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/iroha2-dev-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,39 @@ name: I2::Dev::Nightly::Publish

on: workflow_dispatch

env:
DOCKER_COMPOSE_PATH: defaults

jobs:
build_executor:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

dockerhub:
runs-on: ubuntu-latest
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/iroha2-dev-pr-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,39 @@ concurrency:

env:
RUSTUP_TOOLCHAIN: nightly-2024-04-18
DOCKER_COMPOSE_PATH: defaults

jobs:
build_executor:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

smart_contracts_analysis:
runs-on: ubuntu-latest
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Default executor format
run: |
cd ./wasm_samples/default_executor
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/iroha2-dev-pr-wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,39 @@ concurrency:

env:
RUSTUP_TOOLCHAIN: nightly-2024-04-18
DOCKER_COMPOSE_PATH: defaults

jobs:
build_executor:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

tests:
runs-on: ubuntu-latest
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Install iroha_wasm_test_runner
run: cargo install --path tools/wasm_test_runner
- name: Run smart contract tests on WebAssembly VM
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,37 @@ jobs:
if: always()
run: ./scripts/tests/consistency.sh docker-compose

build_executor:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

# exclude: client/tests/integration/
with_coverage:
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Run tests, with coverage
run: |
mold --run cargo test --all-features --no-fail-fast --workspace --exclude iroha
Expand All @@ -72,24 +95,36 @@ jobs:
# exclude: client/tests/integration/extra_functional
integration:
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Run tests, with no-default-features
run: mold --run cargo test --no-default-features --no-fail-fast -p iroha integration -- --skip extra_functional

# include: client/tests/integration/extra_functional
extra_functional:
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Run tests
run: mold --run cargo test --no-default-features --no-fail-fast -p iroha extra_functional

Expand Down Expand Up @@ -128,11 +163,17 @@ jobs:

workspace_analysis_clippy:
runs-on: ubuntu-latest
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Format
run: cargo fmt --all -- --check
- name: Lints without features
Expand All @@ -152,10 +193,16 @@ jobs:

torii-api-client-cli-tests:
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand Down
74 changes: 40 additions & 34 deletions .github/workflows/iroha2-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,39 @@ on:
env:
CARGO_TERM_COLOR: always
DOCKER_COMPOSE_PATH: defaults
ARTIFACTS_DIR: tmp/artifacts
BIN_PATH: /usr/local/bin

jobs:
registry:
build_executor:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

registry_save_build_artifacts:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
needs: build_executor
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Set up Docker Buildx
id: buildx
if: always()
Expand Down Expand Up @@ -42,40 +69,19 @@ jobs:
labels: commit=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

archive_binaries_and_schema:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build
run: mold --run cargo build --release --verbose
- name: Archive iroha
uses: actions/upload-artifact@v3
with:
name: cargo-build-release
path: target/release/iroha
- name: Archive Iroha client CLI
uses: actions/upload-artifact@v3
with:
name: cargo-client-cli-build-release
path: target/release/iroha
- name: Archive kagami
uses: actions/upload-artifact@v3
with:
name: cargo-crypto-cli-build-release
path: target/release/kagami
- name: Generate schema
- name: Copy artifacts from iroha image
run: |
mkdir -p target/schema
cargo run --bin kagami -- schema >target/schema/schema.json
- name: Archive schema
uses: actions/upload-artifact@v3
mkdir -p ${{ env.ARTIFACTS_DIR }}
docker run --rm --entrypoint cat hyperledger/iroha:dev ${{ env.BIN_PATH }}/iroha > ${{ env.ARTIFACTS_DIR }}/iroha
docker run --rm --entrypoint cat hyperledger/iroha:dev ${{ env.BIN_PATH }}/irohad > ${{ env.ARTIFACTS_DIR }}/irohad
docker run --rm --entrypoint cat hyperledger/iroha:dev ${{ env.BIN_PATH }}/kagami > ${{ env.ARTIFACTS_DIR }}/kagami
- name: Generate schema
run: cargo run --bin kagami -- schema > ${{ env.ARTIFACTS_DIR }}/schema.json
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: schema
path: target/schema
name: iroha_binaries_and_schema
path: ${{ env.ARTIFACTS_DIR }}

telemetry:
# FIXME #2646
Expand Down Expand Up @@ -125,7 +131,7 @@ jobs:
github_token: ${{ secrets.github_token }}
continue-on-error: true
- name: Archive telemetry
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: telemetry
path: target/telemetry
30 changes: 30 additions & 0 deletions .github/workflows/iroha2-profiling-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,39 @@ env:
IROHA2_RUSTFLAGS: -C force-frame-pointers=on
IROHA2_FEATURES: profiling
IROHA2_CARGOFLAGS: -Z build-std
DOCKER_COMPOSE_PATH: defaults

jobs:
build_executor:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

registry-profiling-image:
if: ${{ inputs.BUILD_GLIBC_IMAGE == 'false' }}
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Get the release tag
run: |
RELEASE_VERSION=${{ github.ref_name }}
Expand Down Expand Up @@ -80,12 +104,18 @@ jobs:
registry-glibc-image:
if: ${{ inputs.BUILD_GLIBC_IMAGE == 'true' }}
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.CHECKOUT_REF }}
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Login to Soramitsu Harbor
uses: docker/login-action@v3
with:
Expand Down
Loading

0 comments on commit 3506d31

Please sign in to comment.