Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python -m pip install --upgrade pip build twine
- run: python -m build
- run: python -m twine check dist/*
- name: Install the wheel and import it
run: |
python -m pip install dist/*.whl
cd /tmp && python -c "import odds_api; print(odds_api.__name__)"
- name: Run tests if present
run: |
if [ -d tests ]; then
python -m pip install pytest pytest-asyncio "responses>=0.23.0" "pandas>=1.3" "websockets>=10.0"
python -m pytest
fi
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish

on:
release:
types: [published]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check release tag matches pyproject.toml
run: |
TAG="${GITHUB_REF_NAME#v}"
VERSION="$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
if [ "$VERSION" != "$TAG" ]; then
echo "pyproject.toml version $VERSION does not match release tag $TAG"; exit 1
fi
- run: python -m pip install --upgrade pip build twine
- run: python -m build
- run: python -m twine check dist/*
- name: Install the wheel and import it
run: |
python -m pip install dist/*.whl
cd /tmp && python -c "import odds_api"
- name: Run tests if present
run: |
if [ -d tests ]; then
python -m pip install pytest pytest-asyncio "responses>=0.23.0" "pandas>=1.3" "websockets>=10.0"
python -m pytest
fi
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

pypi:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
Loading