Skip to content

Sync with indy-blssignatures-rs, clean up and add workflow #9

Sync with indy-blssignatures-rs, clean up and add workflow

Sync with indy-blssignatures-rs, clean up and add workflow #9

Workflow file for this run

name: "indy_bls"
env:
RUST_VERSION: "1.65.0"
CROSS_VERSION: "0.2.4"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [created]
workflow_dispatch:
inputs:
publish:
description: "Publish to PyPI"
required: true
default: false
type: boolean
jobs:
build-release:
name: Build library
strategy:
fail-fast: false
matrix:
architecture: [linux-aarch64, linux-x86_64, windows-x86_64]
python-version: ["3.8"]
include:
- architecture: linux-aarch64
os: ubuntu-latest
lib: libindy_blssignatures.so
plat-name: manylinux2014_aarch64
target: aarch64-unknown-linux-gnu
use_cross: true
- architecture: linux-x86_64
os: ubuntu-latest
lib: libindy_blssignatures.so
plat-name: manylinux2014_x86_64
target: x86_64-unknown-linux-gnu
use_cross: true
# - architecture: darwin-universal
# os: macos-latest
# lib: libindy_blssignatures.dylib
# plat-name: macosx_10_9_universal2
# target: darwin-universal
# # beta or nightly required for aarch64-apple-darwin target
# toolchain: beta
- architecture: windows-x86_64
os: windows-latest
lib: indy_blssignatures.dll
plat-name: win_amd64
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine auditwheel
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain || env.RUST_VERSION }}
- name: Checkout library
uses: actions/checkout@v3
with:
repository: "hyperledger/indy-blssignatures-rs"
path: "build"
- name: Build
shell: sh
working-directory: build
run: |
cp ../ci/Cross.toml .
if [ -n "${{ matrix.use_cross }}" ]; then
cargo install --bins --git https://github.com/rust-embedded/cross --tag v${{ env.CROSS_VERSION }} cross
cross build --lib --release --features ffi --target ${{ matrix.target }}
elif [ "${{ matrix.architecture }}" == "darwin-universal" ]; then
../build-universal.sh
else
cargo build --lib --release --features ffi --target ${{ matrix.target }}
fi
cp "target/${{ matrix.target }}/release/${{ matrix.lib }}" ../indy_bls/
- name: Build wheel package
shell: sh
run: |
python setup.py bdist_wheel --python-tag=py3 --plat-name=${{ matrix.plat-name }}
- name: Run tests
# FIXME cross platform test the python package
# maybe use the cross docker image?
if: ${{ !matrix.use_cross }}
shell: sh
run: |
pip install pytest dist/*
python -m pytest --log-cli-level=DEBUG
env:
no_proxy: "*" # python issue 30385
RUST_BACKTRACE: full
- if: ${{ runner.os == 'Linux' }}
name: Audit wheel
run: |
auditwheel show dist/* | tee auditwheel.log
grep -q manylinux_2_17_ auditwheel.log
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: python-${{ matrix.plat-name }}
path: dist/*
- if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing dist/*