Skip to content

Commit df4b665

Browse files
committed
feat: add an action with pythonpackage.yml
1 parent 575ebae commit df4b665

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Python application
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
services:
11+
postgres:
12+
image: postgres:12
13+
env:
14+
POSTGRES_USER: postgres
15+
POSTGRES_PASSWORD: postgres
16+
POSTGRES_DB: postgres
17+
ports:
18+
- 5432:5432
19+
# needed because the postgres container does not provide a healthcheck
20+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
21+
22+
steps:
23+
- uses: actions/checkout@v1
24+
- name: Set up Python 3.8
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: 3.8
28+
- name: Configure sysctl limits
29+
run: |
30+
sudo swapoff -a
31+
sudo sysctl -w vm.swappiness=1
32+
sudo sysctl -w fs.file-max=262144
33+
sudo sysctl -w vm.max_map_count=262144
34+
35+
- uses: getong/elasticsearch-action@v1.2
36+
with:
37+
elasticsearch version: '2.3'
38+
host port: 9200
39+
container port: 9200
40+
host node port: 9300
41+
node port: 9300
42+
discovery type: 'single-node'
43+
- name: psycopg2 prerequisites
44+
run: sudo apt-get install python-dev libpq-dev
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install -r requirements.txt
49+
pip install pytest-django
50+
- name: Run migrations
51+
run: python manage.py migrate
52+
- name: Validate Project
53+
run: python manage.py check
54+
- name: Run Tests
55+
run: python manage.py test

0 commit comments

Comments
 (0)