Skip to content

Commit

Permalink
Build linux aarch64 and armv7 wheels
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuele Giaquinta <[email protected]>
  • Loading branch information
exg committed Jan 18, 2024
1 parent 36cd7a9 commit e0cc462
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 6 deletions.
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: [
{
arch: 'aarch64',
target: 'aarch64-unknown-linux-gnu',
maturin_args: '',
},
{
arch: 'armv7',
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 }}
- if: ${{ matrix.python-version == '3.10' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.target.arch }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y g++ python3-dev python3-venv
run: |
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

0 comments on commit e0cc462

Please sign in to comment.