-
Notifications
You must be signed in to change notification settings - Fork 137
118 lines (94 loc) · 2.83 KB
/
test.yml
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
110
111
112
113
114
115
116
117
118
name: test
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
STABLE_PYTHON_VERSION: "3.11"
PYTEST_ADDOPTS: --color=yes
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install Hatch
run: pip install --upgrade hatch
- # TODO: Fix lints before enabling this
name: Lint
run: echo hatch run lint
test:
name: >-
Python ${{ matrix.python-version }}
on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
experimental: [false]
include:
- # Run tests against the next Python version, but no need for the full list of OSes.
os: ubuntu-latest
python-version: "3.12-dev"
experimental: true
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Hatch
run: pip install --upgrade hatch
- name: Run tests and track code coverage
run: hatch run test
example:
name: Example
runs-on: ubuntu-latest
services:
broker:
image: pactfoundation/pact-broker:latest
ports:
- "9292:9292"
env:
# Basic auth credentials for the Broker
PACT_BROKER_ALLOW_PUBLIC_READ: "true"
PACT_BROKER_BASIC_AUTH_USERNAME: pactbroker
PACT_BROKER_BASIC_AUTH_PASSWORD: pactbroker
# Database
PACT_BROKER_DATABASE_URL: sqlite:////tmp/pact_broker.sqlite
options: >-
--health-cmd "curl -sSf http://pactbroker:pactbroker@localhost:9292/diagnostic/status/heartbeat"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check broker is live
run: |
curl -sSf http://pactbroker:pactbroker@localhost:9292/diagnostic/status/heartbeat || exit 1
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install Hatch
run: pip install --upgrade hatch
- name: Examples
run: >
hatch run example
--capture=no
--broker-url=http://pactbroker:pactbroker@broker:9292
- name: Run tests and track code coverage
run: hatch run test