diff --git a/.github/workflows/all_checks_pass.yml b/.github/workflows/all_checks_pass.yml deleted file mode 100644 index 6a1d92e..0000000 --- a/.github/workflows/all_checks_pass.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: All checks pass -on: - pull_request: - types: [ opened, synchronize, reopened, ready_for_review ] -jobs: - allchecks: - runs-on: ubuntu-latest - steps: - - uses: wechuli/allcheckspassed@v1 - with: - delay: '1' - retries: '3' - polling_interval: '5' diff --git a/.github/workflows/memory_leak.yml b/.github/workflows/memory_leak.yml deleted file mode 100644 index f0d31f8..0000000 --- a/.github/workflows/memory_leak.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Memory Leaks - -on: - push: - branches: - - master - paths: - - 'src/_pyawaitable/**' - - '.github/workflows/memory_leak.yml' - pull_request: - branches: - - master - paths: - - 'src/_pyawaitable/**' - - '.github/workflows/memory_leak.yml' - -env: - PYTHONUNBUFFERED: "1" - FORCE_COLOR: "1" - PYTHONIOENCODING: "utf8" - PYTHONMALLOC: malloc - -jobs: - memory-leaks: - name: Check for memory leaks and errors - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.12 - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install Pytest - run: | - pip install pytest pytest-asyncio pytest-memray typing_extensions - shell: bash - - - name: Build PyAwaitable - run: pip install . - - - name: Build PyAwaitable Test Package - run: pip install setuptools wheel && pip install tests/extension/ --no-build-isolation - - - name: Install Valgrind - run: sudo apt-get update && sudo apt-get -y install valgrind - - - name: Run tests with Memray tracking - run: pytest --enable-leak-tracking -W error --stacks=50 --native - - - name: Run tests with Valgrind - run: valgrind --suppressions=valgrind-python.supp --error-exitcode=1 pytest -x diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c99d8f9..3bf9de0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,57 +1,144 @@ name: Tests on: - push: - branches: - - master - paths: - - 'tests/**' - - 'src/**' - - '.github/workflows/tests.yml' - pull_request: - branches: - - master - paths: - - 'tests/**' - - 'src/**' - - '.github/workflows/tests.yml' + push: + branches: + - master + pull_request: + types: + - "opened" + - "reopened" + - "synchronize" concurrency: - group: test-${{ github.head_ref }} - cancel-in-progress: true + group: test-${{ github.head_ref }} + cancel-in-progress: true env: - PYTHONUNBUFFERED: "1" - FORCE_COLOR: "1" - PYTHONIOENCODING: "utf8" - PYAWAITABLE_OPTIMIZED: 1 + PYTHONUNBUFFERED: "1" + FORCE_COLOR: "1" + PYTHONIOENCODING: "utf8" + PYAWAITABLE_OPTIMIZED: 1 jobs: - run-tests: - name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Pytest - run: pip install pytest pytest-asyncio typing_extensions - - - name: Build PyAwaitable - run: pip install . - - - name: Build PyAwaitable Test Package - run: pip install setuptools wheel && pip install ./tests/extension/ --no-build-isolation - - - name: Run tests - run: pytest -W error + changes: + runs-on: ubuntu-latest + outputs: + source: ${{ steps.filter.outputs.source }} + csource: ${{ steps.filter.outputs.csource }} + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + source: + - 'src/**' + csource: + - 'src/_pyawaitable/**' + + run-tests: + needs: changes + if: ${{ needs.changes.outputs.source == 'true' }} + name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Pytest + run: pip install pytest pytest-asyncio typing_extensions + + - name: Build PyAwaitable + run: pip install . + + - name: Build PyAwaitable Test Package + run: pip install setuptools wheel && pip install ./tests/extension/ --no-build-isolation + + - name: Run tests + run: pytest -W error + + memory-errors: + needs: + - changes + - run-tests + if: ${{ needs.changes.outputs.csource == 'true' }} + name: Check for memory errors + runs-on: ubuntu-latest + env: + PYTHONMALLOC: malloc + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.12 + uses: actions/setup-python@v2 + with: + python-version: 3.12 + - name: Build PyAwaitable + run: pip install . + + - name: Build PyAwaitable Test Package + run: pip install setuptools wheel && pip install tests/extension/ --no-build-isolation + + - name: Install Valgrind + run: sudo apt-get update && sudo apt-get -y install valgrind + + - name: Run tests with Valgrind + run: valgrind --suppressions=valgrind-python.supp --error-exitcode=1 pytest -x + + memory-leaks: + needs: + - changes + - memory-errors + if: ${{ needs.changes.outputs.csource == 'true' }} + name: Check for memory leaks + runs-on: ubuntu-latest + env: + PYTHONMALLOC: malloc + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.12 + uses: actions/setup-python@v2 + with: + python-version: 3.12 + + - name: Install Pytest + run: | + pip install pytest pytest-asyncio pytest-memray typing_extensions + shell: bash + + - name: Build PyAwaitable + run: pip install . + + - name: Build PyAwaitable Test Package + run: pip install setuptools wheel && pip install tests/extension/ --no-build-isolation + + - name: Run tests with Memray tracking + run: pytest --enable-leak-tracking -W error --stacks=50 --native + + tests-pass: + runs-on: ubuntu-latest + name: All tests passed + if: always() + + needs: + - run-tests + - memory-errors + - memory-leaks + + steps: + - name: Check whether all tests passed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + allowed-skips: ${{ toJSON(needs) }} \ No newline at end of file diff --git a/README.md b/README.md index b42e214..1a2b6fc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ [![Build Wheels](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/build.yml/badge.svg)](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/build.yml) ![Tests](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/tests.yml/badge.svg) -![Memory Leak](https://github.com/ZeroIntensity/pyawaitable/actions/workflows/memory_leak.yml/badge.svg) - [Docs](https://awaitable.zintensity.dev) - [Source](https://github.com/ZeroIntensity/pyawaitable)