diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml new file mode 100644 index 00000000..7aa2a025 --- /dev/null +++ b/.github/workflows/wheels.yaml @@ -0,0 +1,99 @@ +name: Build Python distributions + +on: + push: + pull_request: + schedule: + - cron: "0 6 * * *" # Daily 6AM UTC build + +jobs: + build-wheels: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + fail-fast: true + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade setuptools wheel fastimport paramiko urllib3 cibuildwheel setuptools-rust + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + if: "matrix.os == 'ubuntu-latest'" + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: artifact-{{ matrix.os }} + path: ./wheelhouse/*.whl + + build-sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install dependencies (apt) + run: | + sudo apt update + sudo apt install libapr1-dev libaprutil1-dev libdb5.3-dev liblz4-dev libsasl2-dev libperl-dev libserf-dev libsqlite3-dev libtool python-all-dev libneon27-gnutls-dev libutf8proc-dev libsvn-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build sdist + run: python -m build --sdist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: artifact-source + path: ./dist/*.tar.gz + + test-sdist: + needs: + - build-sdist + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + - name: Install dependencies (apt) + run: | + sudo apt update + sudo apt install libapr1-dev libaprutil1-dev libdb5.3-dev liblz4-dev libsasl2-dev libperl-dev libserf-dev libsqlite3-dev libtool python-all-dev libneon27-gnutls-dev libutf8proc-dev libsvn-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine + - name: Download sdist + uses: actions/download-artifact@v4 + with: + name: artifact-source + path: dist + - name: Test sdist + run: twine check dist/* + - name: Test installation from sdist + run: pip install dist/*.tar.gz + + publish: + runs-on: ubuntu-latest + needs: + - build-wheels + - build-sdist + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/subvertpy-') + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/subvertpy + steps: + - name: Download distributions + uses: actions/download-artifact@v2 + with: + pattern: artifact-* + merge-multiple: true + path: dist + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/MANIFEST.in b/MANIFEST.in index d7fcd217..1cbfe5f6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,3 +7,5 @@ include README.md include Makefile include subvertpy.cfg include man/*.1 +recursive-include subr Cargo.toml *.rs +include Cargo.lock Cargo.toml diff --git a/pyproject.toml b/pyproject.toml index f131a1bf..5b8df0b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=61.2", "setuptools_rust"] +requires = ["setuptools", "setuptools_rust"] build-backend = "setuptools.build_meta" [project.optional-dependencies] @@ -9,6 +9,9 @@ dev = ["ruff==0.4.3"] environment = {PATH="$HOME/.cargo/bin:$PATH"} before-build = "pip install -U setuptools-rust && curl https://sh.rustup.rs -sSf | sh -s -- --profile=minimal -y && rustup show" +[tool.cibuildwheel.linux] +before-build = "pip install -U setuptools-rust && curl https://sh.rustup.rs -sSf | sh -s -- --profile=minimal -y && yum install -y apr-devel apr-util-devel lz4-devel sqlite-devel zlib-devel cyrus-sasl-devel neon-devel utf8proc-devel subversion-devel clang clang-devel" + [tool.ruff.lint] select = [ "ANN", @@ -76,6 +79,7 @@ classifiers = [ ] urls = {Homepage = "https://github.com/jelmer/subvertpy"} dynamic = ["version"] +requires-python = ">=3.8" [tool.setuptools] include-package-data = false