-
Notifications
You must be signed in to change notification settings - Fork 83
159 lines (146 loc) · 5 KB
/
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
name: tests
on:
push:
branches:
- '**'
tags:
- '!**'
pull_request:
branches:
- '**'
jobs:
backend:
services:
mysql:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
python-version: [3.8, 3.9]
runs-on: ubuntu-latest
name: Python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # 3.1.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install -vvv
poetry run pip install -r requirements_dev.txt
- name: Set MySQL mode
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
mysql --host $DB_HOST --port $DB_PORT -uroot -proot -e "SET GLOBAL sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
- name: Lint with flake8
run: |
poetry run flake8
- name: Tests
run: |
poetry run python manage.py test --settings=config.settings.testing
poetry run python manage.py test --settings=config.settings.testing_tenant
frontend:
strategy:
matrix:
node-version: [16.x]
runs-on: ubuntu-latest
name: Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # 3.1.0
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
working-directory: ./ui
run: yarn install
- name: Run ESLint
working-directory: ./ui
run: yarn lint
- name: Run unit tests
working-directory: ./ui
run: yarn test:unit
integration:
services:
mysql:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
node-version: [16.x]
python-version: [3.8, 3.9]
runs-on: ubuntu-latest
name: Node ${{ matrix.node-version }} Python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # 3.1.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install -vvv
poetry run pip install -r requirements_dev.txt
- name: Set MySQL mode
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
mysql --host $DB_HOST --port $DB_PORT -uroot -proot -e "SET GLOBAL sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Build UI packages
working-directory: ./ui
run: |
yarn install
yarn build --mode development
- name: Setup database, static files and run service
env:
SORTINGHAT_SECRET_KEY: my-secret-key
SORTINGHAT_DB_PASSWORD: root
SORTINGHAT_SUPERUSER_USERNAME: root
SORTINGHAT_SUPERUSER_PASSWORD: root
run: |
poetry run sortinghat-admin --config sortinghat.config.settings setup
- name: Start server in the background
run: poetry run sortinghatd --config sortinghat.config.settings --dev &
env:
SORTINGHAT_SECRET_KEY: my-secret-key
SORTINGHAT_DB_PASSWORD: root
UWSGI_HTTP: "http://localhost:8000"
- name: Run integration tests
uses: cypress-io/github-action@v5
with:
install: false
start: yarn serve --api_url=http://localhost:8000/api/
command: yarn test:e2e --config baseUrl=http://localhost:8080
wait-on: 'http://localhost:8080, http://localhost:8000/api/'
spec: tests/e2e/specs/*.js
working-directory: ./ui
env:
CYPRESS_USERNAME: root
CYPRESS_PASSWORD: root
CYPRESS_API_URL: http://localhost:8000/api/