-
Notifications
You must be signed in to change notification settings - Fork 4
131 lines (124 loc) · 3.82 KB
/
ci.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
name: CI
on:
push:
env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.5.1"
jobs:
lint-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "**/lint-requirements.txt"
- run: pip install -r lint-requirements.txt
- name: Check compliance with flake8
run: flake8 .
- name: Check compliance with isort
run: isort -c .
- name: Check compliance with Black
run: black etna config --check --fast
test-python:
runs-on: ubuntu-latest
needs: [lint-python]
env:
DJANGO_SETTINGS_MODULE: config.settings.test
DATABASE_ENGINE: django.db.backends.postgresql
DATABASE_NAME: postgres
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
DATABASE_PORT: 5432
services:
postgres:
image: postgres:12.3
env:
POSTGRES_USER: ${{ env.DATABASE_USER }}
POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }}
POSTGRES_DB: ${{ env.DATABASE_NAME }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 1s --health-timeout 3s --health-retries 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
- id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: ds-wagtail-venv-${{ runner.os }}-${{ env.POETRY_VERSION }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run Django checks
run: poetry run python manage.py check
- name: Run test suite
run: poetry run coverage run manage.py test etna
- name: Prepare coverage report
run: poetry run coverage xml
- name: Check for missing migrations
run: poetry run python manage.py makemigrations --check --noinput
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON_VERSION
fail_ci_if_error: true
move_coverage_to_trash: true
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Lint SCSS and JS
run: npm run lint
compile-javascript:
name: Compile JavaScript
runs-on: ubuntu-latest
needs: prettier
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Compile JavaScript
run: npm run compile:js
test-javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install npm modules
run: npm install
- name: Run jest tests
run: npm test
compile-sass:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Compile SCSS
run: npm run compile:css