-
Notifications
You must be signed in to change notification settings - Fork 24
161 lines (130 loc) · 4.34 KB
/
main.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Lint and test
on:
push:
branches:
- main
pull_request:
merge_group:
env:
POETRY_VERSION: "1.6.1"
NODE_VERSION: "18"
jobs:
test-python:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_USER: ow4user
POSTGRES_DB: ow4db
POSTGRES_PASSWORD: ow4password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache python packages
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Install Poetry
run: pip install poetry==${{ env.POETRY_VERSION }}
- name: Install python dependencies
run: poetry install --no-interaction --no-ansi -E postgresql
- name: Install node dependencies
run: npm ci
- name: npm build
run: npm run build
- name: Python tests
env:
OW4_DJANGO_STRIPE_PUBLIC_KEY_ARRKOM: ${{ secrets.STRIPE_PUBLIC_KEY_ARRKOM }}
OW4_DJANGO_STRIPE_PUBLIC_KEY_PROKOM: ${{ secrets.STRIPE_PUBLIC_KEY_PROKOM }}
OW4_DJANGO_STRIPE_PUBLIC_KEY_TRIKOM: ${{ secrets.STRIPE_PUBLIC_KEY_TRIKOM }}
OW4_DJANGO_STRIPE_PRIVATE_KEY_ARRKOM: ${{ secrets.STRIPE_PRIVATE_KEY_ARRKOM }}
OW4_DJANGO_STRIPE_PRIVATE_KEY_PROKOM: ${{ secrets.STRIPE_PRIVATE_KEY_PROKOM }}
OW4_DJANGO_STRIPE_PRIVATE_KEY_TRIKOM: ${{ secrets.STRIPE_PRIVATE_KEY_TRIKOM }}
# TODO: see service todo
DATABASE_URL: postgres://ow4user:ow4password@localhost:5432/ow4db
run: poetry run py.test --cov=apps --cov-report xml
- uses: codecov/codecov-action@v3
lint-python:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache python packages
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Install Poetry
run: pip install poetry==${{ env.POETRY_VERSION }}
- name: Install python dependencies
run: poetry install --no-interaction --no-ansi
- name: Ruff
run: poetry run isort -c apps scripts utils onlineweb4
- name: Isort
run: poetry run black --check apps scripts utils onlineweb4
- name: Black
run: poetry run ruff check apps scripts utils onlineweb4
django-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache python packages
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Install Poetry
run: pip install poetry==${{ env.POETRY_VERSION }}
- name: Install python dependencies
run: poetry install --no-interaction --no-ansi
- name: Check migrations
run: poetry run python manage.py makemigrations --check
- name: Django check
run: poetry run python manage.py check
lint-js:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install node dependencies
run: npm ci
- name: JS linting
run: npm run lint-js
- name: less linting
run: npm run lint-less