add formatter and linter to ci #2
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
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
ci: | |
strategy: | |
matrix: | |
task: [test, lint, format] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
qemu-user \ | |
clang-15 lld-15 \ | |
libc6-armhf-cross libc6-arm64-cross \ | |
libc6-mips-cross libc6-mips64-cross \ | |
libc6-powerpc-cross libc6-powerpc-ppc64-cross | |
- name: Install Package | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade pytest ruff black isort | |
python3 -m pip install -e . | |
- name: Run pytest | |
if: matrix.task == 'test' | |
run: | | |
python3 -m pytest | |
- name: Run formatter | |
if: matrix.task == 'format' | |
run: | | |
python3 -m isort . --profile black --check-only --diff | |
python3 -m black . --check | |
- name: Run linter | |
if: matrix.task == 'lint' | |
run: | | |
python3 -m ruff check . |