-
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (54 loc) · 2.15 KB
/
django.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
name: Django CI
on:
push:
branches:
- "main"
- "master"
pull_request:
branches:
- "main"
- "master"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
steps:
- name: Check out the repository
uses: actions/checkout@v4 # This is an action, so it uses 'uses'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3 # This is an action, so it uses 'uses'
with:
python-version: ${{ matrix.python-version }}
- name: Install OpenSSL
run: sudo apt-get install -y openssl # This is a command, so it uses 'run'
- name: Generate private and public keys
run: |
# Очистка старых файлов перед созданием новых
rm -rf security
mkdir -p security
# Генерация приватного и публичного ключа
openssl genpkey -algorithm RSA -out security/private_key.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in security/private_key.pem -out security/public_key.pem
echo "Private key saved as security/private_key.pem"
echo "Public key saved as security/public_key.pem"
- name: Create .env file
run: |
touch .env
echo PRIVATE_KEY_PATH=$(pwd)/security/private_key.pem >> .env
echo PUBLIC_KEY_PATH=$(pwd)/security/public_key.pem >> .env
DJANGO_SETTINGS_MODULE=core.settings.development >> .env
echo DATABASE_ENVIRON=sqlite3 >> .env
- name: Check if .env has been updated
run: cat .env # This is a command, so it uses 'run'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt # This is a command, so it uses 'run'
- name: Run Tests
run: python manage.py test # This is a command, so it uses 'run'
- name: Clean up keys (Optional)
run: |
rm -rf security
echo "Keys removed after use." # This is a command, so it uses 'run'