From a8a2027601768845c4a0cc0ef3fadd98ff3daa6d Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Thu, 3 Oct 2024 09:57:11 +0300 Subject: [PATCH 1/5] chain sim - setup --- .github/workflows/contracts.yml | 2 +- Makefile | 4 ++++ docker-compose.yml | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100644 docker-compose.yml diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index e56bdf8..fb937fb 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -268,7 +268,7 @@ jobs: env: RUSTFLAGS: "" run: - cargo test + make slow-tests clippy_check: name: Clippy linter check diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f6453b8 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +slow-tests: + @docker compose -f docker-compose.yml build + @docker compose -f docker-compose.yml up & cargo test --features chain_simulator --quiet + @docker compose -f docker-compose.yml down -v \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..59bc14e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: "3.9" + +services: + chain-simulator: + image: multiversx/chainsimulator:latest + ports: + - 8085:8085 + volumes: + - "../scripts:/docker/scripts" + entrypoint: "./chainsimulator -log-level *:INFO" \ No newline at end of file From 345bdeacbe714d65c50324e45c308c61b7738b76 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Thu, 3 Oct 2024 10:08:00 +0300 Subject: [PATCH 2/5] chain sim - setup --- Makefile | 4 ---- docker-compose.yml | 10 ---------- 2 files changed, 14 deletions(-) delete mode 100644 Makefile delete mode 100644 docker-compose.yml diff --git a/Makefile b/Makefile deleted file mode 100644 index f6453b8..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -slow-tests: - @docker compose -f docker-compose.yml build - @docker compose -f docker-compose.yml up & cargo test --features chain_simulator --quiet - @docker compose -f docker-compose.yml down -v \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 59bc14e..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: "3.9" - -services: - chain-simulator: - image: multiversx/chainsimulator:latest - ports: - - 8085:8085 - volumes: - - "../scripts:/docker/scripts" - entrypoint: "./chainsimulator -log-level *:INFO" \ No newline at end of file From ff9d6f66718bf771530df53c230592531e8d4e8b Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Fri, 4 Oct 2024 11:54:29 +0300 Subject: [PATCH 3/5] build contracts for rust tests --- .github/workflows/contracts.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index fb937fb..405185e 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -264,6 +264,11 @@ jobs: with: toolchain: ${{ inputs.rust-toolchain }} + - name: Build the wasm contracts + env: + RUSTFLAGS: "" + run: sc-meta all build --no-imports --target-dir $(pwd)/target --path . + - name: Run the rust tests env: RUSTFLAGS: "" From 70a701e7b7af7b8bc5d674889dfbc1145b5daf8c Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Fri, 4 Oct 2024 12:10:19 +0300 Subject: [PATCH 4/5] chain sim - interactor job --- .github/workflows/contracts.yml | 59 +++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 405185e..b5e7262 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -121,8 +121,8 @@ jobs: RUSTFLAGS: "" run: | sc-meta all build-dbg --twiggy-paths --target-dir $(pwd)/target --path . - mxpy contract report --skip-build --skip-twiggy --output-format json --output-file mxpy_report.json - + mxpy contract report --skip-build --skip-twiggy --output-format json --output-file mxpy_report.json + - name: Generate the contract report via sc-meta if: ${{ inputs.enable-contracts-size-report }} env: @@ -135,8 +135,8 @@ jobs: uses: actions/upload-artifact@v3 with: name: mxpy_report - path: mxpy_report.json - + path: mxpy_report.json + - name: Upload the report json from sc-meta if: ${{ inputs.enable-contracts-size-report }} uses: actions/upload-artifact@v3 @@ -196,6 +196,49 @@ jobs: body: ${{ steps.template.outputs.result }} edit-mode: replace + interactor_tests: + name: Interactor tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ inputs.rust-toolchain }} + target: wasm32-unknown-unknown + + - name: Install prerequisites + run: | + wget -O binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/${{ inputs.binaryen-version }}/binaryen-${{ inputs.binaryen-version }}-x86_64-linux.tar.gz + tar -xf binaryen.tar.gz + cp binaryen-${{ inputs.binaryen-version }}/bin/wasm-opt $HOME/.local/bin + + cargo install wasm-opt + cargo install twiggy + + if [[ "${{ inputs.path-to-sc-meta }}" ]]; + then + cargo install --path ${{ inputs.path-to-sc-meta }} + elif [[ -z "${{ inputs.sc-meta-version }}" ]]; + then + cargo install multiversx-sc-meta --locked + else + cargo install multiversx-sc-meta --version ${{ inputs.sc-meta-version }} --locked + fi + + which wasm-opt + + - name: Build the wasm contracts + env: + RUSTFLAGS: "" + run: sc-meta all build --no-imports --target-dir $(pwd)/target --path . + + - name: Run the interactor tests + env: + RUSTFLAGS: "" + run: make slow-tests + test_coverage: name: Test Coverage runs-on: ubuntu-latest @@ -264,16 +307,10 @@ jobs: with: toolchain: ${{ inputs.rust-toolchain }} - - name: Build the wasm contracts - env: - RUSTFLAGS: "" - run: sc-meta all build --no-imports --target-dir $(pwd)/target --path . - - name: Run the rust tests env: RUSTFLAGS: "" - run: - make slow-tests + run: cargo test clippy_check: name: Clippy linter check From 4ec1f927bd99ed90a816ded805daa75fd2040258 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Wed, 16 Oct 2024 10:39:13 +0300 Subject: [PATCH 5/5] chain sim - rename makefile --- .github/workflows/contracts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 14b3f27..2aa27e1 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -214,7 +214,7 @@ jobs: - name: Run the interactor tests env: RUSTFLAGS: "" - run: make slow-tests + run: make chain-simulator test_coverage: name: Test Coverage