Merge branch 'develop' #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.7", "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 mock pytest==7.4.3 pytest-cases pytest-cov | |
wget https://github.com/Sauci/a2l-grpc/releases/download/v0.1.16/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 --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.7", "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 mock pytest pytest-cases pytest-cov | |
powershell.exe -Command "Invoke-WebRequest -OutFile ./a2l_grpc.tar.gz https://github.com/Sauci/a2l-grpc/releases/download/v0.1.16/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 --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.16/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.7", "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 | |