From ed5554eb771fd6ea41a6e0c8c12b73f7983dd538 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Mon, 21 Oct 2024 07:55:08 -0600 Subject: [PATCH] fix: use exclude --- .github/workflows/python-cli.yml | 138 +++---------------------------- .github/workflows/python.yml | 93 +-------------------- .github/workflows/wheels.yml | 96 +++++++++++++++++++++ 3 files changed, 110 insertions(+), 217 deletions(-) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/python-cli.yml b/.github/workflows/python-cli.yml index d65f945e..a561daec 100644 --- a/.github/workflows/python-cli.yml +++ b/.github/workflows/python-cli.yml @@ -14,129 +14,10 @@ concurrency: cancel-in-progress: true jobs: - linux: - 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.x - - name: Set up Rust cache - uses: Swatinem/rust-cache@v2 - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml - sccache: "true" - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-linux-${{ matrix.platform.target }} - path: dist - - # musllinux: - # 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 - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: 3.x - # - name: Build wheels - # uses: PyO3/maturin-action@v1 - # with: - # target: ${{ matrix.platform.target }} - # args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml -F openssl-vendored - # sccache: 'true' - # manylinux: musllinux_1_2 - # - name: Upload wheels - # uses: actions/upload-artifact@v4 - # with: - # name: wheels-musllinux-${{ matrix.platform.target }} - # path: dist - - windows: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: windows-latest - target: x64 - - runner: windows-latest - target: x86 - steps: - - uses: actions/checkout@v4 - - name: Set up Rust cache - uses: Swatinem/rust-cache@v2 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - architecture: ${{ matrix.platform.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml - sccache: "true" - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-windows-${{ matrix.platform.target }} - path: dist - - macos: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: macos-12 - target: x86_64 - - runner: macos-14 - target: aarch64 - steps: - - uses: actions/checkout@v4 - - name: Set up Rust cache - uses: Swatinem/rust-cache@v2 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml - sccache: "true" - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-macos-${{ matrix.platform.target }} - path: dist + build-wheels: + uses: ./.github/workflows/wheels.yml + with: + manifest-path: cli/Cargo.toml sdist: runs-on: ubuntu-latest @@ -152,17 +33,15 @@ jobs: - name: Upload sdist uses: actions/upload-artifact@v4 with: - name: wheels-sdist + name: pypi_files_sdist path: dist release: name: Release runs-on: ubuntu-latest + if: success() && startsWith(github.ref, 'refs/tags/') needs: - - linux - # - musllinux - - windows - - macos + - build-wheels - sdist environment: name: pypi @@ -171,6 +50,9 @@ jobs: id-token: write steps: - uses: actions/download-artifact@v4 + with: + pattern: pypi_files_* + merge-multiple: true - name: Publish to PyPI uses: PyO3/maturin-action@v1 with: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 7bc82a84..360e7545 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -15,92 +15,9 @@ concurrency: jobs: build-wheels: - # Heavily cribbed from https://github.com/pydantic/pydantic-core/blob/1ced3e6b4e87b03c460952f1970a97b1c8cbc605/.github/workflows/ci.yml#L399-L508 - name: Build wheels on ${{ matrix.os }} (${{ matrix.target }} - all${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }}) - strategy: - fail-fast: false - matrix: - os: [linux, macos, windows] - target: [x86_64, aarch64] - manylinux: [auto] - include: # if stuff is commented out, it was broken when i made this and i got sick of trying to fix it - - os: linux - manylinux: auto - target: i686 - # - os: linux - # manylinux: auto - # target: aarch64 - - os: linux - manylinux: auto - target: armv7 - - os: linux - manylinux: auto - target: ppc64le - # - os: linux - # manylinux: auto - # target: s390x - - - os: linux - manylinux: musllinux_1_1 - target: x86_64 - - os: linux - manylinux: musllinux_1_1 - target: aarch64 - - os: linux - manylinux: musllinux_1_1 - target: armv7 - - - os: macos - target: x86_64 - - os: macos - target: aarch64 - - - os: windows - target: x86_64 - interpreter: 3.10 3.11 3.12 3.13 - - os: windows - target: i686 - python-architecture: x86 - interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 - # - os: windows - # target: aarch64 - # interpreter: 3.11 3.12 3.13 - - runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.13" - architecture: ${{ matrix.python-architecture || 'x64' }} - - name: Set up Rust cache - uses: Swatinem/rust-cache@v2 - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - manylinux: ${{ matrix.manylinux }} - args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' }} --manifest-path python/Cargo.toml - rust-toolchain: 1.81 # https://github.com/geoarrow/geoarrow-rs/issues/716 - before-script-linux: | - # If we're running on rhel centos, install needed packages. - if command -v yum &> /dev/null; then - yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic - - # If we're running on i686 we need to symlink libatomic - # in order to build openssl with -latomic flag. - if [[ ! -d "/usr/lib64" ]]; then - ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so - fi - else - # If we're running on debian-based system. - apt update -y && apt-get install -y libssl-dev openssl pkg-config - fi - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_all_${{ matrix.manylinux }} - path: dist + uses: ./.github/workflows/wheels.yml + with: + manifest-path: python/Cargo.toml sdist: runs-on: ubuntu-latest @@ -116,11 +33,9 @@ jobs: - name: Upload sdist uses: actions/upload-artifact@v4 with: - name: wheels-sdist + name: pypi_files_sdist path: dist - # 🤔 should we test out built wheels here? seems nice - release: name: Release runs-on: ubuntu-latest diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 00000000..b133da6d --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,96 @@ +on: + workflow_call: + inputs: + manifest-path: + required: true + type: string + +jobs: + build-wheels: + # Heavily cribbed from https://github.com/pydantic/pydantic-core/blob/1ced3e6b4e87b03c460952f1970a97b1c8cbc605/.github/workflows/ci.yml#L399-L508 + name: Build wheels on ${{ matrix.os }} (${{ matrix.target }} - all${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }}) + strategy: + fail-fast: false + matrix: + os: [linux, macos, windows] + target: [x86_64, aarch64] + manylinux: [auto] + include: # if stuff is excluded, it was broken when i made this and i got sick of trying to fix it + - os: linux + manylinux: auto + target: i686 + - os: linux + manylinux: auto + target: armv7 + - os: linux + manylinux: auto + target: ppc64le + + - os: linux + manylinux: musllinux_1_1 + target: x86_64 + - os: linux + manylinux: musllinux_1_1 + target: aarch64 + - os: linux + manylinux: musllinux_1_1 + target: armv7 + + - os: macos + target: x86_64 + - os: macos + target: aarch64 + + - os: windows + target: x86_64 + interpreter: 3.10 3.11 3.12 3.13 + - os: windows + target: i686 + python-architecture: x86 + interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 + + exclude: + - os: linux + manylinux: auto + target: aarch64 + - os: linux + manylinux: auto + target: s390x + - os: windows + target: aarch64 + + runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + architecture: ${{ matrix.python-architecture || 'x64' }} + - name: Set up Rust cache + uses: Swatinem/rust-cache@v2 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: ${{ matrix.manylinux }} + args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' }} --manifest-path ${{ inputs.manifest-path }} + rust-toolchain: 1.81 # https://github.com/geoarrow/geoarrow-rs/issues/716 + before-script-linux: | + # If we're running on rhel centos, install needed packages. + if command -v yum &> /dev/null; then + yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic + + # If we're running on i686 we need to symlink libatomic + # in order to build openssl with -latomic flag. + if [[ ! -d "/usr/lib64" ]]; then + ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so + fi + else + # If we're running on debian-based system. + apt update -y && apt-get install -y libssl-dev openssl pkg-config + fi + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }} + path: dist