From a42609c9daf2c6191bc366c03322dadd9b7d8550 Mon Sep 17 00:00:00 2001 From: Tpt Date: Sun, 5 Dec 2021 14:52:54 +0100 Subject: [PATCH] Build wheels for more targets --- .github/workflows/build.yml | 78 +++++++++++++++++++--------- .github/workflows/manylinux_build.sh | 8 +++ lib/src/storage/backend/rocksdb.rs | 2 +- 3 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/manylinux_build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78c60e9b..c752d46e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,13 +30,13 @@ jobs: test_linux: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - submodules: true - - run: rustup update - - run: cargo test --all-features - env: - RUST_BACKTRACE: 1 + - uses: actions/checkout@v2 + with: + submodules: true + - run: rustup update + - run: cargo test --all-features + env: + RUST_BACKTRACE: 1 test_windows: runs-on: windows-latest @@ -72,7 +72,7 @@ jobs: with: python-version: "3.10" - run: python -m venv python/venv - - run: source python/venv/bin/activate && pip install --upgrade 'maturin~=0.12' sphinx + - run: source python/venv/bin/activate && pip install --upgrade maturin sphinx - run: source venv/bin/activate && maturin develop working-directory: ./python - run: source ../venv/bin/activate && python -m unittest @@ -85,17 +85,25 @@ jobs: python_wheel_linux: runs-on: ubuntu-latest needs: python + strategy: + matrix: + architecture: ["x86_64", "aarch64"] steps: - uses: actions/checkout@v2 with: submodules: true - - uses: messense/maturin-action@v1 + - uses: docker/setup-qemu-action@v1 + if: matrix.architecture != 'x86_64' with: - manylinux: 2014 - container: messense/manylinux2014-cross:x86_64 - command: build - args: -m python/Cargo.toml + platforms: ${{ matrix.architecture }} + - 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: actions/upload-artifact@v2 + with: + name: wheels + path: target/wheels/*.whl - run: pip install pyoxigraph --no-index --find-links ../../target/wheels && python -m unittest + if: matrix.architecture == 'x86_64' working-directory: ./python/tests python_wheel_mac: @@ -105,19 +113,26 @@ jobs: - uses: actions/checkout@v2 with: submodules: true - - uses: messense/maturin-action@v1 + - run: rustup update && rustup target add aarch64-apple-darwin + - uses: actions/setup-python@v2 + with: + python-version: 3.7 + - run: pip install maturin + - run: maturin build --release -m python/Cargo.toml --universal2 + 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.9' + - uses: actions/upload-artifact@v2 with: - command: build - args: -m python/Cargo.toml --universal2 + name: wheels + path: target/wheels/*.whl - run: pip install pyoxigraph --no-index --find-links ../../target/wheels && python -m unittest working-directory: ./python/tests python_wheel_windows: runs-on: windows-latest needs: python - strategy: - matrix: - architecture: ["x86", "x64"] steps: - uses: actions/checkout@v2 with: @@ -125,12 +140,27 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.7 - architecture: ${{ matrix.architecture }} + - run: rustup update - run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse - - uses: messense/maturin-action@v1 + - run: pip install maturin + - run: maturin build --release -m python/Cargo.toml + - uses: actions/upload-artifact@v2 with: - command: build - target: ${{ matrix.architecture }} - args: -m python/Cargo.toml + name: wheels + path: target/wheels/*.whl - run: pip install pyoxigraph --no-index --find-links ../../target/wheels && python -m unittest working-directory: ./python/tests + + binary_linux: + runs-on: ubuntu-latest + needs: test_linux + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - run: cargo build --release + working-directory: ./server + - uses: actions/upload-artifact@v2 + with: + name: binary + path: target/release/oxigraph_server diff --git a/.github/workflows/manylinux_build.sh b/.github/workflows/manylinux_build.sh new file mode 100644 index 00000000..f94f7dbf --- /dev/null +++ b/.github/workflows/manylinux_build.sh @@ -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 diff --git a/lib/src/storage/backend/rocksdb.rs b/lib/src/storage/backend/rocksdb.rs index ed992b68..8ac09f4f 100644 --- a/lib/src/storage/backend/rocksdb.rs +++ b/lib/src/storage/backend/rocksdb.rs @@ -2,7 +2,7 @@ //! //! TODO: still has some memory leaks if the database opening fails -#![allow(unsafe_code)] +#![allow(unsafe_code, trivial_casts)] use crate::error::invalid_input_error; use lazy_static::lazy_static;