ci: add ci to pytests #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
pwd | |
ls | |
docker compose -f ./configs/swarm/docker-compose.yml up --wait || exit 1 | |
docker ps -a | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Show containers and directory | |
run: | | |
docker ps | |
pwd | |
ls | |
- name: Install dependencies | |
run: | | |
apt-get update | |
apt-get install -y --no-install-recommends \ | |
build-essential \ | |
ca-certificates \ | |
clang \ | |
git \ | |
patchelf \ | |
llvm-dev \ | |
python3-pip | |
pip3 install --upgrade pip | |
pip3 install maturin pytest | |
- name: Install iroha2 | |
run: maturin build && pip3 install target/wheels/* | |
- name: Pytest | |
working-directory: tests | |
run: pytest | |
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) |