Skip to content

Commit

Permalink
add basic ci checks
Browse files Browse the repository at this point in the history
  • Loading branch information
0thernet committed Apr 30, 2024
1 parent d109325 commit 0d6899c
Show file tree
Hide file tree
Showing 13 changed files with 860 additions and 17 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/pydantic-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pydantic 1

on:
- pull_request

permissions:
contents: read
checks: write

jobs:
build:
name: Pydantic 1
runs-on: ubuntu-latest
env:
SUBSTRATE_API_KEY: ${{ secrets.SUBSTRATE_API_KEY_SMOKE_TESTS }}

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install project
run: cd tests/pydantic-1 && poetry install --no-root

- name: Run tests
shell: bash -el {0}
run: |
cd tests/pydantic-1 && poetry run pytest
30 changes: 30 additions & 0 deletions .github/workflows/pydantic-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pydantic 2

on:
- pull_request

permissions:
contents: read
checks: write

jobs:
build:
name: Pydantic 2
runs-on: ubuntu-latest
env:
SUBSTRATE_API_KEY: ${{ secrets.SUBSTRATE_API_KEY_SMOKE_TESTS }}

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install project
run: cd tests/pydantic-2 && poetry install --no-root

- name: Run tests
shell: bash -el {0}
run: |
cd tests/pydantic-2 && poetry run pytest
30 changes: 30 additions & 0 deletions .github/workflows/python-3-9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Python 3.9

on:
- pull_request

permissions:
contents: read
checks: write

jobs:
build:
name: Python 3.9
runs-on: ubuntu-latest
env:
SUBSTRATE_API_KEY: ${{ secrets.SUBSTRATE_API_KEY_SMOKE_TESTS }}

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install project
run: cd tests/python-3-9 && poetry install --no-root

- name: Run tests
shell: bash -el {0}
run: |
cd tests/python-3-9 && poetry run pytest
15 changes: 0 additions & 15 deletions tests/pydantic-1/basic.py

This file was deleted.

83 changes: 82 additions & 1 deletion tests/pydantic-1/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/pydantic-1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ python = "^3.10"
pydantic = "<2.0.0"
substrate = "*"

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
18 changes: 18 additions & 0 deletions tests/pydantic-1/tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os


class Test:
def test_basic(self):
api_key = os.environ.get("SUBSTRATE_API_KEY")
if api_key is None:
raise EnvironmentError("No SUBSTRATE_API_KEY set")

from substrate import Substrate, GenerateText

substrate = Substrate(api_key=api_key)

story = GenerateText({"prompt": "tell me a story", "max_tokens": 8})
response = substrate.run(story)

summary_out = response.get(story)
assert len(summary_out.text) > 0
83 changes: 82 additions & 1 deletion tests/pydantic-2/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/pydantic-2/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ python = "^3.10"
pydantic = "^2.0.0"
substrate = "*"

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 0d6899c

Please sign in to comment.