forked from nicolas-van/openerp-client-lib
-
Notifications
You must be signed in to change notification settings - Fork 47
96 lines (89 loc) · 2.92 KB
/
python-package.yml
File metadata and controls
96 lines (89 loc) · 2.92 KB
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
name: Python package
on:
release:
types: [created]
jobs:
build:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build wheels
run: python -m build --wheel --outdir build
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: build/*.whl
build-sdist:
name: Build sdist on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build sdist
run: python -m build --sdist --outdir build
- uses: actions/upload-artifact@v4
with:
name: sdist
path: ./sbuild/*.tar.gz
publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
needs: [ build, build-sdist ]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/odoo-client-lib
# environment:
# name: testpypi
# url: https://test.pypi.org/p/odoo-client-lib
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
path: dist/
- name: Display structure of downloaded files
run: ls -R dist/
- name: Move files from subdirectories
run: |
for subdirectory in dist/*/; do
dir_name=$(basename "$subdirectory")
mv "$subdirectory"* dist/
rm -r "$subdirectory"
echo "Moved files from '$dir_name' to 'dist/'"
done
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/