add calculate_initial_reserves #31
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 wheels | |
on: | |
push: | |
tags: | |
- "v*" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
detect-changes: | |
uses: ./.github/workflows/check_diff.yml | |
with: | |
pattern: ^bindings/hyperdrivepy/\|^test/\|^crates/\|^lib/\|^target/\|^foundry\.toml$\|^Cargo\.lock$\|^Cargo\.toml$\|^\.github/workflows/build_wheels\.yml$ | |
build-wheels-linux: | |
name: build wheels on linux | |
runs-on: ubuntu-latest | |
needs: detect-changes | |
if: needs.detect-changes.outputs.changed == 'true' | |
steps: | |
- name: Checkout hyperdrive-rs | |
uses: actions/checkout@v4 | |
with: | |
token: ${{github.token}} | |
- name: setup rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: setup foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
token: ${{github.token}} | |
- name: set up pip | |
run: python -m pip install --upgrade pip | |
- name: build hyperdrivepy | |
shell: bash | |
run: source scripts/build_python.sh | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux | |
path: ./wheelhouse/*.whl | |
build-wheels-cibw: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: detect-changes | |
if: needs.detect-changes.outputs.changed == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12] | |
python-version: [cp310] | |
steps: | |
- name: Checkout hyperdrive-rs | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: setup foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: install python dependencies | |
run: python -m pip install --upgrade pip && python -m pip install --upgrade -r requirements-dev.txt | |
- name: build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "${{ matrix.python-version }}-*" | |
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$HOME/.foundry/bin:$HOME/.cargo/env:$PATH" CARGO_TERM_COLOR="always"' | |
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$UserProfile\.foundry\bin;$UserProfile\.cargo\env;$PATH"' | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
CIBW_BEFORE_ALL_MACOS: > | |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=minimal -y && | |
rustup show && | |
rustup target add aarch64-apple-darwin && | |
curl -L https://foundry.paradigm.xyz | sh && | |
foundryup | |
CIBW_BUILD_VERBOSITY: 1 | |
with: | |
output-dir: wheelhouse | |
package-dir: bindings/hyperdrivepy | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build-sdist: | |
name: build source distribution | |
runs-on: ubuntu-latest | |
needs: detect-changes | |
if: needs.detect-changes.outputs.changed == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build bindings/hyperdrivepy --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: bindings/hyperdrivepy/dist/*.tar.gz | |
upload_pypi: | |
needs: [build-wheels-linux, build-wheels-cibw, build-sdist] | |
runs-on: ubuntu-latest | |
# Only publish on tags | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
# unpacks all wheels into dist/ | |
pattern: wheels-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 |