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 ARM64 architecture #54

Merged
merged 26 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fb2cfe5
Add support for ARM64 architectures
tibdex May 31, 2022
2879ff7
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
c083910
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
2f5c867
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
ff0ae8c
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
46e3809
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
250e24f
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
890eb8f
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
2766d77
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
539ef60
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
f058d19
Try with jmods
tibdex May 31, 2022
269f008
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
05177ca
fixup! Add support for ARM64 architectures
tibdex May 31, 2022
407bcaf
Try self-hosted runner
tibdex Jun 2, 2022
ea1542c
fixup! Try self-hosted runner
tibdex Jun 2, 2022
3559100
fixup! Try self-hosted runner
tibdex Jun 2, 2022
2075ebe
fixup! Try self-hosted runner
tibdex Jun 2, 2022
7ce4188
fixup! Try self-hosted runner
tibdex Jun 2, 2022
4d05987
fixup! Try self-hosted runner
tibdex Jun 2, 2022
faf5242
fixup! Try self-hosted runner
tibdex Jun 2, 2022
a3ad8f5
Test Conda packaging
tibdex Jun 2, 2022
0cba170
fixup! Test Conda packaging
tibdex Jun 2, 2022
9297d4f
Try on all OSes
tibdex Jun 2, 2022
833e104
Fix workflows
tibdex Jun 2, 2022
aba3192
Make some small improvements
tibdex Jun 2, 2022
47cdd10
fixup! Make some small improvements
tibdex Jun 2, 2022
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
19 changes: 16 additions & 3 deletions .github/actions/build-jdk/action.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
name: Build JDK
description: Install the dependencies and build the JDK
inputs:
architecture:
description: The target architecture.
required: true
python-version:
description: The version of Python to set up.
required: true
runs:
using: "composite"
steps:
- uses: actions/setup-python@v2
# ARM architecture is not supported.
# See https://github.com/actions/setup-python/issues/197.
- if: ${{ inputs.architecture == 'x64' }}
uses: actions/setup-python@v2
with:
architecture: x64
architecture: ${{ inputs.architecture }}
python-version: ${{ inputs.python-version }}

# For when `actions/setup-python` had to be skipped.
- name: Check Python version
shell: bash
run: |
python -c 'import sys; expected_version = tuple([int(number) for number in sys.argv[-1].split(".")]); assert sys.version_info[:2] == expected_version[:2], f"Expected Python version {expected_version} but got {sys.version_info}."' ${{ inputs.python-version }}

- name: Install Poetry
shell: bash
run: pip install poetry
Expand All @@ -26,7 +38,8 @@ runs:

- uses: actions/setup-java@v2
with:
distribution: adopt
architecture: ${{ inputs.architecture }}
distribution: temurin
java-version: ${{ env.JDK4PY_JAVA_VERSION }}

- name: Build JDK
Expand Down
8 changes: 7 additions & 1 deletion .github/actions/create-conda-package/action.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: Create Conda package
description: Create a Conda package
inputs:
architecture:
description: The target architecture.
required: true
runs:
using: "composite"
steps:
- uses: conda-incubator/setup-miniconda@v2
# Careful when upgrading to macOS 12 https://github.com/conda-incubator/setup-miniconda/issues/229 would have to be resolved first.
- if: ${{ inputs.architecture == 'x64' }}
uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
conda-build-version: "3.21.6"
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/create-python-wheel/action.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Create Python wheel
description: Create a Python wheel
inputs:
build-number:
description: The build number of the wheel.
required: true
runs:
using: "composite"
steps:
- name: Build Python wheel
shell: bash
run: poetry run python setup.py bdist_wheel --build-number $JDK4PY_BUILD_NUMBER
run: poetry run python setup.py bdist_wheel --build-number ${{ inputs.build-number }}
21 changes: 17 additions & 4 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,31 @@ jobs:
environment: deployment
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
name: Deploy on ${{ matrix.os }}
architecture:
- x64
os:
- macos-latest
- ubuntu-latest
- windows-latest
include:
- architecture: aarch64
os: self-hosted-macos
name: Deploy on ${{ matrix.os }}-${{ matrix.architecture }}
steps:
- uses: actions/checkout@v2

- uses: ./.github/actions/build-jdk
with:
architecture: ${{ matrix.architecture }}
python-version: "3.10"

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

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

- name: Upload Python wheel
env:
Expand All @@ -36,8 +49,8 @@ jobs:
JDK4PY_CONDA_CHANNEL_USERNAME: ${{ secrets.CONDA_CHANNEL_USERNAME }}
shell: bash
run: |
ls dist/$JDK4PY_CONDA_ARCH/jdk4py-*.tar.bz2 | \
ls dist/$JDK4PY_CONDA_PLATFORM/jdk4py-*.tar.bz2 | \
while read filepath; do
echo Uploading ${filepath}
curl --fail --user "$JDK4PY_CONDA_CHANNEL_USERNAME":"$JDK4PY_CONDA_CHANNEL_PASSWORD" --upload-file ${filepath} "$JDK4PY_CONDA_CHANNEL_URL/$JDK4PY_CONDA_ARCH/"
curl --fail --user "$JDK4PY_CONDA_CHANNEL_USERNAME":"$JDK4PY_CONDA_CHANNEL_PASSWORD" --upload-file ${filepath} "$JDK4PY_CONDA_CHANNEL_URL/$JDK4PY_CONDA_PLATFORM/"
done
67 changes: 47 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,83 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
architecture:
- x64
os:
- macos-latest
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
include:
- architecture: aarch64
os: self-hosted-macos
python: "3.10"
- architecture: x64
os: ubuntu-latest
python: "3.9"
- architecture: x64
os: ubuntu-latest
python: "3.8"
fail-fast: false
name: Test on ${{ matrix.os }} with Python ${{ matrix.python }}
name: Test on ${{ matrix.os }}-${{ matrix.architecture }} with Python ${{ matrix.python }}
steps:
- uses: actions/checkout@v2

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

# No need to lint for each OS and Python version
- if: matrix.os == 'ubuntu-latest' && matrix.python == '3.10'
name: Check formatting
run: poetry run black --check .

- name: Test
run: poetry run pytest

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

# No need to upload the package for each Python version
- if: matrix.python == '3.10'
# 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.
- if: ${{ matrix.python == '3.10' }}
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: jdk4py-${{ matrix.os }}.whl
name: jdk4py-${{ matrix.os }}-${{ matrix.architecture }}.whl
path: dist/jdk4py-*.whl

# No need to do that for each OS and Python version.
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.python == '3.10' }}
name: Check formatting and types
run: poetry run black --check . && poetry run mypy --show-error-codes jdk4py scripts tests

- name: Test
run: poetry run pytest

conda-package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
name: Test Conda packaging
architecture:
- x64
os:
- macos-latest
- ubuntu-latest
- windows-latest
include:
- architecture: aarch64
os: self-hosted-macos
name: Test Conda packaging on ${{ matrix.os }}-${{ matrix.architecture }}
steps:
- uses: actions/checkout@v2

- uses: ./.github/actions/build-jdk
with:
architecture: ${{ matrix.architecture }}
# No need to test for each Python version.
python-version: "3.10"

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

- uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: jdk4py-${{ matrix.os }}-conda-packages
path: dist/${{ env.JDK4PY_CONDA_ARCH }}/jdk4py-*.tar.bz2
name: jdk4py-${{ matrix.os }}-${{ matrix.architecture }}-conda-packages
path: dist/${{ env.JDK4PY_CONDA_PLATFORM }}/jdk4py-*.tar.bz2
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ b"Hello, World!"

## Versioning

`jdk4py` version contains 4 figures:
`jdk4py`'s version contains 4 numbers:

- The first 3 figures are the Java version.
- The first 3 numbers are the Java version.
- The fourth is `jdk4py` specific: it starts at 0 for each Java version and then increases.
1 change: 0 additions & 1 deletion conda.recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ about:

extra:
recipe-maintainers:
- bloussou
- fabiencelier
- tibdex
- bloussou
tibdex marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 3 additions & 2 deletions jdk4py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
JAVA_HOME = _PACKAGE_DIRECTORY.absolute() / "java-runtime"
JAVA = JAVA_HOME / "bin" / "java"

JAVA_VERSION: Tuple[int, int, int] = tuple(
_major, _minor, _patch = [
int(part)
for part in (_PACKAGE_DIRECTORY / "java_version.txt").read_text().strip().split(".")
)
]
JAVA_VERSION: Tuple[int, int, int] = _major, _minor, _patch
2 changes: 1 addition & 1 deletion jdk4py/java_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0.2
17.0.3
Loading