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

CI: Add testing for Musl Linux #52953

Merged
merged 10 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
40 changes: 40 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,46 @@ jobs:
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-32bit
cancel-in-progress: true

Linux-Musl:
runs-on: ubuntu-22.04
container:
image: quay.io/pypa/musllinux_1_1_x86_64
steps:
- name: Checkout pandas Repo
# actions/checkout does not work since it requires node
run: |
git config --global --add safe.directory $PWD

if [ $GITHUB_EVENT_NAME != pull_request ]; then
git clone --recursive --branch=$GITHUB_REF_NAME https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE
git reset --hard $GITHUB_SHA
else
git clone --recursive https://github.com/${GITHUB_REPOSITORY}.git $GITHUB_WORKSPACE
git fetch origin $GITHUB_REF:my_ref_name
git checkout $GITHUB_BASE_REF
git -c user.email="you@example.com" merge --no-commit my_ref_name
fi
- name: Configure System Packages
run: |
export MUSL_LOCPATH=/usr/share/i18n/locales/musl
apk update
apk add musl-locales musl-locales-lang
- name: Build environment and Run Tests
run: |
/opt/python/cp39-cp39/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir --no-deps -U pip wheel setuptools
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python setup.py build_ext -q -j$(nproc)
python -m pip install --no-cache-dir --no-build-isolation --no-use-pep517 -e .
python -m pip list
export PANDAS_CI=1
python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably have the call to tests in its own step, if I'm not missing a reason to have it together with the creation of the environment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I'll put this in it's own step

concurrency:
# https://github.saobby.my.eu.orgmunity/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-musl
cancel-in-progress: true

python-dev:
# This job may or may not run depending on the state of the next
# unreleased Python version. DO NOT DELETE IT.
Expand Down
2 changes: 2 additions & 0 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from pandas.compat._constants import (
IS64,
ISMUSL,
PY310,
PY311,
PYPY,
Expand Down Expand Up @@ -160,6 +161,7 @@ def get_lzma_file() -> type[pandas.compat.compressors.LZMAFile]:
"pa_version_under9p0",
"pa_version_under11p0",
"IS64",
"ISMUSL",
"PY310",
"PY311",
"PYPY",
Expand Down
3 changes: 3 additions & 0 deletions pandas/compat/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@

import platform
import sys
import sysconfig

IS64 = sys.maxsize > 2**32

PY310 = sys.version_info >= (3, 10)
PY311 = sys.version_info >= (3, 11)
PYPY = platform.python_implementation() == "PyPy"
ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "")


__all__ = [
"IS64",
"ISMUSL",
"PY310",
"PY311",
"PYPY",
Expand Down
16 changes: 15 additions & 1 deletion pandas/tests/config/test_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
set_locale,
)

from pandas.compat import ISMUSL

import pandas as pd

_all_locales = get_locales()
Expand Down Expand Up @@ -46,7 +48,19 @@ def test_can_set_locale_valid_set(lc_var):
assert before_locale == after_locale


@pytest.mark.parametrize("lc_var", (locale.LC_ALL, locale.LC_CTYPE, locale.LC_TIME))
@pytest.mark.parametrize(
"lc_var",
(
locale.LC_ALL,
pytest.param(
locale.LC_CTYPE,
marks=pytest.mark.skipif(
ISMUSL, reason="MUSL allows setting invalid LC_CTYPE."
),
),
locale.LC_TIME,
),
)
def test_can_set_locale_invalid_set(lc_var):
# Cannot set an invalid locale.
before_locale = _get_current_locale(lc_var)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/tslibs/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_parsing_tzlocal_deprecated():
msg = "Pass the 'tz' keyword or call tz_localize after construction instead"
dtstr = "Jan 15 2004 03:00 EST"

with tm.set_timezone("US/Eastern"):
with tm.set_timezone("EST5EDT"):
with tm.assert_produces_warning(FutureWarning, match=msg):
res, _ = parse_datetime_string_with_reso(dtstr)

Expand Down