Skip to content

Commit

Permalink
[ci] hyperledger-iroha#3578: Add client cli tests into stable workflow (
Browse files Browse the repository at this point in the history
hyperledger-iroha#3998)

* [ci] Add client_cli_test into stable workflow

Signed-off-by: alexstroke <111361420+astrokov7@users.noreply.github.com>

* [ci]: add allure

Signed-off-by: BAStos525 <jungle.vas@yandex.ru>

---------

Signed-off-by: alexstroke <111361420+astrokov7@users.noreply.github.com>
Signed-off-by: BAStos525 <jungle.vas@yandex.ru>
Co-authored-by: BAStos525 <jungle.vas@yandex.ru>
  • Loading branch information
AlexStroke and BAStos525 authored Oct 23, 2023
1 parent 0e13452 commit 1ea5f31
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 67 deletions.
27 changes: 8 additions & 19 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ concurrency:

env:
CARGO_TERM_COLOR: always
CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"

jobs:
consistency:
Expand Down Expand Up @@ -131,12 +132,11 @@ jobs:
# This context specification is required
context: .

client-cli-test:
client-cli-tests:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
timeout-minutes: 60

steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -145,31 +145,20 @@ jobs:
cargo build --bin iroha_client_cli
cargo build --bin kagami
cargo build --bin iroha
- name: Mark binaries as executable
run: |
chmod +x $CLIENT_CLI_DIR/
- name: Run Iroha 2 on bare metal
- name: Setup test Iroha 2 environment on the bare metal
run: |
./scripts/test_env.py setup
- name: Copy Iroha 2 client config
run: |
cp ./configs/client/config.json $CLIENT_CLI_DIR/
- name: Set up .env for client_cli tests
- name: Mark binaries as executable
run: |
echo "CLIENT_CLI_DIR=$CLIENT_CLI_DIR" >> ./client_cli/pytests/.env
echo "TORII_API_PORT_MIN=8080" >> ./client_cli/pytests/.env
echo "TORII_API_PORT_MAX=8083" >> ./client_cli/pytests/.env
chmod +x ${{ env.CLIENT_CLI_DIR }}
- name: Install dependencies using Poetry
working-directory: client_cli/pytests
run: |
poetry install
- name: Run client cli tests
working-directory: client_cli/pytests
run: |
poetry run pytest
- name: Cleanup test environment
run: |
./scripts/test_env.py cleanup
60 changes: 34 additions & 26 deletions .github/workflows/iroha2-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,50 @@ concurrency:

env:
CARGO_TERM_COLOR: always
CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"
ALLURE_RESULTS: "${{ github.workspace }}/allure-results"
ALLURE_JOB_RUN_ID: ${{ github.event.inputs.ALLURE_JOB_RUN_ID }}

jobs:
cli:
runs-on: ubuntu-latest #[self-hosted, Linux]
client-cli-tests:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
timeout-minutes: 60
steps:
- name: Maximize build space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build iroha
working-directory: cli
run: mold --run cargo build
- name: Build iroha_client_cli
working-directory: client_cli
run: mold --run cargo build
- name: Build kagami
working-directory: tools/kagami
run: mold --run cargo build
- name: Install and configure allurectl
uses: allure-framework/setup-allurectl@v1
with:
allure-endpoint: https://soramitsu.testops.cloud
allure-token: ${{ secrets.ALLURE_TOKEN }}
allure-project-id: 1
- name: Build binaries
run: |
cargo build --bin iroha_client_cli
cargo build --bin kagami
cargo build --bin iroha
- name: Setup test Iroha 2 environment on bare metal
run: |
./scripts/test_env.py setup
- name: Mark binaries as executable
run: |
chmod +x target/debug/iroha
chmod +x target/debug/iroha_client_cli
chmod +x target/debug/kagami
- name: Setup test environment
run: python3 './scripts/test_env.py setup'
- name: Genesis test
run: bash -c './scripts/tests/genesis.sh || (cat test/peers/iroha0/.log; false )'
- name: Basic register and mint
if: always()
run: bash -c './scripts/tests/register_mint_quantity.sh || (cat test/peers/iroha0/.log; false )'
chmod +x ${{ env.CLIENT_CLI_DIR }}
- name: Install dependencies using Poetry
working-directory: client_cli/pytests
run: |
poetry install
- name: Run client cli tests and upload results to Allure Test Ops
working-directory: client_cli/pytests
run: |
allurectl watch -- poetry run pytest --alluredir=${ALLURE_RESULTS}
printenv | grep GITHUB_TESTS_
env:
GITHUB_TESTS_REF_NAME: ${{ github.ref_name }}
- name: Cleanup test environment
run: python3 './scripts/test_env.py cleanup'
run: |
./scripts/test_env.py cleanup
- name: Panic on invalid genesis test
run: bash -c './scripts/tests/panic_on_invalid_genesis.sh'

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
POETRY_HOME=/opt/poetry \
CLIENT_CLI_DIR=/__w/iroha/iroha/target/debug
TORII_API_PORT_MIN=8080 \
TORII_API_PORT_MAX=8083

ENV PATH=$POETRY_HOME/bin:$PATH

Expand Down
16 changes: 14 additions & 2 deletions Dockerfile.build.glibc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ FROM archlinux:base-devel

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
PATH=/usr/local/cargo/bin:$PATH \
POETRY_HOME=/opt/poetry \
TORII_API_PORT_MIN=8080 \
TORII_API_PORT_MAX=8083

RUN pacman -Syu rustup mold openssl libgit2 git docker docker-buildx docker-compose glibc lib32-glibc --noconfirm
ENV PATH=$POETRY_HOME/bin:$PATH

RUN pacman -Syu rustup mold openssl libgit2 git docker \
docker-buildx docker-compose glibc lib32-glibc \
python python-pip --noconfirm --disable-download-timeout && \
curl -sSL https://install.python-poetry.org | python3 -

WORKDIR /client_cli/pytests
COPY /client_cli/pytests/pyproject.toml /client_cli/pytests/poetry.lock $WORKDIR
RUN poetry install

RUN rustup toolchain install nightly-2023-06-25-x86_64-unknown-linux-gnu
RUN rustup default nightly-2023-06-25-x86_64-unknown-linux-gnu
Expand Down
6 changes: 0 additions & 6 deletions scripts/tests/genesis.sh

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/tests/register_mint_quantity.sh

This file was deleted.

0 comments on commit 1ea5f31

Please sign in to comment.