Skip to content

ci: add ci to pytests #49

ci: add ci to pytests

ci: add ci to pytests #49

Workflow file for this run

name: Iroha 2 pull request workflow
on:
pull_request:
branches: [main]
jobs:
check:
runs-on: iroha-ubuntu-latest
container: rust:1.65-buster
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang \
git \
llvm-dev \
python3-pip
rustup component add clippy rustfmt
pip3 install yapf
cargo install cargo-lints
- name: Check Cargo.toml
run: cat Cargo.toml
- name: Check Cargo.lock
run: cat Cargo.lock
- name: Debug Dependencies
run: cargo metadata --format-version 1 --verbose
- name: Format check
run: cargo fmt --all -- --check
- name: Static analysis
run: cargo lints clippy --all --benches --tests
- name: Check regeneration of python sys library and formatting (PEP8)
run: |
cargo run -p generate -- iroha2/sys
yapf --style pep8 -e 'iroha2/sys/**/*.py' -r -i iroha2 example
git diff --quiet
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout Iroha code
uses: actions/checkout@v4
with:
repository: 'hyperledger/iroha'
ref: '2.0.0-pre-rc.22'
- name: Run docker-compose.yml containers
run: |
docker compose -f ./configs/swarm/docker-compose.yml up --wait || exit 1
- name: Checkout code
uses: actions/checkout@v4
- name: Show containers and directory
run: |
docker ps -a
pwd
ls
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang \
git \
patchelf \
llvm-dev \
python3-pip
sudo pip3 install --upgrade pip
sudo pip3 install maturin pytest
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "export PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Maturin build
run: maturin build && poetry add target/wheels/*
- name: Poetry install
run: poetry install
- name: Run test
run: poetry run python -m pytest tests
integration-test:
runs-on: iroha-ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Iroha Python test Docker image
uses: docker/build-push-action@v4
with:
push: false
dockerfile: example/Dockerfile
repository: iroha
tags: python-test
- name: Run test in docker
working-directory: example
run: |
docker-compose up -d && sleep 5
docker run --net example_default -v $PWD:/test iroha:python-test \
timeout 5 python3 test.py ||
(docker-compose logs && false)