-
Notifications
You must be signed in to change notification settings - Fork 17
123 lines (119 loc) · 3.78 KB
/
build-core.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
name: Build core (Python / Django)
on:
push:
branches:
- master
pull_request:
paths:
- "**/*.py"
- "templates/**/*.html"
- ".github/workflows/build-core.yml"
- "poetry.lock"
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: "3.11.5"
cache: "poetry"
- name: apt-get
run: |
sudo apt-get update
sudo apt-get install libldap2-dev libsasl2-dev libxmlsec1-dev libmysqlclient-dev pkg-config
- name: poetry install
run: |
poetry install --no-ansi
- name: staticchecks
run: |
mv custom_view_sample custom_view
poetry run mypy ./
poetry run ruff check --output-format=github .
poetry run ruff format --check .
# set modules have python test code outputs.modules
setup_python311:
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.modules.outputs.targets }}
steps:
- uses: actions/checkout@v3
- id: modules
run: |
mv custom_view_sample custom_view
modules=$(ls -d */tests/ | sed 's/\/tests\///' | jq -Rsc 'split("\n")[:-1]')
echo "targets=$modules" >> $GITHUB_OUTPUT
python311:
runs-on: ubuntu-24.04
needs: setup_python311
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.setup_python311.outputs.targets) }}
services:
rabbitmq:
image: rabbitmq:3.8.19-management
ports:
- 5672:5672
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6
ports:
- 9200:9200
env:
discovery.type: single-node
ES_JAVA_OPTS: -Xms512m -Xmx512m
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
mysql:
image: mysql:8.0.36
ports:
- 3306:3306
env:
MYSQL_USER: airone
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: airone
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: "3.11.5"
cache: "poetry"
- name: Install additional dependencies
run: |
sudo apt-get update
sudo apt-get install -y libldap2-dev libsasl2-dev libxmlsec1-dev default-mysql-client default-libmysqlclient-dev
- name: Prepare MySQL
run: |
mysql -protocol=tcp -uroot -h127.0.0.1 -ppassword -e "SET GLOBAL character_set_server=utf8; SET GLOBAL collation_server=utf8_general_ci; SET GLOBAL default_storage_engine=InnoDB;"
mysql -protocol=tcp -uroot -h127.0.0.1 -ppassword -e "GRANT ALL ON *.* to airone@'%'"
- name: poetry install
run: |
poetry install --no-ansi
- name: test
run: |
mv custom_view_sample custom_view
poetry run python manage.py makemigrations
poetry run python manage.py migrate
poetry run python manage.py collectstatic
poetry run coverage run manage.py test ${{ matrix.target }} --parallel
poetry run coverage report
poetry run coverage xml
- name: coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: core/${{ matrix.target }}
continue-on-error: true