tests: enable and disable via an option #47
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: CI | |
on: [push, pull_request] | |
jobs: | |
build-and-run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Install libraries | |
run: | | |
sudo apt update | |
sudo apt install python3 python3-docutils meson clang libaio-dev rustc cargo | |
python3 -m pip install pytest | |
- name: Build | |
run: | | |
src_dir="${{ github.workspace }}" | |
build_dir="$src_dir/build" | |
CC=clang meson setup $build_dir $src_dir | |
pushd $build_dir | |
ninja | |
popd | |
- name: Run Tests | |
run: | | |
python3 -m pytest ${{ github.workspace }}/tests/test_libvhost.py -rsv --junitxml result.xml | |
- name: Collect test results | |
uses: mikepenz/action-junit-report@v3 | |
if: always() | |
with: | |
report_paths: result.xml | |
build-with-cmake: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Install libraries | |
run: | | |
sudo apt update | |
sudo apt install cmake ninja-build clang | |
- name: Build | |
run: | | |
src_dir="${{ github.workspace }}" | |
build_dir="$src_dir/build" | |
cmake -S $src_dir -B $build_dir -G Ninja -DCMAKE_C_COMPILER=clang | |
ninja -C $build_dir | |
lint-python-scripts: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install flake8 & mypy | |
run: | | |
sudo apt update | |
sudo apt install python3 python3-pip | |
pip install flake8 mypy pytest | |
- name: Run flake8 | |
run: flake8 tests/*.py | |
- name: Run mypy | |
run: mypy --disallow-incomplete-defs --no-implicit-optional tests/*.py |