Skip to content

Bug Fix: Set timeout on requests.get #5597

Bug Fix: Set timeout on requests.get

Bug Fix: Set timeout on requests.get #5597

Workflow file for this run

name: CI
on:
merge_group:
push:
branches: [main]
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
pull_request:
workflow_dispatch:
env:
HYPOTHESIS_PROFILE: ci
FORCE_COLOR: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
permissions: {}
jobs:
build-python:
name: Build & verify python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for setuptools_scm version determination
- uses: hynek/build-and-inspect-python-package@v2
id: baipp
outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
lint:
name: Lint
needs: build-python
runs-on: ubuntu-latest-8-cores
steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- name: Extract source distribution
run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: uv pip install --system tox tox-uv
- name: Lint
run: make lint
test-go:
name: "Test Go"
needs: build-python
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for goreleaser version determination
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: make cog
- name: Test
run: make test-go
test-python:
name: "Test Python ${{ matrix.python-version }} + Pydantic v${{ matrix.pydantic }}"
needs: build-python
runs-on: ubuntu-latest-8-cores
strategy:
fail-fast: false
matrix:
pydantic: ["1", "2"]
python-version: ${{ fromJson(needs.build-python.outputs.python-versions) }}
steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- name: Extract source distribution
run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: |
echo TOX_PYTHON=py$(echo "${{ matrix.python-version }}" | tr -d .) >>$GITHUB_ENV
uv pip install --system tox
- run: uv pip install --system tox-uv
- name: Remove src to ensure tests run against wheel
run: rm -rf python/cog
- name: Test
run: python -Im tox run --installpkg "$COG_WHEEL" -e ${{ env.TOX_PYTHON }}-pydantic${{ matrix.pydantic }}-tests
# cannot run this on mac due to licensing issues: https://github.com/actions/virtual-environments/issues/2150
test-integration:
name: "Test integration"
needs: build-python
runs-on: ubuntu-latest-16-cores
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for goreleaser version determination
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: uv pip install --system tox tox-uv
- name: Test
run: make test-integration
release:
name: "Release"
needs:
- test-go
- test-python
- test-integration
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for goreleaser version determination
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}