-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (176 loc) · 5.55 KB
/
django-tests.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Build and Test App
on:
push:
branches: [ develop, main, ]
pull_request:
branches: [ develop, main, ]
jobs:
build_vue:
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
node-version: [16]
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'babex-vue/package-lock.json'
- name: Install node deps
run: |
cd babex-vue
npm ci
- name: Lint Vue app
run: |
cd babex-vue
npm run lint
- name: Build Vue app
if: always() # continue with build when linting fails
run: |
cd babex-vue
npm run build
- name: Package app
run: |
cd lab/main/static/
tar cvf babex-vue.tar vue
gzip babex-vue.tar
- uses: actions/upload-artifact@v4
with:
name: babex-vue
path: lab/main/static/babex-vue.tar.gz
build:
needs: build_vue
runs-on: ubuntu-latest
continue-on-error: false
strategy:
max-parallel: 2
matrix:
python-version: ['3.10']
app: ['lab', 'parent']
steps:
- name: Install OS dependencies
run: |
sudo apt-get update
sudo apt-get install -y libldap2-dev libsasl2-dev libssl-dev gettext poppler-utils poppler-data libpoppler-cpp-dev
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
cd ${{ matrix.app }}
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install flake8 pytest
- name: pip freeze
run: |
pip freeze
- name: Lint with flake8
run: |
cd ${{ matrix.app }}
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Compile 18n
run: |
cd ${{ matrix.app }}
python manage.py compilemessages
- name: Check for missing migrations
run: |
cd ${{ matrix.app }}
python manage.py makemigrations --check --dry-run
- name: Run django tests
run: |
cd ${{ matrix.app }}
make test
- name: Download vue app
uses: actions/download-artifact@v4
with:
name: babex-vue
- name: Unpack vue app
run: |
# deploy vue app twice
tar xzf babex-vue.tar.gz -C lab/main/static/
tar xzf babex-vue.tar.gz -C parent/parent/static/
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(pip freeze | grep ^playwright | cut -d= -f3)" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
path: ~/.cache/ms-playwright
- name: Integration tests
run: |
cd ${{ matrix.app }}
playwright install
export DJANGO_ALLOW_ASYNC_UNSAFE=1
make testint
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.app }}-pytest_logs
path: ${{ matrix.app }}/test-results
integration:
needs: build
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Install OS dependencies
run: |
sudo apt-get update
sudo apt-get install -y libldap2-dev libsasl2-dev libssl-dev gettext poppler-utils poppler-data libpoppler-cpp-dev xmlsec1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
cd parent
pip install -r requirements.txt
pip install -r requirements-dev.txt
cd ../lab
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Compile 18n
run: |
cd lab
python manage.py compilemessages
- name: Compile 18n
run: |
cd parent
python manage.py compilemessages
- name: Download vue app
uses: actions/download-artifact@v4
with:
name: babex-vue
- name: Unpack vue app
run: |
tar xzf babex-vue.tar.gz -C lab/main/static/
tar xzf babex-vue.tar.gz -C parent/parent/static/
- name: Integration tests
run: |
cd integration_tests
playwright install
export DJANGO_ALLOW_ASYNC_UNSAFE=1
pytest --tracing retain-on-failure
- uses: actions/upload-artifact@v4
if: failure()
with:
name: integration-pytest_logs
path: integration_tests/test-results