Skip to content

Commit

Permalink
ci: Build executor.wasm in CI
Browse files Browse the repository at this point in the history
Signed-off-by: BAStos525 <[email protected]>
  • Loading branch information
BAStos525 committed Aug 2, 2024
1 parent 0dc4949 commit 488ec65
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 154 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
59 changes: 30 additions & 29 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,46 @@ concurrency:
env:
CARGO_TERM_COLOR: always
CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"
DOCKER_COMPOSE_PATH: defaults

jobs:
# consistency:
# runs-on: [self-hosted, Linux, iroha2]
# container:
# image: hyperledger/iroha2-ci:nightly-2024-04-18
# steps:
# - uses: actions/checkout@v4
# - uses: Swatinem/rust-cache@v2
# - name: Check genesis.json
# if: always()
# run: ./scripts/tests/consistency.sh genesis
# - name: Check schema.json
# if: always()
# run: ./scripts/tests/consistency.sh schema
# - name: Check Docker Compose configurations
# if: always()
# run: ./scripts/tests/consistency.sh docker-compose
consistency:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Check genesis.json
if: always()
run: ./scripts/tests/consistency.sh genesis
- name: Check schema.json
if: always()
run: ./scripts/tests/consistency.sh schema
- name: Check Docker Compose configurations
if: always()
run: ./scripts/tests/consistency.sh docker-compose

build_executor:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
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 defaults/executor.wasm
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: defaults/executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

# exclude: client/tests/integration/
with_coverage:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
Expand All @@ -69,7 +70,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: defaults
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 @@ -90,7 +91,7 @@ jobs:
# include: client/tests/integration/
# exclude: client/tests/integration/extra_functional
integration:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
Expand All @@ -102,13 +103,13 @@ jobs:
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: defaults
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: ubuntu-latest # [self-hosted, Linux, iroha2]
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
Expand All @@ -120,7 +121,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: defaults
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 @@ -158,7 +159,7 @@ jobs:
context: .

workspace_analysis_clippy:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
Expand All @@ -169,7 +170,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: defaults
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Format
run: cargo fmt --all -- --check
- name: Lints without features
Expand All @@ -188,7 +189,7 @@ jobs:
path: clippy.json

torii-api-and-client-cli-tests:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
Expand All @@ -200,7 +201,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: defaults
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Build binaries
run: |
cargo build -p iroha_client_cli -p kagami -p irohad
Expand Down
Loading

0 comments on commit 488ec65

Please sign in to comment.