Skip to content

Commit

Permalink
shamelessly steal the oxigraph build process
Browse files Browse the repository at this point in the history
  • Loading branch information
gtfierro committed Aug 8, 2022
1 parent 553a89b commit fb3dc8c
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/manylinux_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cd /workdir
yum -y install centos-release-scl-rh
yum -y install llvm-toolset-7.0
source scl_source enable llvm-toolset-7.0
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
curl --verbose -L "https://github.com/PyO3/maturin/releases/latest/download/maturin-%arch%-unknown-linux-musl.tar.gz" | tar -xz -C /usr/local/bin
export PATH="${PATH}:/root/.cargo/bin:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin:/opt/python/cp310-cp310/bin"
maturin build --release -m python/Cargo.toml
82 changes: 62 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,82 @@ on:

jobs:

publish_lib_crate:
publish_pypi_linux:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [ "x86_64", "aarch64" ]
continue-on-error: true
steps:
- uses: actions/checkout@v2
- run: rustup update
- run: cargo login $CRATES_IO_TOKEN
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- run: cargo publish
publish_pypi_linux:
runs-on: ubuntu-latest
needs: publish_lib_crate
steps:
- uses: actions/checkout@v2
- run: docker run --rm -v $(pwd):/io -e PYO3_PYTHON=python3.7 konstin2/maturin:latest publish --cargo-extra-args="--features python-library" -u "${{ secrets.PYPI_USER }}" -p "${{ secrets.PYPI_PASS }}"
with:
submodules: true
- uses: docker/setup-qemu-action@v1
with:
platforms: linux/${{ matrix.architecture }}
if: matrix.architecture != 'x86_64'
- run: sed 's/%arch%/${{ matrix.architecture }}/g' .github/workflows/manylinux_build.sh > .github/workflows/manylinux_build_script.sh
- run: docker run -v "$(pwd)":/workdir --platform linux/${{ matrix.architecture }} quay.io/pypa/manylinux2014_${{ matrix.architecture }} /bin/bash /workdir/.github/workflows/manylinux_build_script.sh
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASS }}
packages_dir: target/wheels
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*

publish_pypi_mac:
runs-on: macos-latest
needs: publish_lib_crate
env:
DEVELOPER_DIR: '/Applications/Xcode.app/Contents/Developer'
SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
MACOSX_DEPLOYMENT_TARGET: '10.14'
steps:
- uses: actions/checkout@v2
- run: rustup update && rustup target add x86_64-apple-darwin && rustup target add aarch64-apple-darwin
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: 3.7
- run: pip install 'maturin>=0.13,<0.14' cffi
- run: maturin publish -F python-library --universal2 --no-sdist -u "${{ secrets.PYPI_USER }}" -p "${{ secrets.PYPI_PASS }}"
- run: rustup update && rustup target add aarch64-apple-darwin
- run: pip install maturin
- run: maturin publish --no-sdist --universal2 -m python/Cargo.toml -u __token__ -p ${{ secrets.PYPI_PASS }}
- run: maturin publish --no-sdist -m python/Cargo.toml -u __token__ -p ${{ secrets.PYPI_PASS }}
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*

publish_pypi_windows:
runs-on: windows-latest
needs: publish_lib_crate
steps:
- uses: actions/checkout@v2
- run: rustup toolchain install stable-gnu
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: 3.7
- run: pip install 'maturin>=0.13,<0.14' cffi
- run: maturin publish -F python-library --no-sdist -u "${{ secrets.PYPI_USER }}" -p "${{ secrets.PYPI_PASS }}"
- run: rustup update
- run: pip install maturin
- run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
- run: maturin publish --no-sdist -m python/Cargo.toml -u __token__ -p ${{ secrets.PYPI_PASS }}
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*

publish_pypi_stdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: pip install maturin
- run: maturin sdist -m python/Cargo.toml
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASS }}
packages_dir: target/wheels
- uses: softprops/action-gh-release@v1
with:
files: target/wheels/*
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "reasonable"
version = "0.1.60"
version = "0.1.61"
authors = ["Gabe Fierro <[email protected]>"]
repository = "https://github.com/gtfierro/reasonable"
homepage = "https://brickschema.org/"
Expand Down
11 changes: 10 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "reasonable"
version = "0.1.60"
version = "0.1.61"
description = "Python interface to 'reasonable', a Datalog implementation of the OWL 2 RL profile"
authors = ["Gabe Fierro <[email protected]>"]
license = "bsd-3-clause"
Expand All @@ -10,6 +10,7 @@ homepage = "https://github.com/gtfierro/reasonable"
[tool.poetry.dependencies]
python = "^3.7"
cffi = "^1.15.1"
libclang = "^14.0.6"

[tool.poetry.dev-dependencies]
maturin = "^0.13"
Expand Down
3 changes: 3 additions & 0 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ fn term_to_python<'a>(py: Python, rdflib: &'a PyModule, node: Term) -> PyResult<
Term::BlankNode(id) => {
rdflib.getattr("BNode")?.call1((id.clone().into_string(),))?
}
_ => {
panic!("Should not be here");
}
};
Ok(res)
}
Expand Down

0 comments on commit fb3dc8c

Please sign in to comment.