Kola Python Linux Legacy #18
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: Kola Python Linux Legacy | |
on: | |
workflow_dispatch: | |
inputs: | |
# Latest commit to include with the release. If omitted, use the latest commit on the main branch. | |
sha: | |
description: Commit SHA | |
type: string | |
# Create the sdist and build the wheels, but do not publish to PyPI / GitHub. | |
dry-run: | |
description: Dry run | |
type: boolean | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
# manylinux aarch64 openssl doesn't work | |
# architecture: [x86-64, aarch64] | |
architecture: [x86-64] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set RUSTFLAGS for x86-64 | |
if: matrix.architecture == 'x86-64' && matrix.os != 'macos-latest' | |
run: echo "RUSTFLAGS=-C target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+avx2,+fma,+bmi1,+bmi2,+lzcnt" >> $GITHUB_ENV | |
- name: Set RUSTFLAGS for x86-64 MacOS | |
if: matrix.architecture == 'x86-64' && matrix.os == 'macos-latest' | |
run: echo "RUSTFLAGS=-C target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma" >> $GITHUB_ENV | |
- name: Set Rust target for aarch64 | |
if: matrix.architecture == 'aarch64' | |
id: target | |
run: | | |
TARGET=${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu'}} | |
echo "target=$TARGET" >> $GITHUB_OUTPUT | |
- name: Set jemalloc for aarch64 Linux | |
if: matrix.architecture == 'aarch64' && matrix.os == 'ubuntu-20.04' | |
run: | | |
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV | |
- name: Build wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: build | |
target: ${{ steps.target.outputs.target }} | |
# before-script-linux: /opt/_internal/build_scripts/build-openssl.sh | |
args: > | |
--release -i ${{ matrix.python-version }} | |
--manifest-path py-kola/Cargo.toml | |
--out dist | |
container: off | |
# manylinux: "2_28" | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.python-version }}-whl | |
path: dist/*.whl | |
pypi-publish: | |
name: Upload release to PyPI | |
# needs: [create-sdist, build-wheels] | |
needs: [build-wheels] | |
environment: | |
name: pypi | |
url: https://pypi.org/project/kola | |
runs-on: ubuntu-20.04 | |
permissions: | |
id-token: write | |
steps: | |
# - name: Download sdist | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: sdist | |
# path: dist | |
- name: Download wheels | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
- name: Publish to PyPI | |
if: inputs.dry-run == false | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true |