Skip to content

Commit 3e6c080

Browse files
committed
feat(workflow): add ci workflow
1 parent 12ec432 commit 3e6c080

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened, synchronize, ready_for_review]
6+
branches: [main]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Setup python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -r requirements/test.txt
21+
22+
- name: Set up .env file
23+
run: |
24+
echo "SECURITY_KEY=django_secret_key_example" >> .env
25+
echo "EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend" >> .env
26+
echo "EMAIL_HOST=django.core.mail.backends.console.EmailBackend" >> .env
27+
echo "EMAIL_BACKEND=smtp.gmail.com" >> .env
28+
echo "EMAIL_PORT=465" >> .env
29+
echo "[email protected]" >> .env
30+
echo "EMAIL_HOST_PASSWORD=smpassword" >> .env
31+
echo "ALLOWED_HOSTS='localhost, 127.0.0.1'" >> .env
32+
echo "DJANGO_ENV=test" >> .env
33+
echo "DJANGO_PORT=8000" >> .env
34+
echo "REDIS_HOST=redis_syntax_host" >> .env
35+
echo "REDIS_HOST_DEBUG=localhost" >> .env
36+
echo "REDIS_PASSWORD=redis_syntax_password" >> .env
37+
echo "REDIS_PORT=6755" >> .env
38+
echo "CELERY_PREFETCH_MULTIPLIER=2" >> .env
39+
shell: bash
40+
41+
- name: dockerUp
42+
run: sudo make docker-test-up
43+
44+
- name: Test
45+
run: make test
46+
47+
- name: dockerDown
48+
run: sudo make docker-test-down
49+
50+
- name: Lint
51+
run: make lint

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.PHONY: lint test
2+
3+
ROOT=$(realpath $(dir $(lastword $(MAKEFILE_LIST))))
4+
5+
lint:
6+
pylint .
7+
8+
test:
9+
python manage.py test
10+
11+
docker-test-up:
12+
docker compose -f $(ROOT)/docker-compose-development.yml up -d
13+
14+
docker-test-down:
15+
docker compose -f $(ROOT)/docker-compose-development.yml down

0 commit comments

Comments
 (0)