diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 000000000..64830abfd --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,15 @@ +name: Mypy +on: [pull_request, workflow_dispatch] +jobs: + mypy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: 3.8 + - name: Install mypy + run: pip install mypy + - name: Run mypy + run: mypy -p ipv8 diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 000000000..92bd94975 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,23 @@ +name: Ruff +on: [pull_request, workflow_dispatch] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: 3.8 + - name: Install ruff + run: pip install ruff + - name: Get changed Python files + id: changed-py-files + uses: tj-actions/changed-files@v42 + with: + files: | + *.py + **/*.py + - name: Run ruff + if: steps.changed-py-files.outputs.any_changed == 'true' + run: ruff check ${{ steps.changed-py-files.outputs.all_changed_files }} diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml new file mode 100644 index 000000000..7dea1cf48 --- /dev/null +++ b/.github/workflows/unittests.yml @@ -0,0 +1,48 @@ +name: Unittests +on: [pull_request, workflow_dispatch] +jobs: + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.7' + cache: 'pip' + - run: python -m pip install -r requirements.txt + - name: Run unit tests + run: python run_all_tests.py -a + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.8' + cache: 'pip' + - uses: actions/cache/restore@v3 + id: restore_cache + with: + path: libsodium.dll + key: cache_libsodium_dll + - run: python -m pip install -r requirements.txt + - name: Run unit tests + run: python run_all_tests.py -a + - uses: actions/cache/save@v3 + id: save_cache + with: + path: libsodium.dll + key: cache_libsodium_dll + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.8' + cache: 'pip' + - run: python -m pip install -r requirements.txt + - name: Run unit tests + run: | + pip install pytest pytest-xdist + pytest -n auto ipv8