Skip to content

Commit

Permalink
Test multiple python versions in GitHub actions (#1142)
Browse files Browse the repository at this point in the history
When moving off CircleCI, we moved to only testing one python version.
This change makes it so we test the highest and lowest supported
versions in parallel.
  • Loading branch information
augray authored Dec 17, 2024
1 parent 8ad91b5 commit 2d7ad61
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,42 @@ on:
jobs:
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
py-version: ["3.9", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Py-prep
run: make py-prep
run: make py-prep PY_VERSION=${{ matrix.py-version }}
- name: Check Format
run: uvx ruff format --check
- name: Lint
run: uvx ruff check --fix sematic
- name: MyPy
if: matrix.py-version == '3.12'
run: uv run mypy -p sematic --disable-error-code import-untyped
- name: Test
run: |
source .venv/bin/activate
python3 -c "import sys; print(sys.version)"
pytest
- name: Check Schemas
if: matrix.py-version == '3.12'
run: git checkout . && make migrate_up_sqlite && make update-schema && git diff --exit-code
- name: Wheel
if: matrix.py-version == '3.12'
run: |
make ui
make uv-wheel
- uses: actions/upload-artifact@v4
if: matrix.py-version == '3.12'
with:
name: sematic-wheel
path: "./dist/sematic-*.whl"
retention-days: 10
- uses: actions/upload-artifact@v4
if: matrix.py-version == '3.12'
with:
name: sematic-wheel-test
path: "sematic/tests/integration/test_pip_install.sh"
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SHELL=/bin/bash
UNAME_S := $(shell uname -s)
RED := \033[0;31m
NO_COLOR := \033[1;0m
PY_VERSION := "3.12"

migrate_up_rds:
cd sematic; DATABASE_URL=${DATABASE_URL} dbmate -s db/schema.sql.pg up
Expand Down Expand Up @@ -33,7 +34,7 @@ fix:
py-prep:
uv --version || curl -LsSf https://astral.sh/uv/install.sh | sh
rm -rf ".venv" || echo "No virtualenv yet"
uv venv --python 3.12
uv venv --python $(PY_VERSION)
uv sync --extra examples --extra ray
uv tool install --force ruff==0.8.3
uv pip install mypy==1.13.0
Expand Down
3 changes: 3 additions & 0 deletions sematic/tests/test_3_10_function.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

# Third-party
import pytest

Expand All @@ -6,6 +8,7 @@
from sematic.runners.silent_runner import SilentRunner


@pytest.mark.skipif(sys.version_info < (3, 10), reason="Requires python >=3.10")
def test_decorator_3_10_style_hints():
@func
def f(a: list[int], b: dict[str, str]) -> int | float:
Expand Down

0 comments on commit 2d7ad61

Please sign in to comment.