Repository navigation
90 lines (82 loc) · 2.75 KB
/
Copy pathpython-app.yml
File metadata and controls
90 lines (82 loc) · 2.75 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Datanar
on:
push:
branches: [ "main", "dev", "artem", "sergey", "vladimir", "for_merge" ]
pull_request:
branches: [ "main", "dev", "artem", "sergey", "vladimir", "for_merge" ]
permissions:
contents: read
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install ruff
run: pip install -r requirements/test.txt
- name: Run ruff check
run: ruff check --show-fixes ./datanar
- name: Run ruff format check
run: ruff format --check --diff ./datanar
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install dependencies
run: pip install -r requirements/test.txt
- name: Run flake8
run: flake8 ./datanar
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install black
run: pip install -r requirements/test.txt
- name: Check code formatting with black
run: black ./datanar --check --diff
django-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
name: django-tests (${{ matrix.os }}, py${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r requirements/dev.txt
- name: Run Django tests
working-directory: ./datanar
run: python manage.py test
prod-deploy:
if: github.ref == 'refs/heads/main'
needs: [ ruff, flake8, black, django-tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
# Ключ на сервере ограничен forced command: что бы ни было в script,
# выполнится только /usr/local/bin/deploy-datanar (git reset на
# origin/main, compose up --build, проверка живости). Сам script
# нужен action-у формально.
script: |
true