From 5aa3e716a54a0e3b4e03d2154a2068346c023e7f Mon Sep 17 00:00:00 2001 From: odds-api-io Date: Fri, 6 Nov 2026 12:49:19 +0100 Subject: [PATCH 1/2] ci: add CI and release-triggered publish workflows Publish runs on a published GitHub release and uses trusted publishing (OIDC), so no registry token is stored in the repo. --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++ .github/workflows/publish.yml | 54 +++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..28595bb --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 + python -m pytest + fi diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..07dd6ca --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 + 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 From b7fdddc74a548a132fd55b9a1c21170484bc2b99 Mon Sep 17 00:00:00 2001 From: odds-api-io Date: Fri, 6 Nov 2026 14:03:09 +0100 Subject: [PATCH 2/2] ci: install the test dependencies --- .github/workflows/ci.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28595bb..6a45c17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,6 @@ jobs: - name: Run tests if present run: | if [ -d tests ]; then - python -m pip install pytest pytest-asyncio + python -m pip install pytest pytest-asyncio "responses>=0.23.0" "pandas>=1.3" "websockets>=10.0" python -m pytest fi diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 07dd6ca..5eb3075 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,7 +32,7 @@ jobs: - name: Run tests if present run: | if [ -d tests ]; then - python -m pip install pytest pytest-asyncio + 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