-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (70 loc) · 2.4 KB
/
pytest-redis-postgres-workflow.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
name: poetry pytest workflow
on: [pull_request]
jobs:
# Label of the container job
container-job:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
# Service containers to run with `container-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
ports:
- "6379:6379"
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
# Docker Hub image
image: postgres
ports:
- "5432:5432"
# Provide the password for postgres
env:
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
POSTGRES_DB: test
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Install poetry
run: |
python -m pip install poetry
- name: Install dependencies
run: |
env LC_ALL=C.UTF-8 LANG=C.UTF-8 LANGUAGE=C.UTF-8 poetry install --verbose
- name: Run pytests
# Runs a script that creates a Redis client, populates
# the client with data, and retrieves data
run: |
poetry run pytest
# Environment variable used by the `client.js` script to create a new Redis client.
env:
REDIS: redis://localhost:6379/1
IN_REDIS: redis://localhost:6379/1
OUT_REDIS: redis://localhost:6379/1
DB_URI: "postgresql://dbuser:dbpass@localhost:5432/test"
JWT_SECRET: "nosecret"
SECURITY_TOKEN_EXPIRES_DAYS: 1
SUBSCRIPTION_TOKEN_EXPIRES_DAYS: 1