Working stable release! #20
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
check-rust: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Rust Compiler and Cargo | |
run: | | |
rustc --version | |
cargo --version | |
build-and-test: | |
needs: check-rust | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
- runner: ubuntu-latest | |
target: x86 | |
- runner: ubuntu-latest | |
target: aarch64 | |
- runner: ubuntu-latest | |
target: armv7 | |
- runner: ubuntu-latest | |
target: s390x | |
- runner: ubuntu-latest | |
target: ppc64le | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: Build and test | |
run: | | |
python -m pip install --upgrade pip setuptools setuptools_rust wheel | |
python setup.py bdist_wheel | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ runner.os }}-${{ matrix.platform.target }} | |
path: dist/*.whl | |
pypi-publish: | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
needs: [build-and-test] # Ensure this job waits for others to finish | |
environment: | |
name: pypi | |
url: https://pypi.org/project/function-sampler/ | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' # Match the version used in building | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
- name: Install Twine | |
run: | | |
python -m pip install --upgrade pip | |
pip install twine | |
- name: Publish package distributions to PyPI | |
run: | | |
twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |