-
Notifications
You must be signed in to change notification settings - Fork 9
139 lines (136 loc) · 4.46 KB
/
build.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Python package
on: [ push ]
jobs:
generate-grpc-sources:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install grpcio-tools
wget https://github.com/Sauci/a2l-grpc/releases/download/v0.1.16/a2l_grpc.tar.gz
tar -xf a2l_grpc.tar.gz -C pya2l
- name: Generate gRPC sources
run: |
python -m grpc_tools.protoc -I./pya2l/a2l_grpc --python_out=pya2l --pyi_out=pya2l --grpc_python_out=pya2l ./pya2l/a2l_grpc/protobuf/*.proto
- uses: actions/upload-artifact@v4
with:
name: protobuf
path: pya2l/protobuf
run-pytest-test-linux:
runs-on: ubuntu-22.04
needs:
- generate-grpc-sources
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# see https://github.com/pytest-dev/pytest/issues/11868
pip install codecov dictdiffer grpcio-tools mktestdocs mock pytest==7.4.3 pytest-cases pytest-cov pytest-xdist
wget https://github.com/Sauci/a2l-grpc/releases/download/v0.1.17/a2l_grpc.tar.gz
tar -xf a2l_grpc.tar.gz -C pya2l
- uses: actions/download-artifact@v4
with:
name: protobuf
path: pya2l/protobuf
- name: Test with pytest
run: |
pytest -n 1 --cov-report html --cov pya2l --verbose
codecov
run-pytest-test-windows:
runs-on: windows-2019
needs:
- generate-grpc-sources
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codecov dictdiffer grpcio-tools mktestdocs mock pytest pytest-cases pytest-cov pytest-xdist
powershell.exe -Command "Invoke-WebRequest -OutFile ./a2l_grpc.tar.gz https://github.com/Sauci/a2l-grpc/releases/download/v0.1.17/a2l_grpc.tar.gz"
tar -xf a2l_grpc.tar.gz -C pya2l
- uses: actions/download-artifact@v4
with:
name: protobuf
path: pya2l/protobuf
- name: Test with pytest
run: |
pytest -n 1 --cov-report html --cov pya2l --verbose
codecov
build-distribution:
runs-on: ubuntu-22.04
needs:
- run-pytest-test-linux
- run-pytest-test-windows
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
wget https://github.com/Sauci/a2l-grpc/releases/download/v0.1.17/a2l_grpc.tar.gz
tar -xf a2l_grpc.tar.gz -C pya2l
- uses: actions/download-artifact@v4
with:
name: protobuf
path: pya2l/protobuf
- run: |
python -m build --sdist --wheel
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
publish-package:
runs-on: ubuntu-22.04
needs:
- build-distribution
environment:
name: pypi
url: https://pypi.org/p/pya2l
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package on Python Package Index
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
test-pip-package:
runs-on: ubuntu-22.04
needs:
- publish-package
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pya2l
echo "/begin PROJECT _ \"\" /begin MODULE _ \"\" /end MODULE /end PROJECT" > test.a2l
pya2l test.a2l to_json
pya2l test.a2l to_json -o test.json