-
Notifications
You must be signed in to change notification settings - Fork 4
140 lines (124 loc) · 4.16 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: "indy_bls"
env:
RUST_VERSION: "1.70.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, darwin-universal, 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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
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@v4
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
../ci/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@v4
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/*