|
| 1 | +name: Python |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'stac-cli-*' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + linux: |
| 18 | + runs-on: ${{ matrix.platform.runner }} |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + platform: |
| 22 | + - runner: ubuntu-latest |
| 23 | + target: x86_64 |
| 24 | + # - runner: ubuntu-latest |
| 25 | + # target: x86 |
| 26 | + # - runner: ubuntu-latest |
| 27 | + # target: aarch64 |
| 28 | + # - runner: ubuntu-latest |
| 29 | + # target: armv7 |
| 30 | + # - runner: ubuntu-latest |
| 31 | + # target: s390x |
| 32 | + # - runner: ubuntu-latest |
| 33 | + # target: ppc64le |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + - uses: actions/setup-python@v5 |
| 37 | + with: |
| 38 | + python-version: 3.x |
| 39 | + - name: Set up Rust cache |
| 40 | + uses: Swatinem/rust-cache@v2 |
| 41 | + - name: Build wheels |
| 42 | + uses: PyO3/maturin-action@v1 |
| 43 | + with: |
| 44 | + target: ${{ matrix.platform.target }} |
| 45 | + args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml |
| 46 | + sccache: 'true' |
| 47 | + - name: Upload wheels |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: wheels-linux-${{ matrix.platform.target }} |
| 51 | + path: dist |
| 52 | + |
| 53 | + # musllinux: |
| 54 | + # runs-on: ${{ matrix.platform.runner }} |
| 55 | + # strategy: |
| 56 | + # matrix: |
| 57 | + # platform: |
| 58 | + # - runner: ubuntu-latest |
| 59 | + # target: x86_64 |
| 60 | + # - runner: ubuntu-latest |
| 61 | + # target: x86 |
| 62 | + # - runner: ubuntu-latest |
| 63 | + # target: aarch64 |
| 64 | + # - runner: ubuntu-latest |
| 65 | + # target: armv7 |
| 66 | + # steps: |
| 67 | + # - uses: actions/checkout@v4 |
| 68 | + # - uses: actions/setup-python@v5 |
| 69 | + # with: |
| 70 | + # python-version: 3.x |
| 71 | + # - name: Build wheels |
| 72 | + # uses: PyO3/maturin-action@v1 |
| 73 | + # with: |
| 74 | + # target: ${{ matrix.platform.target }} |
| 75 | + # args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml -F openssl-vendored |
| 76 | + # sccache: 'true' |
| 77 | + # manylinux: musllinux_1_2 |
| 78 | + # - name: Upload wheels |
| 79 | + # uses: actions/upload-artifact@v4 |
| 80 | + # with: |
| 81 | + # name: wheels-musllinux-${{ matrix.platform.target }} |
| 82 | + # path: dist |
| 83 | + |
| 84 | + windows: |
| 85 | + runs-on: ${{ matrix.platform.runner }} |
| 86 | + strategy: |
| 87 | + matrix: |
| 88 | + platform: |
| 89 | + - runner: windows-latest |
| 90 | + target: x64 |
| 91 | + - runner: windows-latest |
| 92 | + target: x86 |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + - name: Set up Rust cache |
| 96 | + uses: Swatinem/rust-cache@v2 |
| 97 | + - uses: actions/setup-python@v5 |
| 98 | + with: |
| 99 | + python-version: 3.x |
| 100 | + architecture: ${{ matrix.platform.target }} |
| 101 | + - name: Build wheels |
| 102 | + uses: PyO3/maturin-action@v1 |
| 103 | + with: |
| 104 | + target: ${{ matrix.platform.target }} |
| 105 | + args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml |
| 106 | + sccache: 'true' |
| 107 | + - name: Upload wheels |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: wheels-windows-${{ matrix.platform.target }} |
| 111 | + path: dist |
| 112 | + |
| 113 | + macos: |
| 114 | + runs-on: ${{ matrix.platform.runner }} |
| 115 | + strategy: |
| 116 | + matrix: |
| 117 | + platform: |
| 118 | + - runner: macos-12 |
| 119 | + target: x86_64 |
| 120 | + - runner: macos-14 |
| 121 | + target: aarch64 |
| 122 | + steps: |
| 123 | + - uses: actions/checkout@v4 |
| 124 | + - name: Set up Rust cache |
| 125 | + uses: Swatinem/rust-cache@v2 |
| 126 | + - uses: actions/setup-python@v5 |
| 127 | + with: |
| 128 | + python-version: 3.x |
| 129 | + - name: Build wheels |
| 130 | + uses: PyO3/maturin-action@v1 |
| 131 | + with: |
| 132 | + target: ${{ matrix.platform.target }} |
| 133 | + args: --release --out dist --find-interpreter --manifest-path cli/Cargo.toml |
| 134 | + sccache: 'true' |
| 135 | + - name: Upload wheels |
| 136 | + uses: actions/upload-artifact@v4 |
| 137 | + with: |
| 138 | + name: wheels-macos-${{ matrix.platform.target }} |
| 139 | + path: dist |
| 140 | + |
| 141 | + sdist: |
| 142 | + runs-on: ubuntu-latest |
| 143 | + steps: |
| 144 | + - uses: actions/checkout@v4 |
| 145 | + - name: Set up Rust cache |
| 146 | + uses: Swatinem/rust-cache@v2 |
| 147 | + - name: Build sdist |
| 148 | + uses: PyO3/maturin-action@v1 |
| 149 | + with: |
| 150 | + command: sdist |
| 151 | + args: --out dist --manifest-path cli/Cargo.toml |
| 152 | + - name: Upload sdist |
| 153 | + uses: actions/upload-artifact@v4 |
| 154 | + with: |
| 155 | + name: wheels-sdist |
| 156 | + path: dist |
| 157 | + |
| 158 | + release: |
| 159 | + name: Release |
| 160 | + runs-on: ubuntu-latest |
| 161 | + needs: |
| 162 | + - linux |
| 163 | + # - musllinux |
| 164 | + - windows |
| 165 | + - macos |
| 166 | + - sdist |
| 167 | + if: startsWith(github.ref, 'refs/tags/stac-cli-') |
| 168 | + environment: |
| 169 | + name: pypi |
| 170 | + url: https://pypi.org/p/stacrs |
| 171 | + permissions: |
| 172 | + id-token: write |
| 173 | + steps: |
| 174 | + - uses: actions/download-artifact@v4 |
| 175 | + - name: Publish to PyPI |
| 176 | + uses: PyO3/maturin-action@v1 |
| 177 | + with: |
| 178 | + command: upload |
| 179 | + args: --non-interactive --skip-existing wheels-*/* |
0 commit comments