|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: "Nightly PyPI Build" |
| 19 | + |
| 20 | +on: |
| 21 | + schedule: |
| 22 | + - cron: "0 0 * * *" # Runs at midnight UTC every day |
| 23 | + workflow_dispatch: # Allows manual triggering |
| 24 | + |
| 25 | +env: |
| 26 | + rust_msrv: "1.77.1" |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read |
| 30 | + |
| 31 | +jobs: |
| 32 | + sdist: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Setup Python |
| 38 | + uses: actions/setup-python@v5 |
| 39 | + with: |
| 40 | + python-version: '3.12' |
| 41 | + |
| 42 | + - name: Install toml |
| 43 | + run: pip install toml |
| 44 | + |
| 45 | + # Override the library version |
| 46 | + - name: Get current version |
| 47 | + run: | |
| 48 | + CURRENT_VERSION=$(python -c "import toml; print(toml.load('bindings/python/pyproject.toml')['project']['version'])") |
| 49 | + echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV |
| 50 | + |
| 51 | + - name: Update version with timestamp |
| 52 | + run: | |
| 53 | + TIMESTAMP=$(date +%Y%m%d%H%M%S) |
| 54 | + NEW_VERSION="${CURRENT_VERSION}.dev${TIMESTAMP}" |
| 55 | + NEW_VERSION=$NEW_VERSION python -c " |
| 56 | + import toml |
| 57 | + import os |
| 58 | + config = toml.load('bindings/python/pyproject.toml') |
| 59 | + config['project']['version'] = os.environ['NEW_VERSION'] |
| 60 | + with open('bindings/python/pyproject.toml', 'w') as f: |
| 61 | + toml.dump(config, f) |
| 62 | + print(f'Updated version to: {config[\"project\"][\"version\"]}') |
| 63 | + " |
| 64 | +
|
| 65 | + - uses: PyO3/maturin-action@v1 |
| 66 | + with: |
| 67 | + working-directory: "bindings/python" |
| 68 | + command: sdist |
| 69 | + args: -o dist |
| 70 | + - name: Upload sdist |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: wheels-sdist |
| 74 | + path: bindings/python/dist |
| 75 | + |
| 76 | + wheels: |
| 77 | + runs-on: "${{ matrix.os }}" |
| 78 | + strategy: |
| 79 | + matrix: |
| 80 | + include: |
| 81 | + - { os: windows-latest } |
| 82 | + - { os: macos-latest, target: "universal2-apple-darwin" } |
| 83 | + - { os: ubuntu-latest, target: "x86_64" } |
| 84 | + - { os: ubuntu-latest, target: "aarch64" } |
| 85 | + - { os: ubuntu-latest, target: "armv7l" } |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v4 |
| 88 | + - uses: actions/setup-python@v5 |
| 89 | + with: |
| 90 | + python-version: 3.9 |
| 91 | + - name: Setup Rust toolchain |
| 92 | + uses: ./.github/actions/setup-builder |
| 93 | + with: |
| 94 | + rust-version: ${{ env.rust_msrv }} |
| 95 | + - uses: PyO3/maturin-action@v1 |
| 96 | + with: |
| 97 | + target: ${{ matrix.target }} |
| 98 | + manylinux: auto |
| 99 | + working-directory: "bindings/python" |
| 100 | + command: build |
| 101 | + args: --release -o dist |
| 102 | + env: |
| 103 | + # Workaround ring 0.17 build issue |
| 104 | + CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8" |
| 105 | + - name: Upload wheels |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: wheels-${{ matrix.os }}-${{ matrix.target }} |
| 109 | + path: bindings/python/dist |
| 110 | + |
| 111 | + testpypi-publish: |
| 112 | + name: Publish Python 🐍 distribution 📦 to TestPypi |
| 113 | + needs: [ sdist, wheels ] |
| 114 | + runs-on: ubuntu-latest |
| 115 | + |
| 116 | + environment: |
| 117 | + name: testpypi |
| 118 | + url: https://test.pypi.org/p/pyiceberg_core |
| 119 | + |
| 120 | + permissions: |
| 121 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 122 | + |
| 123 | + steps: |
| 124 | + - name: Download all the dists |
| 125 | + uses: actions/download-artifact@v4 |
| 126 | + with: |
| 127 | + pattern: wheels-* |
| 128 | + merge-multiple: true |
| 129 | + path: bindings/python/dist |
| 130 | + - name: List downloaded artifacts |
| 131 | + run: ls -R bindings/python/dist |
| 132 | + # - name: Publish to TestPyPI |
| 133 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 134 | + # with: |
| 135 | + # repository-url: https://test.pypi.org/legacy/ |
| 136 | + # skip-existing: true |
| 137 | + # packages-dir: bindings/python/dist |
0 commit comments