-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.54 KB
/
test-backend-app.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
56
57
58
59
name: Test backend app
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
env:
working-directory: ./backend
steps:
- uses: actions/checkout@v3
- name: configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.6.1
- name: setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.11.1
security-enabled: false
port: 9300
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ${{env.working-directory}}/.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: install the project dependencies
run: poetry install
working-directory: ${{env.working-directory}}
- name: test app
run: poetry run python -m pytest tests -c pytest.ini
working-directory: ${{env.working-directory}}