PROPOSAL: add preload and library type #626
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: build-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
COINCURVE_UPSTREAM_REF: 1ad5185cd42c0636104129fcc9f6a4bf9c67cc40 | |
COINCURVE_IGNORE_SYSTEM_LIB: '1' | |
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8" | |
CIBW_BEFORE_ALL_MACOS: ./.github/scripts/install-macos-build-deps.sh | |
CIBW_ENVIRONMENT_PASS_LINUX: > | |
COINCURVE_UPSTREAM_REF | |
COINCURVE_IGNORE_SYSTEM_LIB | |
CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
CIBW_TEST_COMMAND: > | |
python -c | |
"from coincurve import PrivateKey; | |
a=PrivateKey(); | |
b=PrivateKey(); | |
assert a.ecdh(b.public_key.format())==b.ecdh(a.public_key.format()) | |
" && | |
python -m pytest {project} | |
CIBW_TEST_SKIP: "*-macosx_arm64" | |
CIBW_SKIP: > | |
pp* | |
jobs: | |
test: | |
name: Test latest Python | |
runs-on: ubuntu-latest | |
env: | |
PYTHON_VERSION: '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Upgrade Python packaging tools | |
run: pip install --upgrade pip setuptools wheel | |
- name: Show runner information | |
run: | | |
python --version | |
pip --version | |
- name: Install dependencies | |
run: ./.github/scripts/install-test-deps.sh | |
- name: Check style and typing | |
run: tox -e lint,typing | |
- name: Run tests | |
run: tox -e ${PYTHON_VERSION} | |
- name: Run benchmarks | |
run: tox -e bench | |
- name: Upload coverage | |
run: codecov -X gcov | |
linux-wheels-standard: | |
name: Build Linux wheels | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-linux-wheels-standard | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
macos-wheels-x86_64: | |
name: Build macOS wheels | |
needs: | |
- test | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_MACOS: x86_64 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-macos-wheels-x86_64 | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
macos-wheels-arm: | |
name: Build macOS wheels for ARM | |
needs: | |
- test | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_MACOS: arm64 | |
COINCURVE_CROSS_HOST: aarch64-apple-darwin | |
CFLAGS: -target arm64-apple-macos11 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-macos-wheels-arm | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
windows-wheels-and-sdist: | |
name: Build Windows wheels and source distribution | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install build dependencies | |
run: python -m pip install build | |
- name: Build source distribution | |
run: python -m build --sdist | |
- name: Build Windows wheels | |
run: ./.github/scripts/build-windows-wheels.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-windows-wheels-and-sdist | |
path: dist/* | |
if-no-files-found: error | |
windows-wheels-conda-x86_64: | |
name: Build Windows (CONDA) wheels AMD64 | |
needs: | |
- test | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ENVIRONMENT: | |
COINCURVE_IGNORE_SYSTEM_LIB="0" | |
COINCURVE_UPSTREAM_REF="__no_tag__" | |
COINCURVE_SECP256K1_BUILD='SHARED' | |
CIBW_BUILD: "cp312-win_amd64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
CIBW_BEFORE_ALL: > | |
conda install -c conda-forge pkg-config libsecp256k1 | |
CIBW_BUILD_VERBOSITY: 1 | |
# pytest needs to be defined here to find 'coincurve' package? | |
CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
CIBW_TEST_COMMAND: > | |
conda install -c conda-forge libsecp256k1 && | |
python -c | |
"from coincurve import PrivateKey; | |
a=PrivateKey(); | |
b=PrivateKey(); | |
assert a.ecdh(b.public_key.format())==b.ecdh(a.public_key.format()) | |
macoss-wheels-conda-x86_64: | |
name: Build macOS (CONDA) wheels AMD64 | |
needs: | |
- test | |
runs-on: macos-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
auto-activate-base: false | |
- name: Install cibuildwheel and twine | |
run: | | |
conda install -c conda-forge libsecp256k1 | |
pip install cibuildwheel twine | |
- name: Build wheels | |
env: | |
CIBW_ENVIRONMENT: | |
COINCURVE_IGNORE_SYSTEM_LIB="0" | |
COINCURVE_UPSTREAM_REF="__no_tag__" | |
COINCURVE_SECP256K1_BUILD='SHARED' | |
PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig | |
REPAIR_LIBRARY_PATH=$CONDA_PREFIX/lib | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: > | |
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && | |
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel} | |
# pytest needs to be defined here to find 'coincurve' package? | |
CIBW_TEST_REQUIRES: pytest pytest-benchmark | |
CIBW_TEST_COMMAND: > | |
conda install -c conda-forge libsecp256k1 && | |
python -c | |
"from coincurve import PrivateKey; | |
a=PrivateKey(); | |
b=PrivateKey(); | |
assert a.ecdh(b.public_key.format())==b.ecdh(a.public_key.format()) | |
" | |
run: python -m cibuildwheel --output-dir wheelhouse | |
linux-wheels-arm: | |
name: Build Linux wheels for ARM | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
if: > | |
github.event_name == 'push' | |
&& | |
(github.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/tags')) | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_LINUX: aarch64 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-linux-wheels-arm | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
publish: | |
name: Publish release | |
needs: | |
- linux-wheels-standard | |
- macos-wheels-x86_64 | |
- macos-wheels-arm | |
- windows-wheels-and-sdist | |
- linux-wheels-arm | |
runs-on: ubuntu-latest | |
if: > | |
github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
pattern: artifact-* | |
merge-multiple: true | |
path: dist | |
- run: ls -l dist | |
- name: Push build artifacts to PyPI | |
uses: pypa/[email protected] | |
with: | |
skip_existing: true | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |