Skip to content

Fix pywayland-scanner entrypoint #163

Fix pywayland-scanner entrypoint

Fix pywayland-scanner entrypoint #163

Workflow file for this run

name: Publish to PyPI
on:
pull_request:
push:
release:
types: [published]
workflow_dispatch:
jobs:
build-wayland:
name: Build Wayland libraries
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
env:
wayland-version: "1.22.0"
wayland-protocols-version: "1.32"
python-version: "3.12"
steps:
- name: Install dependencies
run: |
yum -y install \
libffi-devel \
libxml2-devel \
ninja-build \
wget
- name: Download and unpack Wayland source
run: |
wget $WAYLAND_URL
wget $WAYLAND_PROTOCOLS_URL
tar -xJf wayland-${{ env.wayland-version }}.tar.xz
tar -xJf wayland-protocols-${{ env.wayland-protocols-version }}.tar.xz
env:
WAYLAND_URL: https://gitlab.freedesktop.org/wayland/wayland/-/releases/${{ env.wayland-version }}/downloads/wayland-${{ env.wayland-version }}.tar.xz
WAYLAND_PROTOCOLS_URL: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/${{ env.wayland-protocols-version }}/downloads/wayland-protocols-${{ env.wayland-protocols-version }}.tar.xz
- name: Set environment variables
run: |
echo "CPATH=/wayland/usr/include" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/wayland/usr/lib" >> $GITHUB_ENV
echo "LIBRARY_PATH=/wayland/usr/lib" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/wayland/usr/share/pkgconfig:/wayland/usr/lib/pkgconfig" >> $GITHUB_ENV
- name: Set python version
run: |
PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-*)
echo "${PYTHON_ROOT}/bin" >> $GITHUB_PATH
shell: bash
env:
PYTHON_VERSION: ${{ env.python-version }}
- name: Install python dependencies
run: |
pip install meson ninja
- name: Build Wayland
working-directory: wayland-${{ env.wayland-version }}
run: |
meson build --prefix=/usr -Ddocumentation=false
ninja -C build
DESTDIR=/wayland ninja -C build install
ninja -C build install
- name: Build Wayland protocols
working-directory: wayland-protocols-${{ env.wayland-protocols-version }}
run: |
meson build --prefix=/usr
ninja -C build
DESTDIR=/wayland ninja -C build install
- name: Create artifact
run: tar czf /wayland.tar.gz -C /wayland/ .
- name: Upload built libraries
uses: actions/upload-artifact@v3
with:
name: wayland
path: /wayland.tar.gz
if-no-files-found: error
build-wheel-cpython:
name: Build CPython wheels
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
needs: build-wayland
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Download wayland libraries
uses: actions/download-artifact@v3
with:
name: wayland
- name: Unpack wayland artifact
run: tar xf wayland.tar.gz -C /
- name: Set environment variables
run: |
PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-*)
echo "${PYTHON_ROOT}/bin" >> $GITHUB_PATH
shell: bash
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Install Python dependencies
run: |
python --version
python -m pip install auditwheel build
- name: Build wheels
run: |
python -m build --wheel
auditwheel repair --plat manylinux_2_28_x86_64 -w output_wheels dist/pywayland-*.whl
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.python-version }}
path: output_wheels/*.whl
build-wheel-pypy:
name: Build PyPy wheels
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
needs: build-wayland
strategy:
matrix:
include:
- python-version: "3.8"
pypy-version: "7.3"
- python-version: "3.9"
pypy-version: "7.3"
- python-version: "3.10"
pypy-version: "7.3"
steps:
- name: Download wayland libraries
uses: actions/download-artifact@v3
with:
name: wayland
- name: Unpack wayland artifact
run: tar xf wayland.tar.gz -C /
- name: Set environment variables
run: |
PYTHON_ROOT=$(find /opt/python -name pp${PYTHON_VERSION/./}-*_pp${PP_VERSION/./})
echo "${PYTHON_ROOT}/bin" >> $GITHUB_PATH
shell: bash
env:
PYTHON_VERSION: ${{ matrix.python-version }}
PP_VERSION: ${{ matrix.pypy-version }}
- uses: actions/checkout@v3
- name: Install Python dependencies
run: |
python --version
python -m pip install auditwheel build
- name: Build wheels
run: |
python -m build --wheel
auditwheel repair --plat manylinux_2_28_x86_64 -w output_wheels dist/pywayland-*.whl
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels-pypy-${{ matrix.python-version }}
path: output_wheels/*.whl
test-wheel:
name: Test wheels
runs-on: ubuntu-latest
needs: [build-wheel-cpython, build-wheel-pypy]
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels-${{ matrix.python-version }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install wheel
run: pip install pywayland-*.whl
- name: Check installation
shell: python
run: |
import pywayland
print(pywayland.__wayland_version__)
build-source:
name: Build source package
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
needs: build-wayland
env:
python-version: "3.12"
steps:
- name: Download wayland libraries
uses: actions/download-artifact@v3
with:
name: wayland
- name: Unpack wayland artifact
run: tar xf wayland.tar.gz -C /
- name: Set environment variables
run: |
PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-*)
echo "${PYTHON_ROOT}/bin" >> $GITHUB_PATH
shell: bash
env:
PYTHON_VERSION: ${{ env.python-version }}
- uses: actions/checkout@v3
- name: Install Python dependencies
run: |
python --version
python -m pip install build
- name: Build source
run: |
python -m build --sdist
- name: Upload source
uses: actions/upload-artifact@v3
with:
name: source
path: dist/*.tar.gz
upload-wheel:
name: Upload wheels
runs-on: ubuntu-latest
needs: [test-wheel, build-source]
steps:
- name: Download wheels CPython 3.8
uses: actions/download-artifact@v3
with:
name: wheels-3.8
path: dist/
- name: Download wheels CPython 3.9
uses: actions/download-artifact@v3
with:
name: wheels-3.9
path: dist/
- name: Download wheels CPython 3.10
uses: actions/download-artifact@v3
with:
name: wheels-3.10
path: dist/
- name: Download wheels CPython 3.11
uses: actions/download-artifact@v3
with:
name: wheels-3.11
path: dist/
- name: Download wheels CPython 3.12
uses: actions/download-artifact@v3
with:
name: wheels-3.12
path: dist/
- name: Download wheels PyPy 3.8
uses: actions/download-artifact@v3
with:
name: wheels-pypy-3.8
path: dist/
- name: Download wheels PyPy 3.9
uses: actions/download-artifact@v3
with:
name: wheels-pypy-3.9
path: dist/
- name: Download wheels PyPy 3.10
uses: actions/download-artifact@v3
with:
name: wheels-pypy-3.10
path: dist/
- name: Download source
uses: actions/download-artifact@v3
with:
name: source
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true