-
Notifications
You must be signed in to change notification settings - Fork 2
166 lines (139 loc) · 4.69 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
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
name: CI
on: [push]
jobs:
python-tests:
runs-on: ubuntu-22.04
services:
db:
image: postgres:13.15
# Health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres # pragma: allowlist secret
POSTGRES_DB: postgres
ports:
- 5432:5432
redis:
image: redis:6.2.14
ports:
- 6379:6379
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.23
env:
network.host: "0.0.0.0"
http.cors.enabled: "true"
http.cors.allow-origin: "*"
rest.action.multi.allow_explicit_index: "false"
ES_JAVA_OPTS: -Xms512m -Xmx512m"
ports:
- 9200:9200
steps:
- uses: actions/checkout@v2
- name: Apt install
run: cat Aptfile | sudo xargs apt-get install
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10.13"
- id: cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/test_requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: poetry install --no-interaction
# Configurations required for elasticsearch.
- name: Configure sysctl limits
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: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 6.7.1
- name: Running Celery
run: |
celery -A main worker -B -l INFO &
sleep 10
env:
CELERY_TASK_ALWAYS_EAGER: "True"
CELERY_BROKER_URL: redis://localhost:6379/4
CELERY_RESULT_BACKEND: redis://localhost:6379/4
- name: Tests
run: |
export MEDIA_ROOT="$(mktemp -d)"
sudo mkdir /var/media
sudo chown -R $USER:$USER /var/media
./scripts/test/python_tests.sh
env:
BOOTCAMP_DB_DISABLE_SSL: "True"
BOOTCAMP_SECURE_SSL_REDIRECT: "False"
CELERY_TASK_ALWAYS_EAGER: "True"
CELERY_BROKER_URL: redis://localhost:6379/4
CELERY_RESULT_BACKEND: redis://localhost:6379/4
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres # pragma: allowlist secret
DEBUG: "False"
ELASTICSEARCH_URL: localhost:9200
MAILGUN_URL: "http://fake.example.com"
MAILGUN_KEY: "fake"
NODE_ENV: "production"
- name: Upload coverage to CodeCov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
javascript-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2-beta
with:
node-version: "16.15.0"
- name: Setup environment
run: sudo apt-get install libelf1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines --prefer-offline
- name: Lints
run: npm run lint
- name: Code formatting
run: npm run fmt:check
- name: Scss lint
run: npm run scss_lint
- name: Flow
run: npm run flow
- name: Tests
run: npm run test
env:
CODECOV: true
NODE_ENV: development
- name: Webpack build
run: node node_modules/webpack/bin/webpack.js --config webpack.config.prod.js --bail
- name: Upload test coverage to CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage/lcov.info