gattlib/.github/workflows/github-actions.yml

119 lines
4.2 KiB
YAML

name: gattlib
on: [push]
jobs:
build-debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt install libbluetooth-dev
- run: mkdir build && pushd build && cmake -DCMAKE_BUILD_TYPE=Debug -DGATTLIB_PYTHON_INTERFACE=ON .. && make
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt install libbluetooth-dev doxygen
- run: mkdir build && pushd build && cmake -DCMAKE_BUILD_TYPE=Release -DGATTLIB_BUILD_DOCS=ON -DGATTLIB_PYTHON_INTERFACE=ON .. && make
- run: pushd build && cpack ..
if: startsWith(github.ref, 'refs/tags/')
env:
PACKAGE_VERSION: '${{github.ref_name}}'
- name: Archive Distribution packages
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: distribution-packages
path: |
build/*.deb
build/*.rpm
build/*.zip
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/*.deb
build/*.rpm
build/*.zip
build-release-force-dbus:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt install libbluetooth-dev
- run: mkdir build && pushd build && cmake -DGATTLIB_FORCE_DBUS=TRUE -DCMAKE_BUILD_TYPE=Release -DGATTLIB_PYTHON_INTERFACE=ON .. && make
build-release-without-python-support:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt install libbluetooth-dev
- run: mkdir build && pushd build && cmake -DCMAKE_BUILD_TYPE=Release -DGATTLIB_PYTHON_INTERFACE=OFF .. && make
test-pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: python3 -m pip install PyGObject>=3.44.0
- run: python3 -m pip install pylint
- run: python3 -m pylint gattlib-py/gattlib --rcfile gattlib-py/.pylintrc
generate-python-binary-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt install -y libbluetooth-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- run: ./ci/generate-python-package.sh
if: startsWith(github.ref, 'refs/tags/')
env:
CIBW_BEFORE_BUILD_LINUX: "sh ci/install-bluez.sh"
GATTLIB_PY_VERSION: '${{github.ref_name}}'
CIBW_ENVIRONMENT_PASS_LINUX: "GATTLIB_PY_VERSION"
#TODO: To support 'musllinux', we need to replace 'yum install' by 'apk install' - and detect which platform we are
CIBW_SKIP: "*-musllinux_*"
- run: ./ci/generate-python-package.sh
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
env:
CIBW_BEFORE_BUILD_LINUX: "sh ci/install-bluez.sh"
GATTLIB_PY_VERSION: '0.0.1'
CIBW_ENVIRONMENT_PASS_LINUX: "GATTLIB_PY_VERSION"
#TODO: To support 'musllinux', we need to replace 'yum install' by 'apk install' - and detect which platform we are
CIBW_SKIP: "*-musllinux_*"
- name: Archive Python packages
uses: actions/upload-artifact@v4
with:
name: python-binary-packages
path: dist/*
# publish-python-packages:
# needs:
# - generate-python-binary-packages
# runs-on: ubuntu-latest
# steps:
# - uses: actions/download-artifact@master
# - run: ls *
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- generate-python-binary-packages
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/gattlib-py # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/download-artifact@master
- run: |
mkdir dist/
mv python-binary-packages/*.tar.gz dist/
mv python-binary-packages/*.whl dist/
ls dist/*
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1