diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef3aa8e..1065b60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,8 @@ on: - main jobs: - test: - name: Test + python_test: + name: Python tests runs-on: ${{ matrix.os }} strategy: matrix: @@ -42,30 +42,32 @@ jobs: run: | pytest - packaging: - name: Packaging + c_python_test: + name: CPython interface tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: '3.11' - - name: Install dependencies + - name: Install system dependencies + run: | + sudo apt install -y gcovr + - name: Install python dependencies run: | python -m pip install --upgrade pip - python -m pip install build twine validate-pyproject[all] - - name: Check and install package + python -m pip install numpy pytest + - name: Build module with coverage run: | - validate-pyproject pyproject.toml - python -m build - python -m twine check --strict dist/* - python -m pip install dist/*.whl - - name: Check vcztools CLI + # Build the extension module in-place so pytest can find it + CFLAGS="--coverage" python3 setup.py build_ext --inplace + - name: Run tests run: | - vcztools --help - # Make sure we don't have ``vcztools`` in the CWD - cd tests - python -m vcztools --help + pytest -vs tests/test_cpython_interface.py + - name: Show coverage + run: | + gcovr --filter vcztools c_test: name: C tests @@ -88,7 +90,33 @@ jobs: run: | ninja -C build coverage-text cat build/meson-logs/coverage.txt - - name: Valgrind + - name: Valgrind working-directory: ./lib run: | valgrind --leak-check=full --error-exitcode=1 ./build/tests + + packaging: + name: Packaging + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build twine validate-pyproject[all] + - name: Check and install package + run: | + validate-pyproject pyproject.toml + python -m build + python -m twine check --strict dist/* + python -m pip install dist/*.whl + - name: Check vcztools CLI + run: | + vcztools --help + # Make sure we don't have ``vcztools`` in the CWD + cd tests + python -m vcztools --help +