| 1 |
name: Build JPY distributions |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
branches: [ 'master', 'release/v*' ] |
| 6 |
push: |
| 7 |
branches: [ 'master', 'release/v*' ] |
| 8 |
|
| 9 |
jobs: |
| 10 |
jars: |
| 11 |
runs-on: ubuntu-24.04 |
| 12 |
steps: |
| 13 |
- uses: actions/checkout@v6 |
| 14 |
- uses: actions/setup-java@v5 |
| 15 |
with: |
| 16 |
distribution: 'temurin' |
| 17 |
java-version: '11' |
| 18 |
- run: mvn --batch-mode clean package javadoc:jar source:jar-no-fork -DskipTests |
| 19 |
- uses: actions/upload-artifact@v7 |
| 20 |
with: |
| 21 |
name: jars |
| 22 |
path: target |
| 23 |
|
| 24 |
sdist: |
| 25 |
runs-on: ubuntu-24.04 |
| 26 |
steps: |
| 27 |
- uses: actions/checkout@v6 |
| 28 |
- uses: actions/setup-python@v6 |
| 29 |
|
| 30 |
- uses: actions/setup-java@v5 |
| 31 |
id: setup-java |
| 32 |
with: |
| 33 |
distribution: 'temurin' |
| 34 |
java-version: '11' |
| 35 |
- run: python setup.py sdist |
| 36 |
- uses: actions/upload-artifact@v7 |
| 37 |
with: |
| 38 |
name: sdist |
| 39 |
path: dist |
| 40 |
|
| 41 |
bdist-wheel: |
| 42 |
runs-on: ${{ matrix.info.machine }} |
| 43 |
strategy: |
| 44 |
fail-fast: false |
| 45 |
matrix: |
| 46 |
info: |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
- { machine: 'ubuntu-22.04', python: '3.13t', java: '11', cmd: '.github/env/Linux/bdist-wheel.sh' } |
| 55 |
- { machine: 'ubuntu-22.04-arm', python: '3.13t', java: '11', cmd: '.github/env/Linux/bdist-wheel.sh' } |
| 56 |
- { machine: 'ubuntu-22.04', python: '3.14t', java: '11',cmd: '.github/env/Linux/bdist-wheel.sh' } |
| 57 |
- { machine: 'ubuntu-22.04-arm', python: '3.14t', java: '11', cmd: '.github/env/Linux/bdist-wheel.sh' } |
| 58 |
|
| 59 |
- { machine: 'windows-2022', python: '3.9', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 60 |
- { machine: 'windows-2022', python: '3.10', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 61 |
- { machine: 'windows-2022', python: '3.11', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 62 |
- { machine: 'windows-2022', python: '3.12', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 63 |
- { machine: 'windows-2022', python: '3.13', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 64 |
- { machine: 'windows-2022', python: '3.13t', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 65 |
- { machine: 'windows-2022', python: '3.14', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 66 |
- { machine: 'windows-2022', python: '3.14t', java: '11', cmd: '.\.github\env\Windows\bdist-wheel.ps1' } |
| 67 |
|
| 68 |
- { machine: 'macos-14', python: '3.11', java: '11', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 69 |
- { machine: 'macos-14', python: '3.12', java: '11', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 70 |
- { machine: 'macos-14', python: '3.13', java: '11', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 71 |
- { machine: 'macos-14', python: '3.13t', java: '11', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 72 |
- { machine: 'macos-14', python: '3.14', java: '11', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 73 |
- { machine: 'macos-14', python: '3.14t', java: '11', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 74 |
|
| 75 |
|
| 76 |
steps: |
| 77 |
- uses: actions/checkout@v6 |
| 78 |
|
| 79 |
- uses: actions/setup-python@v6 |
| 80 |
with: |
| 81 |
python-version: ${{ matrix.info.python }} |
| 82 |
|
| 83 |
- uses: actions/setup-java@v5 |
| 84 |
id: setup-java |
| 85 |
with: |
| 86 |
distribution: 'temurin' |
| 87 |
java-version: ${{ matrix.info.java }} |
| 88 |
|
| 89 |
- run: ${{ matrix.info.cmd }} |
| 90 |
|
| 91 |
- uses: actions/upload-artifact@v7 |
| 92 |
with: |
| 93 |
name: build-${{ matrix.info.python }}-${{ matrix.info.machine }} |
| 94 |
path: dist/*.whl |
| 95 |
retention-days: 1 |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
bdist-wheel-universal2-hack: |
| 109 |
runs-on: ${{ matrix.info.machine }} |
| 110 |
env: |
| 111 |
_PYTHON_HOST_PLATFORM: macosx-11.0-universal2 |
| 112 |
ARCHFLAGS: -arch arm64 -arch x86_64 |
| 113 |
strategy: |
| 114 |
fail-fast: false |
| 115 |
matrix: |
| 116 |
info: |
| 117 |
- { machine: 'macos-14', python: '3.9', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 118 |
- { machine: 'macos-14', python: '3.10', cmd: '.github/env/macOS/bdist-wheel.sh' } |
| 119 |
|
| 120 |
steps: |
| 121 |
- uses: actions/checkout@v6 |
| 122 |
|
| 123 |
- uses: actions/setup-python@v6 |
| 124 |
with: |
| 125 |
python-version: ${{ matrix.info.python }} |
| 126 |
|
| 127 |
- uses: actions/setup-java@v5 |
| 128 |
id: setup-java |
| 129 |
with: |
| 130 |
distribution: 'temurin' |
| 131 |
java-version: '11' |
| 132 |
|
| 133 |
- run: pip install --upgrade pip |
| 134 |
- run: pip install --upgrade setuptools |
| 135 |
- run: ${{ matrix.info.cmd }} |
| 136 |
|
| 137 |
- uses: actions/upload-artifact@v7 |
| 138 |
with: |
| 139 |
name: build-${{ matrix.info.python }}-${{ matrix.info.machine }} |
| 140 |
path: dist/*.whl |
| 141 |
retention-days: 1 |
| 142 |
|
| 143 |
bdist-wheel-linux-arm64: |
| 144 |
runs-on: 'ubuntu-24.04-arm' |
| 145 |
steps: |
| 146 |
- uses: actions/checkout@v6 |
| 147 |
|
| 148 |
- name: Set up QEMU |
| 149 |
uses: docker/setup-qemu-action@v4 |
| 150 |
|
| 151 |
- name: Set up Docker Buildx |
| 152 |
uses: docker/setup-buildx-action@v4 |
| 153 |
|
| 154 |
- run: mkdir /tmp/dist |
| 155 |
|
| 156 |
- name: Bake |
| 157 |
uses: docker/[email protected] |
| 158 |
env: |
| 159 |
DOCKER_BUILD_RECORD_UPLOAD: false |
| 160 |
with: |
| 161 |
files: .github/docker/docker-bake.hcl |
| 162 |
pull: true |
| 163 |
set: | |
| 164 |
*.output=type=local,dest=/tmp/dist |
| 165 |
|
| 166 |
- uses: actions/upload-artifact@v7 |
| 167 |
with: |
| 168 |
name: bdist-wheel-linux-arm64 |
| 169 |
path: /tmp/dist/*.whl |
| 170 |
retention-days: 1 |
| 171 |
|
| 172 |
bdist-wheel-linux-amd64: |
| 173 |
runs-on: 'ubuntu-24.04' |
| 174 |
steps: |
| 175 |
- uses: actions/checkout@v6 |
| 176 |
|
| 177 |
- name: Set up QEMU |
| 178 |
uses: docker/setup-qemu-action@v4 |
| 179 |
|
| 180 |
- name: Set up Docker Buildx |
| 181 |
uses: docker/setup-buildx-action@v4 |
| 182 |
|
| 183 |
- run: mkdir /tmp/dist |
| 184 |
|
| 185 |
- name: Bake |
| 186 |
uses: docker/[email protected] |
| 187 |
env: |
| 188 |
DOCKER_BUILD_RECORD_UPLOAD: false |
| 189 |
with: |
| 190 |
files: .github/docker/docker-bake.hcl |
| 191 |
pull: true |
| 192 |
set: | |
| 193 |
*.output=type=local,dest=/tmp/dist |
| 194 |
|
| 195 |
- uses: actions/upload-artifact@v7 |
| 196 |
with: |
| 197 |
name: bdist-wheel-linux-amd64 |
| 198 |
path: /tmp/dist/*.whl |
| 199 |
retention-days: 1 |
| 200 |
|
| 201 |
collect-artifacts: |
| 202 |
runs-on: ubuntu-24.04 |
| 203 |
needs: ['sdist', 'bdist-wheel', 'bdist-wheel-universal2-hack', 'bdist-wheel-linux-amd64', 'bdist-wheel-linux-arm64'] |
| 204 |
steps: |
| 205 |
- uses: actions/checkout@v6 |
| 206 |
- uses: actions/download-artifact@v8 |
| 207 |
with: |
| 208 |
path: download-artifacts |
| 209 |
- name: collect-artifacts.sh |
| 210 |
run: .github/scripts/collect-artifacts.sh |
| 211 |
- uses: actions/upload-artifact@v7 |
| 212 |
with: |
| 213 |
name: jpy |
| 214 |
path: collect-artifacts |
| 215 |
|
| 216 |
release-artifacts: |
| 217 |
if: ${{ startsWith(github.ref, 'refs/heads/release/v') }} |
| 218 |
runs-on: ubuntu-24.04 |
| 219 |
needs: ['collect-artifacts'] |
| 220 |
steps: |
| 221 |
- uses: actions/download-artifact@v8 |
| 222 |
with: |
| 223 |
name: jpy |
| 224 |
path: dist |
| 225 |
- name: Publish package to PyPI |
| 226 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 227 |
with: |
| 228 |
user: __token__ |
| 229 |
password: ${{ secrets.PYPI_API_TOKEN }} |
| 230 |
|
| 231 |
publish-jar: |
| 232 |
if: ${{ startsWith(github.ref, 'refs/heads/release/v') }} |
| 233 |
runs-on: ubuntu-24.04 |
| 234 |
steps: |
| 235 |
- uses: actions/checkout@v6 |
| 236 |
- uses: actions/setup-java@v5 |
| 237 |
with: |
| 238 |
distribution: 'temurin' |
| 239 |
java-version: '11' |
| 240 |
server-id: central |
| 241 |
server-username: MAVEN_USERNAME |
| 242 |
server-password: MAVEN_PASSWORD |
| 243 |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 244 |
gpg-passphrase: GPG_PASSPHRASE |
| 245 |
- name: Publish package |
| 246 |
run: mvn --batch-mode deploy -Pjpy-maven-deploy -DskipTests |
| 247 |
env: |
| 248 |
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }} |
| 249 |
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }} |
| 250 |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |