-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (53 loc) · 1.41 KB
/
test.yaml
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
name: test
run-name: testing
on:
push:
branches: [main]
paths: ["src/**", "tests/**"]
pull_request:
types: [opened]
paths: ["src/**", "tests/**"]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
POSTGRES_DB: amdb_test
ports: ["5432:5432"]
redis:
image: redis:7.2
ports: ["6379:6379"]
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: checkout
uses: actions/checkout@v4
- name: install python3.10.13
uses: actions/setup-python@v4
with:
python-version: "3.10.13"
- name: install dependencies
run: pip install ".[test,coverage]"
- name: run test
run: pytest --cov=./ --cov-report=xml
env:
TEST_POSTGRES_USER: postgres
TEST_POSTGRES_PASSWORD: 1234
TEST_POSTGRES_HOST: 127.0.0.1
TEST_POSTGRES_PORT: 5432
TEST_POSTGRES_DB: amdb_test
TEST_REDIS_HOST: redis
TEST_REDIS_PORT: 6379
TEST_REDIS_DB: 0
- name: upload coverage report to Codecov
uses: codecov/codecov-action@v3
env:
token: ${{ secrets.CODECOV_TOKEN }}