diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 50235ae1..aaf7c25c 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -21,3 +21,43 @@ jobs: - uses: actions/checkout@v2 - run: sudo apt install libbluetooth-dev - run: mkdir build && pushd build && cmake -DGATTLIB_FORCE_DBUS=TRUE -DCMAKE_BUILD_TYPE=Release .. && make + + generate-python-source-packages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: sudo apt install -y libbluetooth-dev + - run: ./ci/generate-python-package.sh + - name: Archive Python packages + uses: actions/upload-artifact@v4 + with: + name: python-source-package + path: dist/*.tar.gz + + generate-python-binary-packages: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + steps: + - uses: actions/checkout@v2 + - run: sudo apt install -y libbluetooth-dev + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - run: ./ci/generate-python-package.sh + env: + SKIP_SOURCE_PACKAGE: 1 + - name: Archive Python packages + uses: actions/upload-artifact@v4 + with: + name: python-${{ matrix.python-version }}-binary-package + path: dist/* + + publish-python-packages: + needs: generate-python-packages + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@master + - run: ls dist/* diff --git a/ci/generate-python-package.sh b/ci/generate-python-package.sh index 217f8625..d9c0a424 100755 --- a/ci/generate-python-package.sh +++ b/ci/generate-python-package.sh @@ -39,14 +39,17 @@ python3 -m pip install wheel # Generate packages pushd ${gattlib_py_package_dir} -# Binary package -python3 setup.py bdist_wheel +if [[ -z "${SKIP_SOURCE_PACKAGE}" ]]; then + # Binary package + python3 setup.py bdist_wheel +fi + # Source package python setup.py sdist # Move generated artifact to project root path ls dist/* -mv dist/* ${ROOT_PATH} +mv dist ${ROOT_PATH} popd