Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Linux Arm64 and drop support for Python 3.9 #78

Merged
merged 46 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a8eb884
Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
96539b5
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
e7d5140
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
85efc96
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
61f2e62
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
98dd616
Remove pytest to speed up Conda package creation
tibdex Aug 28, 2024
0f3fce6
Add back pytest as unittest is terrible
tibdex Aug 28, 2024
8bebb14
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
06555ef
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
1c386c3
fixup! Add support for Linux and Windows Arm64
tibdex Aug 28, 2024
aeb799b
Try removing `libarchive`
tibdex Aug 28, 2024
c864b98
Migrate to `uv`
tibdex Aug 28, 2024
75b9b61
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
12c52b8
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
6dc5335
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
bc04b49
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
a3d826a
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
da60169
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
af1fb02
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
c8725f8
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
a47f3f5
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
a4c8609
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
0d6393d
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
6b2dfbe
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
c148989
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
916ed10
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
0200be8
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
9842bec
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
b2acc0b
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
27ed564
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
0c1d8ef
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
7316bd5
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
49633f0
fixup! Add support for Linux and Windows Arm64
tibdex Aug 29, 2024
d2306dd
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
dbddcba
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
6b89ec8
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
b1b997d
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
e5ff9b4
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
fd99f89
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
a626873
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
3a8e06e
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
f0d7ddf
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
5a282b1
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
c9ac316
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
51133b6
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
1275baf
fixup! Add support for Linux and Windows Arm64
tibdex Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/actions/build-conda-packages/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build Conda packages
description: Build the Conda packages
outputs:
platform:
description: The platform targeted by the Conda packages.
value: ${{ steps.get-platform.outputs.platform }}
runs:
using: composite
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
conda-build-version: "24.7.1"

- run: conda build --no-anaconda-upload --output-folder dist .
# See https://github.com/conda-incubator/setup-miniconda/blame/059455a698430d8b68fa317268fa2e3da3492a98/README.md#L609-L610.
shell: bash -l {0}

- id: get-platform
run: uv run python -c 'from pathlib import Path; print(f"""platform={next(Path("dist").glob("*/jdk4py-*.tar.bz2")).parts[1]}""")' >> "$GITHUB_OUTPUT"
shell: bash
29 changes: 29 additions & 0 deletions .github/actions/build-java-runtime/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Java runtime
description: Build the Java runtime after installing the required dependencies.
inputs:
python-version:
description: The version of Python to set up.
required: true
runs:
using: composite
steps:
- run: curl -LsSf https://astral.sh/uv/0.4.0/install.sh | sh
shell: bash

- run: uv python install ${{ inputs.python-version }}
shell: bash

- run: uv sync --locked
shell: bash

- id: get-java-version
run: uv run python -c 'from jdk4py import JAVA_VERSION; print(f"""version={".".join(str(number) for number in JAVA_VERSION)}""")' >> "$GITHUB_OUTPUT"
shell: bash

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ steps.get-java-version.outputs.version }}

- run: uv run python build_java_runtime.py
shell: bash
42 changes: 0 additions & 42 deletions .github/actions/build-jdk/action.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/actions/build-python-wheel/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build Python wheel
description: Build the Python wheel
outputs:
filename:
description: The name of the built Python wheel.
value: ${{ steps.get-filename.outputs.filename }}
runs:
using: "composite"
steps:
- run: uv run python -m build --installer uv --wheel
shell: bash

- id: get-filename
run: uv run python -c 'from pathlib import Path; print(f"""filename={next(Path("dist").glob("jdk4py-*.whl")).parts[1]}""")' >> "$GITHUB_OUTPUT"
shell: bash
24 changes: 0 additions & 24 deletions .github/actions/create-conda-package/action.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/actions/create-python-wheel/action.yaml

This file was deleted.

38 changes: 17 additions & 21 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,36 @@ on:

jobs:
deploy:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
environment: deployment
strategy:
matrix:
architecture:
- x64
os:
- macos-13
- ubuntu-22.04
runner:
- macos-13 # x64
- macos-14 # arm64
- ubuntu-24.04
- ubuntu-24.04-arm64 # GitHub-hosted larger runner in the ActiveViam organization.
- windows-2022
include:
- architecture: arm64
os: macos-14
name: Deploy on ${{ matrix.os }}-${{ matrix.architecture }}
name: Deploy on ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-jdk
- uses: ./.github/actions/build-java-runtime
with:
os: ${{ matrix.os }}
python-version: "3.12"

- uses: ./.github/actions/create-python-wheel
with:
build-number: ${{ env.JDK4PY_BUILD_NUMBER }}
- id: build-python-wheel
uses: ./.github/actions/build-python-wheel

- uses: ./.github/actions/create-conda-package
with:
architecture: ${{ matrix.architecture }}
- id: build-conda-packages
uses: ./.github/actions/build-conda-packages

- name: Upload Conda package
- name: Upload Conda packages
env:
JDK4PY_CONDA_CHANNEL_TOKEN: ${{ secrets.CONDA_CHANNEL_TOKEN }}
JDK4PY_CONDA_CHANNEL_URL: ${{ vars.CONDA_CHANNEL_URL }}
JDK4PY_CONDA_CHANNEL_USERNAME: ${{ vars.CONDA_CHANNEL_USERNAME }}
JDK4PY_CONDA_PLATFORM: ${{ steps.build-conda-packages.outputs.platform }}
run: |
ls dist/$JDK4PY_CONDA_PLATFORM/jdk4py-*.tar.bz2 | \
while read filepath; do
Expand All @@ -51,6 +46,7 @@ jobs:

- name: Upload Python wheel
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry run twine upload dist/jdk4py-*.whl --username __token__ --password "$PYPI_TOKEN"
JDK4PY_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
JDK4PY_WHEEL_FILENAME: ${{ steps.build-python-wheel.outputs.filename }}
run: uv run twine upload dist/"$JDK4PY_WHEEL_FILENAME" --username __token__ --password "$JDK4PY_PYPI_TOKEN"
shell: bash
96 changes: 38 additions & 58 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,98 +5,78 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
architecture:
- x64
os:
- macos-13
- ubuntu-22.04
runner:
- macos-13 # x64
- macos-14 # arm64
- ubuntu-24.04
- ubuntu-24.04-arm64 # GitHub-hosted larger runner in the ActiveViam organization.
- windows-2022
python:
- "3.12"
include:
- architecture: arm64
os: macos-14
python: "3.12"
- architecture: x64
os: ubuntu-22.04
- runner: ubuntu-24.04
python: "3.11"
- architecture: x64
os: ubuntu-22.04
- runner: ubuntu-24.04
python: "3.10"
- architecture: x64
os: ubuntu-22.04
python: "3.9"
fail-fast: false
name: Test on ${{ matrix.os }}-${{ matrix.architecture }} with Python ${{ matrix.python }}
name: Test on ${{ matrix.runner }} with Python ${{ matrix.python }}
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-jdk
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python }}
- uses: ./.github/actions/build-java-runtime

- uses: ./.github/actions/create-python-wheel
with:
build-number: ${{ env.JDK4PY_BUILD_NUMBER }}
- id: build-python-wheel
uses: ./.github/actions/build-python-wheel

# No need to do that for each OS and Python version.
- if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python == '3.12' }}
name: Check formatting
run: poetry run ruff format --check .
# No need to test each platform and Python version.
- if: ${{ matrix.runner == 'ubuntu-24.04' && matrix.python == '3.12' }}
run: uv run ruff format --check .

# No need to do that for each OS and Python version.
- if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python == '3.12' }}
name: Lint
run: poetry run ruff check .
# No need to test each platform and Python version.
- if: ${{ matrix.runner == 'ubuntu-24.04' && matrix.python == '3.12' }}
run: uv run ruff check .

# No need to do that for each OS and Python version.
- if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python == '3.12' }}
name: Typecheck
run: poetry run mypy --show-error-codes jdk4py scripts tests
# No need to test each platform and Python version.
- if: ${{ matrix.runner == 'ubuntu-24.04' && matrix.python == '3.12' }}
run: uv run mypy

- run: poetry run pytest
- run: uv run pytest

# The library's Python wheels are not tied to a specific version of Python so there is no need to upload the package for each Python version.
# The Python wheels are not tied to a specific Python version.
- if: ${{ matrix.python == '3.12' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: jdk4py-${{ matrix.os }}-${{ matrix.architecture }}.whl
path: dist/jdk4py-*.whl
name: ${{ steps.build-python-wheel.outputs.filename }}
path: dist/${{ steps.build-python-wheel.outputs.filename }}

conda-package:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
architecture:
- x64
os:
- macos-13
- ubuntu-22.04
runner:
- macos-13 # x64
- macos-14 # arm64
- ubuntu-24.04
- ubuntu-24.04-arm64 # GitHub-hosted larger runner in the ActiveViam organization.
- windows-2022
include:
- architecture: arm64
os: macos-14
name: Test Conda packaging on ${{ matrix.os }}-${{ matrix.architecture }}
name: Test Conda packaging on ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-jdk
- uses: ./.github/actions/build-java-runtime
with:
os: ${{ matrix.os }}
# No need to test each Python version.
python-version: "3.12"

- uses: ./.github/actions/create-conda-package
with:
architecture: ${{ matrix.architecture }}
- id: build-conda-packages
uses: ./.github/actions/build-conda-packages

- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: jdk4py-${{ matrix.os }}-${{ matrix.architecture }}-conda-packages
path: dist/${{ env.JDK4PY_CONDA_PLATFORM }}/jdk4py-*.tar.bz2
name: jdk4py-${{ steps.build-conda-packages.outputs.platform }}-conda-packages
path: dist/${{ steps.build-conda-packages.outputs.platform }}/jdk4py-*.tar.bz2
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Python
__pycache__
*.egg-info
build
dist

# Java
java-runtime
.venv/
__pycache__/
build/
dist/
java-runtime/
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"charliermarsh.ruff",
"esbenp.prettier-vscode",
"ms-python.python",
"tamasfe.even-better-toml"
]
}
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnType": true
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"python.analysis.autoImportCompletions": true,
"python.languageServer": "Pylance",
"python.testing.pytestEnabled": true,
}
Loading
Loading