Merge pull request #61 from ADBond/maint/more-testing #75
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: Run tests | |
on: | |
# run on main as comparison for coverage | |
# also doesn't hurt to check main is ship-shaped | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "splinkclickhouse/**" | |
- "tests/**" | |
- "pyproject.toml" | |
- "uv.lock" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
clickhouse_splink_ci: | |
image: clickhouse/clickhouse-server:24.8 | |
env: | |
CLICKHOUSE_USER: splinkognito | |
CLICKHOUSE_PASSWORD: splink123! | |
ports: | |
- 8123:8123 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
test-set: ["core", "chdb_no_core", "clickhouse_no_core"] | |
name: Run ${{ matrix.test-set }} tests with Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup uv | |
id: setup-uv | |
uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: uv sync -p ${{ matrix.python-version }} | |
- name: Run core or clickhouse tests | |
if: ${{ matrix.test-set != 'chdb_no_core'}} | |
run: uv run python -m pytest -vm ${{ matrix.test-set }} --cov=splinkclickhouse --cov-branch tests | |
- name: Run chdb tests | |
if: ${{ matrix.test-set == 'chdb_no_core'}} | |
run: uv run python -m pytest -vm ${{ matrix.test-set }} --cov=splinkclickhouse --cov-branch tests | |
- name: Rename coverage file | |
run: mv .coverage .coverage.${{ matrix.test-set }} | |
- name: Check directory contents | |
run: ls -alhR . | |
- if: ${{ matrix.python-version == '3.12' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage_${{ matrix.test-set }} | |
path: .coverage.${{ matrix.test-set }} | |
if-no-files-found: error | |
include-hidden-files: true | |
combine-and-upload-coverage: | |
runs-on: ubuntu-latest | |
needs: test | |
name: Combine coverage data and upload to Codecov | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup uv | |
id: setup-uv | |
uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install Python 3.10 | |
run: uv python install 3.10 | |
- name: Install dependencies | |
run: uv sync -p 3.10 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: './coverage' | |
pattern: 'coverage_*' | |
merge-multiple: true | |
- name: Check directory contents | |
run: ls -alhR ./coverage | |
- name: Combine coverage data and create report | |
run: | | |
uv run coverage combine ./coverage | |
uv run coverage xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |