-
Notifications
You must be signed in to change notification settings - Fork 13
109 lines (96 loc) · 3.56 KB
/
test-suite.yml
File metadata and controls
109 lines (96 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Test Suite
on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
pull_request:
branches:
- '**'
jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }} / ${{ matrix.transport }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [Ubuntu]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
transport: ["aiohttp", "httpx", "all"]
services:
postgres:
image: docker.io/postgres:9.6-alpine
env:
POSTGRES_PASSWORD: hasura
POSTGRES_USER: hasura
POSTGRES_DB: hasura
ports:
- 5432:5432
hasura:
image: quay.io/twyla-ai/hasura-world-db:latest
env:
HASURA_GRAPHQL_DATABASE_URL: postgres://hasura:hasura@postgres:5432/hasura
HASURA_GRAPHQL_ADMIN_SECRET: secret
ports:
- 8080:8080
options: --restart on-failure
steps:
- uses: actions/checkout@v6
- name: Start podman socket
shell: bash
run: |
systemctl --user start podman.socket
systemctl --user status podman.socket
- name: Start test containers
shell: bash
run: |
export DOCKER_HOST="unix:///run/user/$(id -u)/podman/podman.sock"
podman compose up -d apollo-server-v2 strawberry-server
- name: Wait for strawberry
shell: bash
run: |
timeout 60s bash -c \
'while [[ "$(curl -s -o /dev/null -w "%{http_code}" 127.0.0.1:5000/graphql)" != "200" ]]; do sleep 2; done' \
|| false
- name: Install poetry and tox
run: pipx install poetry tox
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Get poetry cache directory
run: printf 'cache-dir=%s\n' "$(poetry config cache-dir)" >> $GITHUB_OUTPUT
id: poetry-config
shell: bash
- name: Get current date
run: printf 'date=%s\n' "$(date -I)" >> $GITHUB_OUTPUT
id: get-date
shell: bash
- name: Cache Poetry
uses: actions/cache@v5
with:
path: |
${{ steps.poetry-config.outputs.cache-dir }}/artifacts
${{ steps.poetry-config.outputs.cache-dir }}/cache
key: poetry-${{ steps.get-date.outputs.date }}-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.transport }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
restore-keys: |
poetry-${{ steps.get-date.outputs.date }}-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.transport }}-
poetry-${{ steps.get-date.outputs.date }}-${{ runner.os }}-${{ matrix.python-version }}-
poetry-${{ steps.get-date.outputs.date }}-${{ runner.os }}-
enableCrossOsArchive: true
- name: Wait for hasura
shell: bash
run: |
timeout 300s bash -c \
'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:${{ job.services.hasura.ports[8080] }}/healthz)" != "200" ]]; do sleep 5; done' \
|| false
- name: Execute test suite
shell: bash
env:
SERVER_WORLD_DB: "http://127.0.0.1:${{ job.services.hasura.ports[8080] }}/v1/graphql"
SERVER_APOLLO_V2: "http://127.0.0.1:4000/graphql"
SERVER_STRAWBERRY: "http://127.0.0.1:5000/graphql"
run: |
TOX_ENV="py$(echo ${{ matrix.python-version }} | tr -d '.')-${{ matrix.transport }}"
tox -e $TOX_ENV