Skip to content

Commit 0a71136

Browse files
committed
add linter workflows
1 parent ff1b123 commit 0a71136

File tree

3 files changed

+76
-11
lines changed

3 files changed

+76
-11
lines changed

.github/workflows/django.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Django CI
1+
name: Django Test
22

33
on:
44
push:
@@ -20,23 +20,21 @@ jobs:
2020

2121
steps:
2222
- name: Check out the repository
23-
uses: actions/checkout@v4 # This is an action, so it uses 'uses'
23+
uses: actions/checkout@v4
2424

2525
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v3 # This is an action, so it uses 'uses'
26+
uses: actions/setup-python@v3
2727
with:
2828
python-version: ${{ matrix.python-version }}
2929

3030
- name: Install OpenSSL
31-
run: sudo apt-get install -y openssl # This is a command, so it uses 'run'
31+
run: sudo apt-get install -y openssl
3232

3333
- name: Generate private and public keys
3434
run: |
35-
# Очистка старых файлов перед созданием новых
3635
rm -rf security
3736
mkdir -p security
3837
39-
# Генерация приватного и публичного ключа
4038
openssl genpkey -algorithm RSA -out security/private_key.pem -pkeyopt rsa_keygen_bits:2048
4139
openssl rsa -pubout -in security/private_key.pem -out security/public_key.pem
4240
@@ -53,17 +51,17 @@ jobs:
5351
5452
5553
- name: Check if .env has been updated
56-
run: cat .env # This is a command, so it uses 'run'
54+
run: cat .env
5755

5856
- name: Install Dependencies
5957
run: |
6058
python -m pip install --upgrade pip
61-
pip install -r requirements.txt # This is a command, so it uses 'run'
59+
pip install -r requirements.txt
6260
6361
- name: Run Tests
64-
run: python manage.py test # This is a command, so it uses 'run'
62+
run: python manage.py test
6563

6664
- name: Clean up keys (Optional)
6765
run: |
6866
rm -rf security
69-
echo "Keys removed after use." # This is a command, so it uses 'run'
67+
echo "Keys removed after use."

.github/workflows/lint.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Django Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "master"
8+
pull_request:
9+
branches:
10+
- "main"
11+
- "master"
12+
13+
jobs:
14+
15+
build:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: [3.8, 3.9]
20+
21+
steps:
22+
- name: Check out the repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install OpenSSL
31+
run: sudo apt-get install -y openssl
32+
33+
- name: Generate private and public keys
34+
run: |
35+
rm -rf security
36+
mkdir -p security
37+
38+
openssl genpkey -algorithm RSA -out security/private_key.pem -pkeyopt rsa_keygen_bits:2048
39+
openssl rsa -pubout -in security/private_key.pem -out security/public_key.pem
40+
41+
echo "Private key saved as security/private_key.pem"
42+
echo "Public key saved as security/public_key.pem"
43+
44+
- name: Create .env file
45+
run: |
46+
touch .env
47+
echo PRIVATE_KEY_PATH=$(pwd)/security/private_key.pem >> .env
48+
echo PUBLIC_KEY_PATH=$(pwd)/security/public_key.pem >> .env
49+
DJANGO_SETTINGS_MODULE=core.settings.development >> .env
50+
echo DATABASE_ENVIRON=sqlite3 >> .env
51+
52+
53+
- name: Check if .env has been updated
54+
run: cat .env
55+
56+
- name: Install Dependencies
57+
run: |
58+
pip install flake8
59+
python -m pip install --upgrade pip
60+
pip install -r requirements.txt
61+
62+
- name: Lint Code
63+
run: flake8 .
64+
65+
- name: Clean up keys (Optional)
66+
run: |
67+
rm -rf security
68+
echo "Keys removed after use."

core/config/apps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
"rest_framework",
2222
"rest_framework_simplejwt",
2323
"rest_framework_simplejwt.token_blacklist",
24-
2524
]

0 commit comments

Comments
 (0)