Skip to content

Commit

Permalink
test executor build in CI
Browse files Browse the repository at this point in the history
Signed-off-by: BAStos525 <[email protected]>
  • Loading branch information
BAStos525 committed Jul 31, 2024
1 parent f4b6081 commit 74f1e46
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 18 deletions.
81 changes: 65 additions & 16 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
- '**.lock'
- '**.py'
- '.github/workflows/iroha2-dev-pr.yml'
push:
branches: [feature/DOPS-3319/i2-genesis-executor-in-image]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -20,31 +22,54 @@ env:
CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"

jobs:
consistency:
runs-on: [self-hosted, Linux, iroha2]
# 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]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
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
- name: Build iroha executor
run: cargo run --bin iroha_wasm_builder_cli -- build ./default_executor --optimize --outfile defaults/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: configs/swarm/executor.wasm
retention-days: 1

# exclude: client/tests/integration/
with_coverage:
runs-on: [self-hosted, Linux, iroha2]
runs-on: ubuntu-latest # [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: defaults/executor.wasm
- name: Run tests, with coverage
run: |
mold --run cargo test --all-features --no-fail-fast --workspace --exclude iroha
Expand All @@ -65,25 +90,37 @@ jobs:
# include: client/tests/integration/
# exclude: client/tests/integration/extra_functional
integration:
runs-on: [self-hosted, Linux, iroha2]
runs-on: ubuntu-latest # [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: defaults/executor.wasm
- 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]
runs-on: ubuntu-latest # [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: defaults/executor.wasm
- name: Run tests
run: mold --run cargo test --no-default-features --no-fail-fast -p iroha extra_functional

Expand Down Expand Up @@ -121,12 +158,18 @@ jobs:
context: .

workspace_analysis_clippy:
runs-on: ubuntu-latest
runs-on: ubuntu-latest # [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: defaults/executor.wasm
- name: Format
run: cargo fmt --all -- --check
- name: Lints without features
Expand All @@ -145,13 +188,19 @@ jobs:
path: clippy.json

torii-api-and-client-cli-tests:
runs-on: [self-hosted, Linux, iroha2]
runs-on: ubuntu-latest # [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: defaults/executor.wasm
- name: Build binaries
run: |
cargo build -p iroha_client_cli -p kagami -p irohad
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/iroha2-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,31 @@ env:
DOCKER_COMPOSE_PATH: defaults

jobs:
build_executor:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
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_cli -- build ./default_executor --optimize --outfile defaults/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: configs/swarm/executor.wasm
retention-days: 1
registry:
runs-on: ubuntu-latest # [self-hosted, Linux, iroha2]
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm file
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: defaults/executor.wasm
- name: Set up Docker Buildx
id: buildx
if: always()
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ result
/iroha-java/
/lcov.info
**/test-smartcontracts/

defaults/executor.wasm
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ EOT
COPY --from=builder $TARGET_DIR/irohad $BIN_PATH
COPY --from=builder $TARGET_DIR/iroha $BIN_PATH
COPY --from=builder $TARGET_DIR/kagami $BIN_PATH
COPY configs/swarm/genesis.json $CONFIG_DIR
COPY configs/swarm/executor.wasm $CONFIG_DIR
COPY defaults/genesis.json $CONFIG_DIR
COPY defaults/executor.wasm $CONFIG_DIR
USER $USER
CMD ["irohad"]
2 changes: 2 additions & 0 deletions Dockerfile.glibc
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ RUN set -ex && \
COPY --from=builder $TARGET_DIR/irohad $BIN_PATH
COPY --from=builder $TARGET_DIR/iroha $BIN_PATH
COPY --from=builder $TARGET_DIR/kagami $BIN_PATH
COPY defaults/genesis.json $CONFIG_DIR
COPY defaults/executor.wasm $CONFIG_DIR
USER $USER
CMD ["irohad"]
Binary file removed defaults/executor.wasm
Binary file not shown.

0 comments on commit 74f1e46

Please sign in to comment.