-
Notifications
You must be signed in to change notification settings - Fork 77
134 lines (111 loc) · 4.43 KB
/
pod.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
---
name: Django Pod CI
on:
push:
branches: [master, develop]
pull_request:
branches: ["*"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Configure sysctl limits (for ES)
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Remove broken apt repos [Ubuntu]
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
- name: Install Dependencies
run: |
sudo apt-get clean
sudo apt-get update
sudo apt-get install ffmpeg
sudo apt-get install -y ffmpegthumbnailer
sudo apt-get install -y npm
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
sudo npm install -g yarn
- name: Flake8 compliance
run: |
flake8 --max-complexity=7 --ignore=E501,W503,E203 --exclude .git,pod/*/migrations/*.py,*_settings.py
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@refactor_with_plugins
with:
# stack-version: 7.6.0
stack-version: 6.8.23
plugins: analysis-icu
- name: Setup Pod
run: |
coverage run --source='.' manage.py create_pod_index --settings=pod.main.test_settings
python manage.py makemigrations --settings=pod.main.test_settings
python manage.py migrate --settings=pod.main.test_settings
cd pod
yarn
- name: Run Tests with coverage
env:
PYTHONUNBUFFERED: 1
run: |
coverage run --append --source='.' manage.py test -v 3 --settings=pod.main.test_settings
## Start Accessibility tests with pa11y ##
- name: Install pa11y-ci dependencies.
if: matrix.python-version == '3.9'
run: |
npm install -g Badatos/pa11y-ci
- name: Run Django test server
if: matrix.python-version == '3.9'
env:
PYTHONUNBUFFERED: 1
run: |
python manage.py loaddata pod/video/fixtures/initial_data.json --settings=pod.main.test_settings
python manage.py loaddata pod/main/fixtures/initial_data.json --settings=pod.main.test_settings
python manage.py loaddata pod/video/fixtures/sample_videos.json --settings=pod.main.test_settings
python manage.py collectstatic --clear --settings=pod.main.test_settings
coverage run --append --source='.' manage.py runserver localhost:9090 --insecure --settings=pod.main.test_settings &
sleep 5
- name: Run pa11y-ci.
if: matrix.python-version == '3.9'
# tee reads `stdin` and writes it to both `stdout` and a file
run: |
pa11y-ci 2>&1 | tee pa11y_output.txt
- name: Read pa11y_output file.
id: pa11y_output
if: matrix.python-version == '3.9'
uses: juliangruber/read-file-action@v1
with:
path: ./pa11y_output.txt
- name: Comment on pull request.
if: contains(steps.pa11y_output.outputs.content, 'Errors in http://')
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: '<details><summary>Pa11y testing results</summary>
```
${{ steps.pa11y_output.outputs.content }}```
</details>'
- name: Check for pa11y failures.
if: contains(steps.pa11y_output.outputs.content, 'Errors in http://')
run: |
echo "::error::The site is failing accessibility tests. Please review the comment in the pull request or the pa11y-ci step in the workflow for details."
exit 1
- name: Send coverage to coveralls.io
# coveralls command has been installed by requirements-dev.txt
if: matrix.python-version == '3.9'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
coveralls --service=github