Skip to content

Commit 426a4af

Browse files
authored
Merge branch 'master' into dependabot/pip/factory-boy-lt-3.3
2 parents 6431d30 + d8d9e80 commit 426a4af

File tree

9 files changed

+323
-210
lines changed

9 files changed

+323
-210
lines changed

.github/workflows/plugin.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Modoboa contacts plugin
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
release:
9+
branches: [ master ]
10+
11+
env:
12+
POSTGRES_HOST: localhost
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
services:
18+
postgres:
19+
image: postgres:11
20+
env:
21+
POSTGRES_USER: postgres
22+
POSTGRES_PASSWORD: postgres
23+
POSTGRES_DB: postgres
24+
ports:
25+
# will assign a random free host port
26+
- 5432/tcp
27+
# needed because the postgres container does not provide a healthcheck
28+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
29+
mysql:
30+
image: mysql:8.0
31+
env:
32+
MYSQL_ROOT_PASSWORD: root
33+
MYSQL_USER: modoboa
34+
MYSQL_PASSWORD: modoboa
35+
MYSQL_DATABASE: modoboa
36+
ports:
37+
- 3306/tcp
38+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
39+
40+
strategy:
41+
matrix:
42+
database: ['postgres', 'mysql']
43+
python-version: [3.7, 3.8, 3.9]
44+
fail-fast: false
45+
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Set up Python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v2
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
- name: Install dependencies
53+
run: |
54+
sudo apt-get update -y && sudo apt-get install -y librrd-dev rrdtool
55+
python -m pip install --upgrade pip
56+
pip install -e git+https://github.com/modoboa/modoboa.git#egg=modoboa
57+
pip install -r requirements.txt
58+
pip install -r test-requirements.txt
59+
python setup.py develop
60+
- name: Install postgres requirements
61+
if: ${{ matrix.database == 'postgres' }}
62+
run: |
63+
pip install psycopg2-binary>=2.7.4
64+
pip install coverage
65+
echo "DB=postgres" >> $GITHUB_ENV
66+
- name: Install mysql requirements
67+
if: ${{ matrix.database == 'mysql' }}
68+
run: |
69+
pip install 'mysqlclient<2.1.1'
70+
echo "DB=mysql" >> $GITHUB_ENV
71+
- name: Test with pytest
72+
if: ${{ matrix.python-version != '3.9' || matrix.database != 'postgres' }}
73+
run: |
74+
cd test_project
75+
python3 manage.py test modoboa_contacts
76+
env:
77+
# use localhost for the host here because we are running the job on the VM.
78+
# If we were running the job on in a container this would be postgres
79+
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
80+
MYSQL_HOST: 127.0.0.1
81+
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} # get randomly assigned published port
82+
MYSQL_USER: root
83+
84+
- name: Test with pytest and coverage
85+
if: ${{ matrix.python-version == '3.9' && matrix.database == 'postgres' }}
86+
run: |
87+
cd test_project
88+
coverage run --source ../modoboa_contacts manage.py test modoboa_contacts
89+
env:
90+
# use localhost for the host here because we are running the job on the VM.
91+
# If we were running the job on in a container this would be postgres
92+
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
93+
MYSQL_HOST: 127.0.0.1
94+
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} # get randomly assigned published port
95+
MYSQL_USER: root
96+
- name: Upload coverage result
97+
if: ${{ matrix.python-version == '3.9' }}
98+
uses: actions/upload-artifact@v2
99+
with:
100+
name: coverage-results
101+
path: test_project/.coverage
102+
103+
coverage:
104+
needs: test
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v2
108+
- name: Set up Python 3.9
109+
uses: actions/setup-python@v2
110+
with:
111+
python-version: '3.9'
112+
- name: Install dependencies
113+
run: |
114+
pip install codecov
115+
- name: Download coverage results
116+
uses: actions/download-artifact@v2
117+
with:
118+
name: coverage-results
119+
- name: Report coverage
120+
run: |
121+
coverage report
122+
codecov
123+
124+
release:
125+
needs: coverage
126+
runs-on: ubuntu-latest
127+
steps:
128+
- uses: actions/checkout@v2
129+
with:
130+
fetch-depth: 0
131+
- name: Set up Python 3.9
132+
uses: actions/setup-python@v2
133+
with:
134+
python-version: '3.9'
135+
- name: Build frontend
136+
shell: bash -l {0}
137+
run: |
138+
cd frontend
139+
nvm install 10.15
140+
npm install
141+
npm run build
142+
cd ..
143+
- name: Build packages
144+
run: |
145+
sudo apt-get install librrd-dev rrdtool libssl-dev gettext
146+
python -m pip install --upgrade pip setuptools wheel
147+
pip install -r requirements.txt
148+
cd modoboa_contacts
149+
django-admin compilemessages
150+
cd ..
151+
python setup.py sdist bdist_wheel
152+
- name: Publish to Test PyPI
153+
if: endsWith(github.event.ref, '/master')
154+
uses: pypa/gh-action-pypi-publish@master
155+
with:
156+
user: __token__
157+
password: ${{ secrets.test_pypi_password }}
158+
repository_url: https://test.pypi.org/legacy/
159+
skip_existing: true
160+
- name: Publish distribution to PyPI
161+
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
162+
uses: pypa/gh-action-pypi-publish@master
163+
with:
164+
user: __token__
165+
password: ${{ secrets.pypi_password }}
166+
skip_existing: true

.travis.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Address book plugin for Modoboa
22
===============================
33

4-
|travis| |codecov|
4+
|gha| |codecov|
55

66
Installation
77
------------
@@ -56,8 +56,8 @@ To update dist files (the ones that will be distributed with the plugin), run::
5656

5757
$ npm run build
5858

59-
.. |travis| image:: https://travis-ci.org/modoboa/modoboa-contacts.svg?branch=master
60-
:target: https://travis-ci.org/modoboa/modoboa-contacts
59+
.. |gha| image:: https://github.com/modoboa/modoboa-contacts/actions/workflows/plugin.yml/badge.svg
60+
:target: https://github.com/modoboa/modoboa-contacts/actions/workflows/plugin.yml
6161

6262
.. |codecov| image:: https://codecov.io/gh/modoboa/modoboa-contacts/branch/master/graph/badge.svg
6363
:target: https://codecov.io/gh/modoboa/modoboa-contacts

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
},
1111
"dependencies": {
1212
"core-js": "^3.6.4",
13-
"electron": "^8.5.2",
13+
"electron": "^13.6.6",
1414
"inject-loader": "^4.0.1",
1515
"js-cookie": "^2.2.1",
16-
"moment": "^2.24.0",
16+
"moment": "^2.29.2",
1717
"vue": "^2.6.11",
1818
"vue-gettext": "^2.1.8",
1919
"vue-resource": "^1.5.1",

0 commit comments

Comments
 (0)