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

Build linux aarch64 and armv7 wheels #219

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,59 @@ jobs:
path: target/wheels
retention-days: 1

build-linux-cross:
name: Build Linux wheel
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
target: [
{
platform: 'linux/arm64',
target: 'aarch64-unknown-linux-gnu',
maturin_args: '',
},
{
platform: 'linux/arm/v7',
target: 'armv7-unknown-linux-gnueabihf',
maturin_args: '--no-default-features',
},
]
env:
CC: "gcc"
CFLAGS: "-O2"
LDFLAGS: "-O2 -flto -Wl,--as-needed"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"

steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target.target }}
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
manylinux: auto
args: --release --strip -i python${{ matrix.python-version }} ${{ matrix.target.maturin_args }}
- uses: docker/setup-qemu-action@v3
- run: |
docker run \
--rm \
-v "$GITHUB_WORKSPACE":/work \
-w /work \
--platform ${{ matrix.target.platform }} \
python:${{ matrix.python-version }}-bookworm \
bash -e -c '
python3 -m venv .venv
.venv/bin/pip install -U pip wheel
.venv/bin/pip install -r tests/requirements.txt
.venv/bin/pip install ormsgpack --no-index -f target/wheels
.venv/bin/pytest
'
- uses: actions/upload-artifact@v3
with:
name: wheels
path: target/wheels
retention-days: 1

build-windows:
name: Build Windows wheel
runs-on: windows-latest
Expand Down Expand Up @@ -157,6 +210,7 @@ jobs:
TWINE_USERNAME: ${{secrets.TWINE_USERNAME}}
needs: [
build-linux-x86_64,
build-linux-cross,
build-windows,
build-macos-x86_64,
build-macos-universal,
Expand Down
5 changes: 2 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
arrow
numpy
pendulum
psutil;sys_platform!="windows"
numpy;platform_machine!="armv7l"
pendulum;platform_machine!="armv7l"
pytest
pytz
xxhash==1.4.3;sys_platform!="windows" and python_version<"3.9" # creates non-compact ASCII for test_str_ascii
Expand Down
29 changes: 26 additions & 3 deletions tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
import sys

import msgpack
import pendulum
import pytest
import pytz
from dateutil import tz

import ormsgpack

try:
import pendulum
except ImportError:
pendulum_timezone = None
pendulum_UTC = None
else:
pendulum_timezone = pendulum.timezone
pendulum_UTC = pendulum.UTC

if sys.version_info >= (3, 9):
import zoneinfo

Expand All @@ -22,7 +30,14 @@


TIMEZONE_PARAMS = (
pytest.param(pendulum.timezone, id="pendulum"),
pytest.param(
pendulum_timezone,
id="pendulum",
marks=pytest.mark.skipif(
pendulum_timezone is None,
reason="pendulum not available",
),
),
pytest.param(pytz.timezone, id="pytz"),
pytest.param(tz.gettz, id="dateutil"),
pytest.param(
Expand Down Expand Up @@ -106,7 +121,14 @@ def test_datetime_tz_assume():
"timezone",
(
pytest.param(datetime.timezone.utc, id="datetime"),
pytest.param(pendulum.UTC, id="pendulum"),
pytest.param(
pendulum_UTC,
id="pendulum",
marks=pytest.mark.skipif(
pendulum_UTC is None,
reason="pendulum not available",
),
),
pytest.param(pytz.UTC, id="pytz"),
pytest.param(tz.UTC, id="dateutil"),
pytest.param(
Expand Down Expand Up @@ -335,6 +357,7 @@ def test_datetime_utc_z_with_tz():
}


@pytest.mark.skipif(pendulum_timezone is None, reason="pendulum not available")
def test_datetime_roundtrip():
"""
datetime.datetime parsed by pendulum
Expand Down