-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_mongodb.yml
61 lines (59 loc) · 1.76 KB
/
test_mongodb.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
name: Run Python E2E tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test_package:
{% raw %}
name: Test ${{ matrix.os }} Python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
{% endraw %}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
services:
db:
{% if "mongo" in cookiecutter.db_resource %}
image: mongo:4.2.24
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: mongodb
MONGO_INITDB_ROOT_PASSWORD: mongodb
MONGO_INITDB_DATABASE: relecloud
options: >-
--health-cmd mongo
--health-start-period 20s
--health-interval 10s
--health-timeout 5s
--health-retries 5
{% endif %}
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
with:
{% raw %}
python-version: ${{ matrix.python_version }}
architecture: x64
{% endraw %}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
playwright install chromium --with-deps
python3 -m pip install -e src
- name: Seed data and run Pytest tests
run: |
python3 -m flask --app src.flaskapp seed --filename="src/seed_data.json" --drop
python3 -m pytest
env:
MONGODB_HOST: localhost
MONGODB_USERNAME: mongodb
MONGODB_PASSWORD: mongodb
MONGODB_DATABASE: relecloud
MONGODB_PORT: 27017