-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (125 loc) · 3.84 KB
/
api_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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Python CI
on: ["pull_request", "push"]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
poetry-version: [1.8.2]
services:
postgres:
image: postgres:16.3
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: misp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
opensearch:
image: opensearchproject/opensearch:1.3.16
ports:
- 9200:9200
- 9300:9300
env:
OPENSEARCH_HOSTNAME: localhost
OPENSEARCH_PORT: 9200
OPENSEARCH_INITIAL_ADMIN_PASSWORD: ;pnNZC+$#&5Af%'
cluster.name: opensearch-cluster
node.name: opensearch-misp1
discovery.type: single-node
bootstrap.memory_lock: true
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
plugins.security.disabled: true
redis:
image: redis:7-alpine
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:3-management
ports:
- 15672:15672
- 5672:5672
env:
RABBITMQ_DEFAULT_VHOST: rabbitmq
RABBITMQ_DEFAULT_USER: rabbitmq
RABBITMQ_DEFAULT_PASS: rabbitmq
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
modules:
image: ghcr.io/misp/misp-docker/misp-modules:latest
ports:
- 6666:6666
env:
REDIS_BACKEND: redis
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
env:
PYTHONDONTWRITEBYTECODE: 1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
virtualenvs-path: ~/.virtualenvs
# - name: Load cached venv
# id: cached-poetry-dependencies
# uses: actions/cache@v2
# with:
# path: api
# key: venv2-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ hashFiles('api/poetry.lock') }}
- name: Install dependencies
working-directory: api
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
env:
PYTHONDONTWRITEBYTECODE: 1
run: poetry install --no-interaction --no-root
- name: Run DB migrations
working-directory: api
run: |
poetry run alembic upgrade head
env:
POSTGRES_HOSTNAME: localhost
POSTGRES_PORT: 5432
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: misp
OPENSEARCH_HOSTNAME: localhost
OPENSEARCH_PORT: 9200
- name: Run tests
working-directory: api
run: |
poetry run pytest
env:
POSTGRES_HOSTNAME: localhost
POSTGRES_PORT: 5432
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: misp
OPENSEARCH_HOSTNAME: localhost
OPENSEARCH_PORT: 9200
OAUTH2_SECRET_KEY: e6d14a781f168c29f8ba7dad72c2ad1418375ab9e3878ea671ba87cf76618511
OAUTH2_ALGORITHM: HS256
OAUTH2_ACCESS_TOKEN_EXPIRE_MINUTES: 30
CELERY_BROKER_URL: amqp://rabbitmq:rabbitmq@localhost:5672/rabbitmq
CELERY_RESULT_BACKEND: redis://localhost:6379/0
MAIL_USERNAME: mail-user
MAIL_PASSWORD: mail-pwd
MAIL_PORT: 1025
MAIL_SERVER: localhost
MODULES_HOST: localhost
MODULES_PORT: 6666