Skip to content

Commit 550cea6

Browse files
committed
[IMP] build wheels
Use github actions to build wheels
1 parent 25b15ea commit 550cea6

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
name: Build wheels on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest]
17+
python-version: [ "3.11" ]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install flake8 pytest build
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
- name: Build wheels
37+
run: python -m build --wheel --outdir build
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: ${{ matrix.os }}-${{ matrix.python-version }}
41+
path: build/*.whl
42+
43+
build-sdist:
44+
name: Build sdist on ${{ matrix.os }}
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
os: [ubuntu-latest]
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Set up Python
54+
uses: actions/setup-python@v5
55+
- name: Install dependencies
56+
run: |
57+
python -m pip install --upgrade pip
58+
python -m pip install build
59+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
60+
- name: Build sdist
61+
run: python -m build --sdist --outdir build
62+
- uses: actions/upload-artifact@v4
63+
with:
64+
name: sdist
65+
path: ./sbuild/*.tar.gz
66+
67+
publish-to-pypi:
68+
name: Publish Python 🐍 distribution 📦 to PyPI
69+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
70+
needs: [ build, build-sdist ]
71+
runs-on: ubuntu-latest
72+
environment:
73+
name: pypi
74+
url: https://pypi.org/p/odoo-client-lib
75+
# environment:
76+
# name: testpypi
77+
# url: https://test.pypi.org/p/odoo-client-lib
78+
permissions:
79+
id-token: write # IMPORTANT: mandatory for trusted publishing
80+
steps:
81+
- name: Download all the dists
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: dist/
85+
- name: Display structure of downloaded files
86+
run: ls -R dist/
87+
- name: Move files from subdirectories
88+
run: |
89+
for subdirectory in dist/*/; do
90+
dir_name=$(basename "$subdirectory")
91+
mv "$subdirectory"* dist/
92+
rm -r "$subdirectory"
93+
echo "Moved files from '$dir_name' to 'dist/'"
94+
done
95+
96+
- name: Publish distribution 📦 to PyPI
97+
uses: pypa/gh-action-pypi-publish@release/v1
98+
# with:
99+
# repository-url: https://test.pypi.org/legacy/

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.r*
2+
*.py[cod]
3+
odoolib/__pycache__
4+
MANIFEST
5+
build
6+
dist

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests>=2.25.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636
setup(name='odoo-client-lib',
37-
version='1.2.1',
37+
version='1.2.3',
3838
description='Odoo Client Library allows to easily interact with Odoo in Python.',
3939
author='Nicolas Vanhoren',
4040
author_email='',

0 commit comments

Comments
 (0)