Skip to content

Update Cargo.toml

Update Cargo.toml #36

Workflow file for this run

# This file is obtained from deedy5/primp and does NOT belong to me.
# MIT License
# Copyright (c) 2024 deedy5
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file is autogenerated by maturin v1.7.0
# To update, run
#
# maturin generate-ci github -o .github/workflows/CI.yml --pytest
#
name: CI
on:
push:
branches:
- main
- '*'
tags:
- '*'
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install aarch64 build dependencies
if: matrix.platform.target == 'aarch64'
run: sudo apt-get update && sudo apt-get install --yes crossbuild-essential-arm64
- name: Install libssl
run: sudo apt-get install pkg-config libssl-dev
- name: Get openssl dir
id: openssl
run: echo "OPENSSL_DIR=$(pkg-config --variable=prefix openssl)" >> $GITHUB_OUTPUT
- name: Get Python interpreter
id: python
run: echo "PYTHON=$(python -c "import sys; print(sys.executable)")" >> $GITHUB_OUTPUT
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
rust-toolchain: stable
target: ${{ matrix.platform.target }}
args: ${{ matrix.platform.target == 'x86_64' && '--release --out dist --zig' || '--release --out dist' }} -i ${{ steps.python.outputs.PYTHON }}
sccache: 'true'
manylinux: auto
container: 'off'
env:
CFLAGS_aarch64_unknown_linux_gnu: ${{ matrix.platform.target == 'aarch64' && '-D__ARM_ARCH=8' || '' }}
CC: ${{ matrix.platform.target == 'aarch64' && 'aarch64-linux-gnu-gcc' || '' }}
CXX: ${{ matrix.platform.target == 'aarch64' && 'aarch64-linux-gnu-g++' || '' }}
# CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: x86_64-linux-gnu-g++
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.platform.target == 'aarch64' && 'aarch64-linux-gnu-g++' || '' }}
OPENSSL_DIR: ${{ steps.openssl.outputs.OPENSSL_DIR }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install aarch64 build dependencies
if: ${{ startsWith(matrix.platform.target, 'aarch64') }}
run: sudo apt-get update && sudo apt-get install --yes crossbuild-essential-arm64
- name: Prepare musl cross-compiler
run: |
curl -O http://musl.cc/${{ matrix.platform.target }}-linux-musl-cross.tgz
tar xzf ${{ matrix.platform.target }}-linux-musl-cross.tgz -C /opt
echo "/opt/${{ matrix.platform.target }}-linux-musl-cross/bin/" >> $GITHUB_PATH
- name: Install libssl
run: sudo apt-get install pkg-config libssl-dev
- name: Get openssl dir
id: openssl
run: echo "OPENSSL_DIR=$(pkg-config --variable=prefix openssl)" >> $GITHUB_OUTPUT
- name: Get Python interpreter
id: python
run: echo "PYTHON=$(python -c "import sys; print(sys.executable)")" >> $GITHUB_OUTPUT
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
rust-toolchain: stable
target: ${{ matrix.platform.target }} -i ${{ steps.python.outputs.PYTHON }}
args: --release --out dist
sccache: 'true'
manylinux: musllinux_1_2
container: 'off'
env:
CC: ${{ matrix.platform.target }}-linux-musl-gcc
CXX: ${{ matrix.platform.target }}-linux-musl-g++
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: x86_64-linux-musl-g++
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-g++
OPENSSL_DIR: ${{ steps.openssl.outputs.OPENSSL_DIR }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist
- name: QEMU
if: matrix.platform.target != 'x86_64'
uses: docker/setup-qemu-action@v3
windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: windows-latest
target: x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Install nasm
run: choco install nasm
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
rust-toolchain: stable
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist
macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
rust-toolchain: nightly
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*