-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (53 loc) · 1.85 KB
/
Copy pathtest-generated-client.yml
File metadata and controls
65 lines (53 loc) · 1.85 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
---
name: Run Tests on Autogenerated Client
on: push
permissions:
contents: read
packages: read
jobs:
unit-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.7
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: fia
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.5.0
- name: Set up python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v4.5.0
with:
python-version: "3.12"
- name: Set up cache for Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies.
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
- name: Install client generation dependencies
run: |
python -m pip install ".[client-generation]"
- name: Start FIA API in background
run: |
uvicorn fia_api.fia_api:app --host 0.0.0.0 --port 8000 &
# Wait for API to start
sleep 10
- name: Generate client code
run: |
openapi-python-client generate --url http://localhost:8000/openapi.json --overwrite
- name: Run pytest
env:
DATABASE_URL: postgresql://postgres:password@localhost:5432/test_db
GITHUB_PACKAGE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pytest test/core/test_autogenerated_client.py