Skip to content

Commit

Permalink
chore: configure testing for Windows and macOS. (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Nov 16, 2023
1 parent cc599f3 commit 1daa029
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,51 @@ jobs:

test:
needs: pre-commit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "pypy3.8", "pypy3.9", "pypy3.10" ]
platform: [
{ os: 'ubuntu-latest', python-version: '3.8' },
{ os: 'ubuntu-latest', python-version: '3.9' },
{ os: 'ubuntu-latest', python-version: '3.10' },
{ os: 'ubuntu-latest', python-version: '3.11' },
{ os: 'ubuntu-latest', python-version: 'pypy3.8' },
{ os: 'ubuntu-latest', python-version: 'pypy3.9' },
{ os: 'ubuntu-latest', python-version: 'pypy3.10' },
{ os: 'macos-latest', python-version: '3.8' },
{ os: 'macos-latest', python-version: '3.9' },
{ os: 'macos-latest', python-version: '3.10' },
{ os: 'macos-latest', python-version: '3.11' },
{ os: 'macos-latest', python-version: 'pypy3.8' },
{ os: 'macos-latest', python-version: 'pypy3.9' },
{ os: 'macos-latest', python-version: 'pypy3.10' },
{ os: 'windows-latest', python-version: '3.8' },
{ os: 'windows-latest', python-version: '3.9' },
{ os: 'windows-latest', python-version: '3.10' },
{ os: 'windows-latest', python-version: '3.11' },
]
# https://endoflife.date/python
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v3

- name: Start httpbin server
- name: Wake up httpbin server
run: |
docker run -d -p 9876:80 kennethreitz/httpbin
curl https://httpbinx.fly.dev/ip
- name: Install poetry
run: pipx install poetry

- name: Setup Python ${{ matrix.python-version }}
- name: Setup Python ${{ matrix.platform.python-version }} on ${{ matrix.platform.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.platform.python-version }}
cache: 'poetry'

- name: Install dependencies
run: |
poetry install --extras 'aiohttp'
- name: Ensure httpbin server is running
run: |
while true; do response=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9876/get); if [ "$response" = "200" ]; then echo "HTTP 200 OK received"; break; else echo "Retrying..."; sleep 1; fi; done
- name: Echo installed packages
run: |
poetry show
Expand All @@ -57,7 +72,7 @@ jobs:
run: poetry run pytest -v -rs tests --runslow --cov=./ --cov-report=xml

- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
if: matrix.platform.python-version == '3.11' && matrix.platform.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
8 changes: 2 additions & 6 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import os

HTTPBIN_URL = "https://httpbin.org/"
if os.getenv("GITHUB_ACTIONS"):
print("Running on Github Actions")
HTTPBIN_URL = "http://127.0.0.1:9876/"
# HTTPBIN_URL = "https://httpbin.org/" # see https://github.com/postmanlabs/httpbin/issues/613
HTTPBIN_URL = "https://httpbinx.fly.dev/"

0 comments on commit 1daa029

Please sign in to comment.