Skip to content

Commit 7b1b297

Browse files
committed
Initial commit
Signed-off-by: Santiago Dueñas <sduenas@bitergia.com>
0 parents  commit 7b1b297

30 files changed

Lines changed: 3038 additions & 0 deletions

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
exclude = .git, .eggs, __pycache__, build, dist, docs, docker, migrations
3+
ignore = E129, E402, F841, W504 E128
4+
max-line-length = 130

.github/workflows/changelog.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Check changelog file included
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'sortinghat/**'
7+
8+
jobs:
9+
check-changelog:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: bitergia/release-tools-check-changelog@main

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
- '*.*.*-*'
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Build package using Poetry and store result
15+
uses: chaoss/grimoirelab-github-actions/build@main
16+
with:
17+
artifact-name: sh-eclipse-foundation-dist
18+
artifact-path: dist
19+
20+
tests:
21+
needs: [build]
22+
runs-on: ubuntu-latest
23+
services:
24+
mysql:
25+
image: mariadb:10.5
26+
env:
27+
MYSQL_ROOT_PASSWORD: root
28+
ports:
29+
- 3306:3306
30+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
31+
32+
name: Python ${{ matrix.python-version }} for ES ${{ matrix.elasticsearch-version }}
33+
strategy:
34+
matrix:
35+
python-version: ['3.9', '3.10', '3.11', '3.12']
36+
37+
steps:
38+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39+
40+
- name: Download distribution artifact
41+
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
42+
with:
43+
name: sh-eclipse-foundation-dist
44+
path: dist
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Install dev dependencies
52+
run: |
53+
curl -sSL https://install.python-poetry.org | python3 -
54+
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
55+
poetry install --only dev
56+
57+
- name: Set MySQL mode
58+
env:
59+
DB_HOST: 127.0.0.1
60+
DB_PORT: ${{ job.services.mysql.ports[3306] }}
61+
run: |
62+
mysql --host $DB_HOST --port $DB_PORT -uroot -proot -e "SET GLOBAL sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
63+
64+
- name: Test package
65+
run: |
66+
PACKAGE=`(cd dist && ls *whl)` && echo $PACKAGE
67+
poetry run pip install --pre ./dist/$PACKAGE
68+
poetry run python manage.py test --settings=config.settings.testing
69+
70+
release:
71+
needs: [tests]
72+
runs-on: ubuntu-latest
73+
permissions:
74+
contents: write
75+
steps:
76+
- name: Create a new release on the repository
77+
uses: chaoss/grimoirelab-github-actions/release@main
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
81+
publish:
82+
needs: [tests]
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Publish the package on PyPI
86+
uses: chaoss/grimoirelab-github-actions/publish@main
87+
with:
88+
artifact-name: sh-eclipse-foundation-dist
89+
artifact-path: dist
90+
pypi-api-token: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- '!**'
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
jobs:
14+
15+
backend:
16+
17+
services:
18+
mysql:
19+
image: mariadb:10.5
20+
env:
21+
MYSQL_ROOT_PASSWORD: root
22+
ports:
23+
- 3306:3306
24+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
25+
26+
strategy:
27+
matrix:
28+
python-version: ['3.9', '3.10', '3.11', '3.12']
29+
30+
runs-on: ubuntu-latest
31+
name: Python ${{ matrix.python-version }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- name: Install poetry
40+
run: |
41+
curl -sSL https://install.python-poetry.org | python3 -
42+
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
43+
- name: Install dependencies
44+
run: |
45+
poetry install -vvv
46+
poetry run pip install -r requirements_dev.txt
47+
- name: Set MySQL mode
48+
env:
49+
DB_HOST: 127.0.0.1
50+
DB_PORT: ${{ job.services.mysql.ports[3306] }}
51+
run: |
52+
mysql --host $DB_HOST --port $DB_PORT -uroot -proot -e "SET GLOBAL sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
53+
- name: Lint with flake8
54+
run: |
55+
poetry run flake8
56+
- name: Tests
57+
run: |
58+
poetry run python manage.py test --settings=config.settings.testing

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Python files
2+
*.pyc
3+
*.pyo
4+
build
5+
dist
6+
7+
# Local env files
8+
.env.local
9+
.env.*.local
10+
11+
# Log files
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+
16+
# Editor directories and files
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?
24+
.project
25+
.pydevproject
26+
.settings
27+
28+
# Documentation
29+
.eggs/
30+
docs/_build/
31+
docs/source

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Jose Javier Merchante <jjmerchante@bitergia.com>
2+
Santiago Dueñas <sduenas@bitergia.com>
3+

0 commit comments

Comments
 (0)