Skip to content

Commit

Permalink
chore(ci): setup test pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: JP-Ellis <[email protected]>
  • Loading branch information
JP-Ellis committed Feb 27, 2024
1 parent d8628a8 commit 1cf140d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 5 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: test

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
HATCH_VERBOSE: "1"

jobs:
test:
name: >
${{ matrix.directory == '.' && 'Core' || matrix.directory == 'pypacter-api' && 'API' || 'CLI' }}
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.11", "3.12"]
directory: [".", "pypacter-api", "pypacter-cli"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install Hatch
run: pip install --upgrade hatch

- name: Run lints
working-directory: ${{ matrix.directory}}
run: |
hatch run format --check
hatch run lint
hatch run typecheck
- name: Run tests
working-directory: ${{ matrix.directory}}
run: |
hatch run test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
6 changes: 3 additions & 3 deletions pypacter-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ classifiers = [
"Topic :: Software Development :: Code Generators",
]

requires-python = "~=3.11.0"
requires-python = ">=3.8"

dependencies = [
"fastapi~=0.0",
Expand Down Expand Up @@ -97,7 +97,7 @@ pre-install-commands = [
# The update is necessary as we are not using editable installs
lint = "ruff check --show-source --show-fixes {args} src tests"
typecheck = "mypy src tests {args}"
format = "ruff format src tests docs {args}"
format = "ruff format src tests {args}"
test = "pytest tests/ {args}"
all = ["format", "lint", "typecheck", "test"]

Expand All @@ -108,7 +108,7 @@ pre-install-commands = [
]

[[tool.hatch.envs.test.matrix]]
python = ["3.11"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

################################################################################
## Ruff Configuration
Expand Down
5 changes: 5 additions & 0 deletions pypacter-api/tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pypacter_api import __version__


def test_version() -> None:
assert len(__version__.split(".")) >= 3
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ classifiers = [
"Topic :: Software Development :: Code Generators",
]

requires-python = "~=3.11.0"
requires-python = ">=3.8"

dependencies = ["langchain_openai~=0.0.0", "langchain~=0.1.0", "pyyaml~=6.0"]

Expand Down Expand Up @@ -97,7 +97,7 @@ pre-install-commands = [
]

[[tool.hatch.envs.test.matrix]]
python = ["3.11"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

################################################################################
## Ruff Configuration
Expand Down

0 comments on commit 1cf140d

Please sign in to comment.